@@ -34,7 +34,7 @@ def main():
3434 state = WAIT_FOR_NEW_GOAL
3535 solution_found = False
3636 while True :
37- old_goal = goal_pos
37+ old_goal = np . ndarray ( goal_pos )
3838 goal_pos = arm .goal
3939 end_effector = arm .end_effector
4040 errors , distance = distance_to_goal (end_effector , goal_pos )
@@ -51,7 +51,7 @@ def main():
5151 elif solution_found :
5252 state = MOVING_TO_GOAL
5353 elif state is MOVING_TO_GOAL :
54- if distance > 0.1 and (old_goal == goal_pos ). all ( ):
54+ if distance > 0.1 and all (old_goal == goal_pos ):
5555 joint_angles = joint_angles + Kp * \
5656 ang_diff (joint_goal_angles , joint_angles ) * dt
5757 else :
@@ -93,8 +93,8 @@ def animation():
9393
9494 i_goal = 0
9595 while True :
96- old_goal = goal_pos
97- goal_pos = arm .goal
96+ old_goal = np . array ( goal_pos )
97+ goal_pos = np . array ( arm .goal )
9898 end_effector = arm .end_effector
9999 errors , distance = distance_to_goal (end_effector , goal_pos )
100100
@@ -111,7 +111,7 @@ def animation():
111111 elif solution_found :
112112 state = MOVING_TO_GOAL
113113 elif state is MOVING_TO_GOAL :
114- if distance > 0.1 and (old_goal == goal_pos ). all ( ):
114+ if distance > 0.1 and all (old_goal == goal_pos ):
115115 joint_angles = joint_angles + Kp * \
116116 ang_diff (joint_goal_angles , joint_angles ) * dt
117117 else :
@@ -160,5 +160,5 @@ def ang_diff(theta1, theta2):
160160
161161
162162if __name__ == '__main__' :
163- main ()
164- # animation()
163+ # main()
164+ animation ()
0 commit comments