ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Calculate velocity and acceleration when joint positions are provided

asked 2019-01-23 05:06:09 -0500

shyamashi gravatar image

updated 2021-10-12 09:45:08 -0500

lucasw gravatar image

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+n*dq1, q2+n*dq2,......., 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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-01-23 05:09:08 -0500

gvdhoorn gravatar image

Take a look at Time Parameterization as provided by MoveIt.

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

edit flag offensive delete link more

Comments

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?

shyamashi gravatar image shyamashi  ( 2019-01-23 05:50:00 -0500 )edit

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

gvdhoorn gravatar image gvdhoorn  ( 2019-01-23 07:04:34 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-01-23 05:06:09 -0500

Seen: 1,092 times

Last updated: Oct 12 '21