# Calculate velocity and acceleration when joint positions are provided

Hello, I am working Ubuntu 16.04, Ros-Kinetic and using 7-DOF panda manipulator arm (all rotary joints). I have a function which gives me the joint_positions as [ [q1, q2, ..q7], [q1+dq1, q2+dq2....., q7+dq7], ....... [q1+ndq1, q2+ndq2,......., q7+n*dq7]] I want to create a joint trajectory just like the group.plan() function in moveit. This moveit function generates velocities, acceleration, time_from_start etc which then is fed to group.go() or group.execute(). I would like to use exactly the same functionality but with my joint positions in the trajectory_msgs\JointTrajectory message.

Is there a way to use some functions to calculate the velocities, accelerations etc? I am hoping to find something so that I can use the following function to create the jointTrajectory msg 

def create_trajectory(positions, velocities, accelerations, t):
joint_trajectory = JointTrajectory()
for i in range(0, len(q_list)):
point = JointTrajectoryPoint()
point.positions = list(q_list[i])
point.velocities = list(v_list[i])
point.accelerations = list(a_list[i])
point.time_from_start = rospy.Duration(t[i])
joint_trajectory.points.append(point)
joint_trajectory.joint_names = self.joint_names
return joint_trajectory




Any help would be really appreciated. Thanks

Ash Babu

edit retag close merge delete

Sort by » oldest newest most voted

Take a look at Time Parameterization as provided by MoveIt.

It's not perfect, but it's a start.

more

Thanks for the reply. This seems to be exactly what I need. The only problem is I work in Python and not really familiar with C++. Is there some way I can call Iterative Spline Parameterization in Python?

I'm not sure whether the Python move group API exposes this. I don't really use Python with MoveIt unfortunately.