ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Understanding trajectory_msgs/JointTrajectory

asked 2013-02-11 12:03:19 -0600

updated 2014-01-28 17:15:11 -0600

ngrennan gravatar image

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.



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-11 12:34:59 -0600

jbohren gravatar image

updated 2013-02-11 12:37:55 -0600

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]

edit flag offensive delete link more


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

PeterMilani gravatar image PeterMilani  ( 2013-02-11 12:42:34 -0600 )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.

Ashesh gravatar image Ashesh  ( 2013-03-02 05:22:15 -0600 )edit

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.

PeterMilani gravatar image PeterMilani  ( 2013-03-02 11:40:18 -0600 )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?

varunagrawal gravatar image varunagrawal  ( 2016-02-01 20:48:25 -0600 )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.

jbohren gravatar image jbohren  ( 2016-02-10 16:28:43 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-02-11 12:03:19 -0600

Seen: 6,103 times

Last updated: Mar 02 '13