get more accurate

This commit is contained in:
2024-09-07 16:47:14 +08:00
parent 4c409ace18
commit 095f63d154
7 changed files with 15 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
import mpmath as mp
import json
mp.dps = 15 # 设置精度为15位小数
mp.dps = 50 # 设置精度为15位小数
kSegLength1 = mp.mpf('2.86')
kSegLength2 = mp.mpf('1.65')

View File

@@ -1,7 +1,7 @@
import mpmath as mp
import json
mp.dps = 15 # 设置精度为15位小数
mp.dps = 50 # 设置精度为50位小数
kSegLength1 = mp.mpf('2.86')
kSegLength2 = mp.mpf('1.65')

View File

@@ -9,7 +9,7 @@ import threading
import numba
import multiprocessing
mp.dps = 15 # 设置精度为15位小数
mp.dps = 50 # 设置精度为50位小数
kSegLength1 = mp.mpf('2.86')
kSegLength2 = mp.mpf('1.65')
@@ -35,7 +35,7 @@ def GenerateFollowNodeTheta(cur_node_theta, expected_distance):
test_node_dot = Theta2Dot(theta)
actual_distance = mp.sqrt((cur_node_dot[0]-test_node_dot[0])**2 + (cur_node_dot[1]-test_node_dot[1])**2)
return actual_distance - expected_distance
return mp.findroot(f, cur_node_theta + 0.1, solver='secant',tol=1e-20)
return mp.findroot(f, cur_node_theta + 0.1, solver='secant')
kPointsConsidered=50
def CalcMoveList(time_point):

View File

@@ -8,7 +8,7 @@ import numpy as np
if __name__ != "__main__":
sys.exit()
mp.dps = 15 # 设置精度为15位小数
mp.dps = 50 # 设置精度为15位小数
kSegLength1 = mp.mpf('2.86')
kSegLength2 = mp.mpf('1.65')

View File

@@ -11,7 +11,7 @@ import multiprocessing
import io
from PIL import Image
mp.dps = 15 # 设置精度为15位小数
mp.dps = 50 # 设置精度为50位小数
kSegLength1 = mp.mpf('2.86')
kSegLength2 = mp.mpf('1.65')
@@ -37,7 +37,7 @@ class Dragon:
test_node_dot = self.Theta2Dot(theta)
actual_distance = mp.sqrt((cur_node_dot[0]-test_node_dot[0])**2 + (cur_node_dot[1]-test_node_dot[1])**2)
return actual_distance - expected_distance
return mp.findroot(f, cur_node_theta + 0.1, solver='secant',tol=1e-20)
return mp.findroot(f, cur_node_theta + 0.1, solver='secant')
def CalcMoveList(self, delta_theta=0):

View File

@@ -1,15 +1,15 @@
from dragon import *
kPitchToTest=0.450338
kPitchToTest=mp.mpf("0.45033740")
kDeltaThetaBeg=0
kDeltaThetaEnd=2*2*3.1415926
kTotalSteps=100000
kTotalSteps=10000
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/kTotalSteps
kParallelNum=24
tasks_list=[i for i in np.arange(kDeltaThetaBeg, kDeltaThetaEnd, kStepDeltaTheta)]
task_list_per_process=[tasks_list[i::kParallelNum] for i in range(kParallelNum)]
print(f"len(task_list_per_thread)={len(task_list_per_process)}",file=sys.stderr)
def ProcessEntryPoint(arg):
dragen = Dragon(mp.mpf(kPitchToTest)/(2*mp.pi))
dragen = Dragon(kPitchToTest/(2*mp.pi))
delta_theta_list, process_id = arg
logf=open(f"sufficiency_test_{process_id}.log","w")
print(f"calculating delta_theta_list={delta_theta_list} with process_id={process_id}",file=logf)
@@ -29,7 +29,7 @@ if __name__ == "__main__":
else:
print("OK")
# Now generate an gif for human to check
dragen = Dragon(mp.mpf(kPitchToTest)/(2*mp.pi))
dragen = Dragon(kPitchToTest/(2*mp.pi))
kTotalFrames=100
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/kTotalFrames
frame_list=[]

View File

@@ -1,7 +1,7 @@
from dragon import *
kBegPitch = 0.4503
kEndPitch = 0.4504
kTotalSteps = 100
kBegPitch = 0.45033
kEndPitch = 0.45034
kTotalSteps = 1000
kStepPitch = (kEndPitch - kBegPitch) / kTotalSteps
kParallelNum=24
tasks_list = [kBegPitch + kStepPitch * i for i in range(kTotalSteps)]
@@ -9,7 +9,7 @@ task_list_per_process=[tasks_list[i::kParallelNum] for i in range(kParallelNum)]
kDeltaThetaBeg=0
kDeltaThetaEnd=5*2*3.1415926
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/1000
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/100
print(f"len(task_list_per_thread)={len(task_list_per_process)}",file=sys.stderr)
def ProcessEntryPoint(arg):
pitch_list, process_id, shared_dict, lock = arg