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

Revision history [back]

click to hide/show revision 1
initial version

The easiest way would probably be just to forward rostopic echo output with the -p flag to some output file.

Lets say the name of your "geometry_msgs/TransformStamped" topic is "/turtlebot/stamped_transform". Then entering the command:

$rostopic echo -p /turtlebot/stamped_transform/transform/translation > xyz_output.csv

will produce a text file xyz_output.csv with the data formated like the example below.

%time,field.x,field.y,field.z
1531725938918082952,-354.547943115,-41.9697914124,-33.9759483337
1531725939051723003,-354.530578613,-41.9656219482,-33.9720916748
1531725939181190967,-354.52633667,-41.9511375427,-33.9718017578

You can extract this data straight from the bag files as well. As described in the answers for this question.

$ rostopic echo -b file.bag -p /turtlebot/stamped_transform/transform/translation > data.csv

The -p flag for rostopic will format the data for csv, you can read more about the different flags in the ros wiki page.

http://wiki.ros.org/rostopic#rostopic_echo

The easiest way would probably be just to forward rostopic echo output with the -p flag to some output file.

Lets say the name of your "geometry_msgs/TransformStamped" topic is "/turtlebot/stamped_transform". Then entering the command:

$rostopic echo -p /turtlebot/stamped_transform/transform/translation > xyz_output.csv

will produce a text file xyz_output.csv with the data formated like the example below.

%time,field.x,field.y,field.z
1531725938918082952,-354.547943115,-41.9697914124,-33.9759483337
1531725939051723003,-354.530578613,-41.9656219482,-33.9720916748
1531725939181190967,-354.52633667,-41.9511375427,-33.9718017578

You can extract this data straight from the bag files as well. As described in the answers for this question.

$ rostopic echo -b file.bag -p /turtlebot/stamped_transform/transform/translation > data.csv

The -p flag for rostopic will format the data for csv, you can read more about the different flags in the ros wiki page.

http://wiki.ros.org/rostopic#rostopic_echo

$rostopic echo -p /turtlebot/stamped_transform/transform/translation/x > x_output.csv

Will output:

%time,field
1531729453445930957,-354.554626465
1531729453510648012,-354.544036865
1531729453645477056,-354.537231445