mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:22 -04:00
clean up seven joint arm script
This commit is contained in:
@@ -224,7 +224,7 @@ class RRTStar:
|
|||||||
path.append(node.x)
|
path.append(node.x)
|
||||||
node = node.parent
|
node = node.parent
|
||||||
path.append(node.x)
|
path.append(node.x)
|
||||||
|
reversed(path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def calc_dist_to_goal(self, x):
|
def calc_dist_to_goal(self, x):
|
||||||
@@ -385,17 +385,22 @@ def main():
|
|||||||
# Draw final path
|
# Draw final path
|
||||||
if show_animation:
|
if show_animation:
|
||||||
ax = rrt_star.draw_graph()
|
ax = rrt_star.draw_graph()
|
||||||
for i, q in enumerate(reversed(path)):
|
|
||||||
x_points, y_points, z_points = seven_joint_arm.get_points(q)
|
# Plot final configuration
|
||||||
if i == 0 or i == len(path) - 1:
|
x_points, y_points, z_points = seven_joint_arm.get_points(path[-1])
|
||||||
color = None
|
|
||||||
else:
|
|
||||||
color = "grey"
|
|
||||||
ax.plot([x for x in x_points],
|
ax.plot([x for x in x_points],
|
||||||
[y for y in y_points],
|
[y for y in y_points],
|
||||||
[z for z in z_points],
|
[z for z in z_points],
|
||||||
"o-", color=color, ms=4, mew=0.5)
|
"o-", color="red", ms=5, mew=0.5)
|
||||||
|
|
||||||
|
for i, q in enumerate(path):
|
||||||
|
x_points, y_points, z_points = seven_joint_arm.get_points(q)
|
||||||
|
ax.plot([x for x in x_points],
|
||||||
|
[y for y in y_points],
|
||||||
|
[z for z in z_points],
|
||||||
|
"o-", color="grey", ms=4, mew=0.5)
|
||||||
plt.pause(0.01)
|
plt.pause(0.01)
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
@@ -3,10 +3,10 @@ import sys
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
|
||||||
"/../ArmNavigation/seven_joint_arm_to_point_control/")
|
"/../ArmNavigation/rrt_star_seven_joint_arm_control/")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import rrt_star_seven_joint_arm as m
|
import rrt_star_seven_joint_arm_control as m
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user