Ask Your Question

Saving Arm Trajectory and Replaying it

asked 2013-03-02 05:39:50 -0500

Ashesh gravatar image

updated 2014-11-22 17:05:36 -0500

ngrennan gravatar image


How can I save PR2 arm trajectory and then replay the same trajectory at a later time? One way I can think of it is by writing trajectory_msg::JointTrajectory to a file and then reading the trajectory from the file whenever I need to reproduce the trajectory. But if I follow this method then I am not sure how to save "duration time_to_start" (which have many attributes) and "Header header".

Does anyone knows of any neater way for saving/replaying trajectories?


edit retag flag offensive close merge delete


How can i write trajectory_msg::JointTrajectory to a file?

RosRos gravatar image RosRos  ( 2013-03-14 00:09:22 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-03 22:58:44 -0500

updated 2013-03-03 23:01:52 -0500

Hi Ashesh

Apart from using stdio.h to write code to read a file of strings formatted like trajectory_msgs::JointTrajectory. You could try writing rostopic messages to your node. Or write your own YAML file that contains the information about your trajectory and upload it to the parameter server. Then using a node to read the parameter server and format a JointTrajectory msgs from the information and publishing it.

As for converting an integer or float to a duration type you can save your duration as a float or integer and use:


with the time in seconds in the brackets. And your stamp values in your header you just use:

header.stamp = ros::Time::now();

before you publish it.

hope it helps

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2013-03-02 05:39:50 -0500

Seen: 272 times

Last updated: Mar 03 '13