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

Saving Arm Trajectory and Replaying it

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

Ashesh gravatar image

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

ngrennan gravatar image

Hello

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?

Thanks!!!

edit retag flag offensive close merge delete

Comments

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

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

1 Answer

Sort by ยป oldest newest most voted
1

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

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

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:

ros::Duration(24*60*60);

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

Question Tools

1 follower

Stats

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

Seen: 401 times

Last updated: Mar 03 '13