Robotics StackExchange | Archived questions

Align rviz marker text

I'm making rviz markers by following the ROS wiki docs for rviz markers. I'm working with the TEXT_VIEW_FACING type of marker. By default, the text is centered on marker.pose.position, but I'd really like to left-align the text.

I'd do this by adding half its width to the y-position, but I don't know the marker's width. I could compute it from number of characters and average character width, but rviz uses a variable-width font, so that's only an approximation.

Is there a good way to cleanly align rviz marker text?

Asked by dinosaur on 2015-09-16 19:31:28 UTC

Comments

Answers

https://github.com/ros-visualization/rviz/blob/kinetic-devel/src/rviz/default_plugin/markers/text_view_facing_marker.cpp#L62 could set the fontName ( https://github.com/ros-visualization/rviz/blob/kinetic-devel/src/rviz/ogre_helpers/movable_text.cpp#L64 ) to something fixed width. 'Courier' maybe?

Asked by lucasw on 2016-04-19 12:03:00 UTC

Comments

I'm struggling with the alignment of the TEXT_VIEW_FACING marker. Does someone have an example of how to left-align the text?

Asked by roscb on 2019-11-06 11:10:40 UTC