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

How to visualize a frame pose as a path

asked 2012-02-21 03:51:51 -0600

damonkohler gravatar image

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

ngrennan gravatar image

I'd like to generate an image similar to the one at the end of the demo video here: http://www.ros.org/wiki/hector_mapping

In the image, the generated map and the pose of the /base_link frame over time in the /map frame are overlayed. What is the best way to build such an image?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
8

answered 2012-02-21 04:06:33 -0600

updated 2012-02-22 19:07:37 -0600

The map in the video was generated using the hector_geotiff node. This node retrieves the map and trajectory via services as stated at the wiki page. The trajectory is tracked via the hector_trajector_server package, which provides a node that saves a tf based trajectory given a source and target frame. The trajectory is published on a topic as well as available as a service.

Have you looked at the 'Mapping using logged data' tutorial? The process of mapping and saving to geotiff is described there. Note that the map saving functionality works with maps generated by gmapping or other SLAM systems as well.

/edit: This example launch file should work for you:

<?xml version="1.0"?>

<launch>

  <node pkg="hector_trajectory_server" type="hector_trajectory_server" name="hector_trajectory_server" output="screen">
    <param name="target_frame_name" type="string" value="/map" />
    <param name="source_frame_name" type="string" value="/base_link" />
    <param name="trajectory_update_rate" type="double" value="4" />
    <param name="trajectory_publish_rate" type="double" value="0.25" />
  </node>


  <node pkg="hector_geotiff" type="geotiff_node" name="hector_geotiff_node" output="screen" launch-prefix="nice -n 15">
    <remap from="map" to="/dynamic_map" />
    <param name="map_file_path" type="string" value="$(find hector_geotiff)/maps" />
    <param name="map_file_base_name" type="string" value="hector_slam_map" />
    <param name="draw_background_checkerboard" type="bool" value="true" />
    <param name="draw_free_space_grid" type="bool" value="true" />
  </node>

</launch>

The geotiff map image will be saved every time you publish on the syscommand topic like this:

rostopic pub syscommand std_msgs/String "savegeotiff"
edit flag offensive delete link more

Comments

1

Thanks, I did see that but I didn't realize it would work with gmapping (which I'm using currently). I assume the saved map includes the trajectory overlay?

damonkohler gravatar image damonkohler  ( 2012-02-21 04:27:22 -0600 )edit
1

Yes it does by default. See edited post above, this launch file should work out of the box if I haven't overlooked anything.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-02-21 04:53:29 -0600 )edit

Beautiful! Works great, thanks!

damonkohler gravatar image damonkohler  ( 2012-02-21 19:54:22 -0600 )edit

https://github.com/tu-darmstadt-ros-p... is the localtion of the source code.

lucasw gravatar image lucasw  ( 2021-08-03 12:25:54 -0600 )edit
4

answered 2012-02-21 04:06:59 -0600

DimitriProsser gravatar image

In Rviz, if you enable a nav_msgs/Odometry topic corresponding to /base_link, it will display /base_link's positions over time. You can manually set the number of messages to store in Rviz and then you can see progress over time.

This, of course, assumes that you are correctly publishing an odometry message. This can also be done with a geometry_msgs/PoseStamped that is published based on your robot's position.

edit flag offensive delete link more
2

answered 2016-02-22 11:11:15 -0600

130s gravatar image

In jsk_rviz_plugins (that is available via apt for some ROS distros), there is TFTrajectory plugin (, which I assume relies only on tf data over the time, but I haven't looked into detail). image description (img from http://jsk-visualization.readthedocs.... )

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2012-02-21 03:51:51 -0600

Seen: 14,004 times

Last updated: Feb 22 '16