Packages

README

Rviz Visual Tools

C++ API wrapper for displaying shapes and meshes in Rviz via helper functions that publish markers. Useful for displaying and debugging data. For more advanced robot visualization features, see the moveit_visual_tools which builds on this class.

Change the first parameter to the name of your robot's base frame, and the second parameter to whatever name you'd like to use for the corresponding Rviz marker ROS topic.

Tools

Now in your code you can easily debug your code using visual markers in Rviz

Start rviz and create a new marker using the 'Add' button at the bottom right. Choose the marker topic to be the same as the topic you specified in the constructor.

Example Code

In the following snippet we create a pose at xyz (0.1, 0.1, 0.1) and rotate the pose down 45 degrees along the Y axis. Then we publish the pose as a arrow for visualziation in Rviz. Make sure your Rviz fixed frame is the same as the one chosen in the code.

Mouse-Based Control

Use the Rviz panel called "RvizVisualToolsGui" to step through your program.

Keyboard-Based Control

Switch to the "KeyTool" in the top of the Rviz window and use the following keyboard commands:
- n: next
- c or a: continue
- b: break
- s: stop

API

Basic Publishing Functions

See rviz_visual_tools.h for more details and documentation on the following functions:

publishSphere

publishSpheres

publishArrow/publishXArrow

publishYArrow

publishZArrow

publishCuboid

publishCone

publishXYPlane

publishXZPlane

publishYZPlane

publishLine

publishPath

publishPolygon

publishBlock

publishWireframeCuboid

publishWireframeRectangle

publishAxis

publishAxisLabeled

publishCylinder

publishMesh

publishText

publishTest

And more...

Helper Functions

Reset function

deleteAllMarkers() - tells Rviz to clear out all current markers from being displayed.

All markers must be triggered after being published, by calling the trigger() function. This allows batch publishing to be achieved by only calling after several markers have been created, greatly increasing the speed of your application. You can even explicitly tell rviz_visual_tools how often to publish via the triggerEvery(NUM_MARKERS) command:

trigger()

triggerEvery(20)

Conversion functions

convertPose

convertPoint32ToPose

convertPoseToPoint

convertPoint

convertPoint32

convertFromXYZRPY

convertToXYZRPY

Convenience functions

generateRandomPose

generateEmptyPose

dRand

fRand

iRand

getCenterPoint

getVectorBetweenPoints

Frame locking

This allows the markers to be automatically updated as the base frame moves without having to republish. You can enable it via enableFrameLocking() (this is not enabled by default).

Available Colors

This package helps you quickly choose colors - feel free to send PRs with more colors as needed

Docker Image

Dockerhub automatically creates a Docker for this repo. To run with GUI:

# This is not the safest way however, as you then compromise the access control to X server on your host
xhost +local:root # for the lazy and reckless
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" davetcoleman/rviz_visual_tools:melodic
export containerId=$(docker ps -l -q)
# Close security hole:
xhost -local:root

(Optional) To build the docker image locally for this repo, run in base of package:

docker build -t davetcoleman/rviz_visual_tools:melodic .

Contribute

Please send PRs for new helper functions, fixes, etc!

When a pull request is opened, a reviewer is randomly assigned from the reviewer list using the Auto Assign Github Bot

No version for distro lunar. Known supported distros are highlighted in the buttons above.

Packages

README

Rviz Visual Tools

C++ API wrapper for displaying shapes and meshes in Rviz via helper functions that publish markers. Useful for displaying and debugging data. For more advanced robot visualization features, see the moveit_visual_tools which builds on this class.

Change the first parameter to the name of your robot's base frame, and the second parameter to whatever name you'd like to use for the corresponding Rviz marker ROS topic.

Tools

Now in your code you can easily debug your code using visual markers in Rviz

Start rviz and create a new marker using the 'Add' button at the bottom right. Choose the marker topic to be the same as the topic you specified in the constructor.

Example Code

In the following snippet we create a pose at xyz (0.1, 0.1, 0.1) and rotate the pose down 45 degrees along the Y axis. Then we publish the pose as a arrow for visualziation in Rviz. Make sure your Rviz fixed frame is the same as the one chosen in the code.

Mouse-Based Control

Use the Rviz panel called "RvizVisualToolsGui" to step through your program.

Keyboard-Based Control

Switch to the "KeyTool" in the top of the Rviz window and use the following keyboard commands:
- n: next
- c or a: continue
- b: break
- s: stop

API

Basic Publishing Functions

See rviz_visual_tools.h for more details and documentation on the following functions:

publishSphere

publishSpheres

publishArrow/publishXArrow

publishYArrow

publishZArrow

publishCuboid

publishCone

publishXYPlane

publishXZPlane

publishYZPlane

publishLine

publishPath

publishPolygon

publishBlock

publishWireframeCuboid

publishWireframeRectangle

publishAxis

publishAxisLabeled

publishCylinder

publishMesh

publishMesh

publishText

publishTest

And more...

Helper Functions

Reset function

deleteAllMarkers() - tells Rviz to clear out all current markers from being displayed.

All markers must be triggered after being published, by calling the trigger() function. This allows batch publishing to be achieved by only calling after several markers have been created, greatly increasing the speed of your application. You can even explicitly tell rviz_visual_tools how often to publish via the triggerEvery(NUM_MARKERS) command:

trigger()

triggerEvery(20)

Conversion functions

convertPose

convertPoint32ToPose

convertPoseToPoint

convertPoint

convertPoint32

convertFromXYZRPY

convertToXYZRPY

Convenience functions

generateRandomPose

generateEmptyPose

dRand

fRand

iRand

getCenterPoint

getVectorBetweenPoints

Frame locking

This allows the markers to be automatically updated as the base frame moves without having to republish. You can enable it via enableFrameLocking() (this is not enabled by default).

Available Colors

This package helps you quickly choose colors - feel free to send PRs with more colors as needed

Docker Image

Dockerhub automatically creates a Docker for this repo. To run with GUI:

# This is not the safest way however, as you then compromise the access control to X server on your host
xhost +local:root # for the lazy and reckless
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" davetcoleman/rviz_visual_tools:kinetic
export containerId=$(docker ps -l -q)
# Close security hole:
xhost -local:root

(Optional) To build the docker image locally for this repo, run in base of package:

Change the first parameter to the name of your robot's base frame, and the second parameter to whatever name you'd like to use for the corresponding Rviz marker ROS topic.

Tools

Now in your code you can easily debug your code using visual markers in Rviz

Start rviz and create a new marker using the 'Add' button at the bottom right. Choose the marker topic to be the same as the topic you specified in the constructor.

Example Code

In the following snippet we create a pose at xyz (0.1, 0.1, 0.1) and rotate the pose down 45 degrees along the Y axis. Then we publish the pose as a arrow for visualziation in Rviz. Make sure your Rviz fixed frame is the same as the one chosen in the code.

Available Marker Sizes

Batch Publishing

There is a new feature that allows markers to be saved up in an array until a trigger is recieved to send all markers to Rviz for visualization. This is useful when many markers need to be published at once that can overflow the Rviz message buffers. To enable, use enableBatchPublishing(true) and to trigger use `triggerBatchPublish().

Testing and Linting

Use the following command with catkin-tools to run the small amount of available tests:

catkin run_tests --no-deps --this -i

Docker Image

To build the docker image for this repo:

docker build -t davetcoleman/rviz_visual_tools:indigo .

To run with GUI:

# This is not the safest way however, as you then compromise the access control to X server on your host
xhost +local:root # for the lazy and reckless
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" davetcoleman/rviz_visual_tools:indigo
export containerId=$(docker ps -l -q)
# Close security hole:
xhost -local:root

Contribute

Please send PRs for new helper functions, fixes, etc!

No version for distro ardent. Known supported distros are highlighted in the buttons above.

Repository Summary

Packages

README

Rviz Visual Tools

C++ API wrapper for displaying shapes and meshes in Rviz via helper functions that publish markers. Useful for displaying and debugging data. For more advanced robot visualization features, see the moveit_visual_tools which builds on this class, or ompl_visual_tools if you are an OMPL ROS user.

Change the first parameter to the name of your robot's base frame, and the second parameter to whatever name you'd like to use for the corresponding Rviz marker ROS topic.

Tools

Now in your code you can easily debug your code using visual markers in Rviz

Start rviz and create a new marker using the 'Add' button at the bottom right. Choose the marker topic to be the same as the topic you specified in the constructor.

Example Code

In the following snippet we create a pose at xyz (0.1, 0.1, 0.1) and rotate the pose down 45 degrees along the Y axis. Then we publish the pose as a arrow for visualziation in Rviz. Make sure your Rviz fixed frame is the same as the one chosen in the code.

Available Marker Sizes

Batch Publishing

There is a new feature that allows markers to be saved up in an array until a trigger is recieved to send all markers to Rviz for visualization. This is useful when many markers need to be published at once that can overflow the Rviz message buffers. To enable, use enableBatchPublishing(true) and to trigger use `triggerBatchPublish().

Testing and Linting

Use the following command with catkin-tools to run the small amount of available tests:

catkin run_tests --no-deps --this -i

Docker Image

To build the docker image for this repo:

docker build -t davetcoleman/rviz_visual_tools:jade .

To run with GUI:

# This is not the safest way however, as you then compromise the access control to X server on your host
xhost +local:root # for the lazy and reckless
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" davetcoleman/rviz_visual_tools:jade
export containerId=$(docker ps -l -q)
# Close security hole:
xhost -local:root

Contribute

Please send PRs for new helper functions, fixes, etc!

No version for distro hydro. Known supported distros are highlighted in the buttons above.