confuse about the Baxter joint trajectory program
Hi, everyone
I currently was learning use simple Joint trajectory way to control the robot arm. The example shows in the Baxter wiki there the explain was a bit confuse for me. Here is the program:
def add_point(self, positions, time):
point = JointTrajectoryPoint()
point.positions = copy(positions)
point.time_from_start = rospy.Duration(time)
self._goal.trajectory.points.append(point)
this is the link of the example: Joint Trajectory Client
By the way, the example they had missing some of the code lines which was:
print("Initializing node... ")
rospy.init_node("rsdk_joint_trajectory_client_%s" % (limb,))
print("Getting robot state... ")
rs = baxter_interface.RobotEnable(CHECK_VERSION)
print("Enabling robot... ")
rs.enable()
print("Running. Ctrl-c to quit")
positions = {
'left': [-0.11, -0.62, -1.15, 1.32, 0.80, 1.27, 2.39],
'right': [0.11, -0.62, 1.15, 1.32, -0.80, 1.27, -2.39],
}
And my question is why in the add_point()
there have to use copy(positions)
and at the end of function still have to use append()
to add the point into the list again?
Thank you so much!