get more accurate
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import mpmath as mp
|
import mpmath as mp
|
||||||
import json
|
import json
|
||||||
|
|
||||||
mp.dps = 15 # 设置精度为15位小数
|
mp.dps = 50 # 设置精度为15位小数
|
||||||
|
|
||||||
kSegLength1 = mp.mpf('2.86')
|
kSegLength1 = mp.mpf('2.86')
|
||||||
kSegLength2 = mp.mpf('1.65')
|
kSegLength2 = mp.mpf('1.65')
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import mpmath as mp
|
import mpmath as mp
|
||||||
import json
|
import json
|
||||||
|
|
||||||
mp.dps = 15 # 设置精度为15位小数
|
mp.dps = 50 # 设置精度为50位小数
|
||||||
|
|
||||||
kSegLength1 = mp.mpf('2.86')
|
kSegLength1 = mp.mpf('2.86')
|
||||||
kSegLength2 = mp.mpf('1.65')
|
kSegLength2 = mp.mpf('1.65')
|
||||||
|
@@ -9,7 +9,7 @@ import threading
|
|||||||
import numba
|
import numba
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
mp.dps = 15 # 设置精度为15位小数
|
mp.dps = 50 # 设置精度为50位小数
|
||||||
|
|
||||||
kSegLength1 = mp.mpf('2.86')
|
kSegLength1 = mp.mpf('2.86')
|
||||||
kSegLength2 = mp.mpf('1.65')
|
kSegLength2 = mp.mpf('1.65')
|
||||||
@@ -35,7 +35,7 @@ def GenerateFollowNodeTheta(cur_node_theta, expected_distance):
|
|||||||
test_node_dot = Theta2Dot(theta)
|
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)
|
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 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
|
kPointsConsidered=50
|
||||||
def CalcMoveList(time_point):
|
def CalcMoveList(time_point):
|
||||||
|
@@ -8,7 +8,7 @@ import numpy as np
|
|||||||
if __name__ != "__main__":
|
if __name__ != "__main__":
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
mp.dps = 15 # 设置精度为15位小数
|
mp.dps = 50 # 设置精度为15位小数
|
||||||
|
|
||||||
kSegLength1 = mp.mpf('2.86')
|
kSegLength1 = mp.mpf('2.86')
|
||||||
kSegLength2 = mp.mpf('1.65')
|
kSegLength2 = mp.mpf('1.65')
|
||||||
|
@@ -11,7 +11,7 @@ import multiprocessing
|
|||||||
import io
|
import io
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
mp.dps = 15 # 设置精度为15位小数
|
mp.dps = 50 # 设置精度为50位小数
|
||||||
|
|
||||||
kSegLength1 = mp.mpf('2.86')
|
kSegLength1 = mp.mpf('2.86')
|
||||||
kSegLength2 = mp.mpf('1.65')
|
kSegLength2 = mp.mpf('1.65')
|
||||||
@@ -37,7 +37,7 @@ class Dragon:
|
|||||||
test_node_dot = self.Theta2Dot(theta)
|
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)
|
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 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):
|
def CalcMoveList(self, delta_theta=0):
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
from dragon import *
|
from dragon import *
|
||||||
kPitchToTest=0.450338
|
kPitchToTest=mp.mpf("0.45033740")
|
||||||
kDeltaThetaBeg=0
|
kDeltaThetaBeg=0
|
||||||
kDeltaThetaEnd=2*2*3.1415926
|
kDeltaThetaEnd=2*2*3.1415926
|
||||||
kTotalSteps=100000
|
kTotalSteps=10000
|
||||||
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/kTotalSteps
|
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/kTotalSteps
|
||||||
kParallelNum=24
|
kParallelNum=24
|
||||||
tasks_list=[i for i in np.arange(kDeltaThetaBeg, kDeltaThetaEnd, kStepDeltaTheta)]
|
tasks_list=[i for i in np.arange(kDeltaThetaBeg, kDeltaThetaEnd, kStepDeltaTheta)]
|
||||||
task_list_per_process=[tasks_list[i::kParallelNum] for i in range(kParallelNum)]
|
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)
|
print(f"len(task_list_per_thread)={len(task_list_per_process)}",file=sys.stderr)
|
||||||
def ProcessEntryPoint(arg):
|
def ProcessEntryPoint(arg):
|
||||||
dragen = Dragon(mp.mpf(kPitchToTest)/(2*mp.pi))
|
dragen = Dragon(kPitchToTest/(2*mp.pi))
|
||||||
delta_theta_list, process_id = arg
|
delta_theta_list, process_id = arg
|
||||||
logf=open(f"sufficiency_test_{process_id}.log","w")
|
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)
|
print(f"calculating delta_theta_list={delta_theta_list} with process_id={process_id}",file=logf)
|
||||||
@@ -29,7 +29,7 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
print("OK")
|
print("OK")
|
||||||
# Now generate an gif for human to check
|
# Now generate an gif for human to check
|
||||||
dragen = Dragon(mp.mpf(kPitchToTest)/(2*mp.pi))
|
dragen = Dragon(kPitchToTest/(2*mp.pi))
|
||||||
kTotalFrames=100
|
kTotalFrames=100
|
||||||
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/kTotalFrames
|
kStepDeltaTheta=(kDeltaThetaEnd-kDeltaThetaBeg)/kTotalFrames
|
||||||
frame_list=[]
|
frame_list=[]
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from dragon import *
|
from dragon import *
|
||||||
kBegPitch = 0.4503
|
kBegPitch = 0.45033
|
||||||
kEndPitch = 0.4504
|
kEndPitch = 0.45034
|
||||||
kTotalSteps = 100
|
kTotalSteps = 1000
|
||||||
kStepPitch = (kEndPitch - kBegPitch) / kTotalSteps
|
kStepPitch = (kEndPitch - kBegPitch) / kTotalSteps
|
||||||
kParallelNum=24
|
kParallelNum=24
|
||||||
tasks_list = [kBegPitch + kStepPitch * i for i in range(kTotalSteps)]
|
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
|
kDeltaThetaBeg=0
|
||||||
kDeltaThetaEnd=5*2*3.1415926
|
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)
|
print(f"len(task_list_per_thread)={len(task_list_per_process)}",file=sys.stderr)
|
||||||
def ProcessEntryPoint(arg):
|
def ProcessEntryPoint(arg):
|
||||||
pitch_list, process_id, shared_dict, lock = arg
|
pitch_list, process_id, shared_dict, lock = arg
|
||||||
|
Reference in New Issue
Block a user