# Understanding trajectory_msgs/JointTrajectory

Hi All

In working with the JointTrajectory message, I'm a bit unsure as to how the data should be filled.

If we have an arm with 7 joints, and a trajectory for those joints that has 100 points should the JointTrajectory message sizes be as follows:

joint_names -- size = 700

points -- size =700

if so, then should the arrays in JointTrajectoryPoints be all uniary?

Else should the sizes be:

joint_names -- size = 7

points -- size =7

and the position, velocity and acceleration arrays all be 100 in size. But if this is so, then time_from_start should also have 100 points. instead its just a single value

I know this can be a simple question but I'd appreciate some clarification.

cheers

Peter

edit retag close merge delete

Sort by » oldest newest most voted

The trajectory_msgs/JointTrajectory message is as follows:

std_msgs/Header header
uint32 seq
time stamp
string frame_id
string[] joint_names
trajectory_msgs/JointTrajectoryPoint[] points
float64[] positions
float64[] velocities
float64[] accelerations
duration time_from_start


If you have an arm with 7 joints, and a trajectory with 100 points, then the size of joint_names should be 7 and the size of points should be 100. For each point, the elements positions, velocities, and accelerations will be of size 7.

The idea is that for point p and joint j, joint_names[j] corresponds to points[p].positions[j]

more

beauty! Thanks for the clarification, -- a third option I hadn't considered!

( 2013-02-11 12:42:34 -0500 )edit

Can you please specify what should be the values for the position? Is it cartesian coordinates from the base of the robot? And in what units, metres or something else?

( 2016-02-01 20:48:25 -0500 )edit

Positions are all in joint space, and the units depend on the kind of joint. The standard unit for revolute joints is radian, and the standard unit for prismatic joints is meters.

( 2016-02-10 16:28:43 -0500 )edit

Is it possible in ROS to save a trajectory and then play it at a later time? One way I can think of is writing trajectory_msgs/JointTrajectory to a file and then reading it when I need to execute the trajectory. But I am not sure how to save duration time_to_start. Duration seems to have too many attributes.

more

Hi Ashesh you probably should have this as a separate question. But yes you could do this, you would need a node to read your trajectory file. The duration time_from_start (there is no time_to_start) is simply the duration from your header.stamp time. The header.stamp is your start time.

( 2013-03-02 11:40:18 -0500 )edit