Contents
- 1 Overview
- 2 Installation
- 3 Usage
- 4 Baxter Sensors for Visualization
- 5 Troubleshooting
- 5.1 Segmentation Fault
- 5.2 Model is White/Grayed out
- 5.3 Flickering Flickering in rviz 3D and camera views
- 5.4 Graphics context not supported (i.e. trying to run rviz in VM)
- 5.5 Global: Fixed Frame is broken on start (set to /map by default)
- 5.6 Global: Fixed Frame is empty, as is drop-down
- 5.7 When you try to Add >> Display Types, the list is empty
- 5.8 RViz in VMWare
- 5.9 Flickering 3D View
- 5.10 3D Hardware Acceleration
- 5.11 Bypassing Hardware Acceleration
Overview
rviz (ROS visualization) is a 3D visualizer for displaying sensor data and state information from ROS. Using rviz, you can visualize Baxter's current configuration on a virtual model of the robot. You can also display live representations of sensor values coming over ROS Topics including camera data, infrared distance measurements, sonar data, and more.
Installation
$ sudo apt-get update
$ sudo apt-get install ros-indigo-rviz
$ sudo apt-get update
$ sudo apt-get install ros-hydro-rviz
$ sudo apt-get update
$ sudo apt-get install ros-groovy-rviz
Usage
Start rviz from a properly initialized environment using:
$ rosrun rviz rviz
Use a 'Fixed Frame' of /world
.
Info: The ‘Fixed Frame’ provides a static, base reference for your visualization. Any sensor data that comes in to rviz will be transformed into that reference frame so it can be properly displayed in the virtual world.
Robot Visualization
Add a Robot Model Display
Select the ‘Add’ button under the Displays sidebar. In the Dialog that pops up, scroll to ‘Robot Model’ (under the ‘Builtin’ category), and then hit ‘OK’ to add a visual representation of the robot’s current pose.
Note: By default, all the parameters should be set correctly but just in case check the following:
- Robot Description:
robot_description
.robot_description
is the name of the ros parameter where the URDF is stored on parameter server. (this stores the description of what links and joints are on the robot, and where they connect)
- TF Prefix: (blank). Change this if you have a tf tree under a different namespace. For example, if you are publishing the robot’s intended pose under the ‘/reference/____’ prefix; or if you have multiple robots, each with their own trees: ‘/baxter1/___’ , ‘/baxter2/___’.
- Links: The links show the current transform of the robot’s links (i.e. where each link is actually positioned right now). (Optional) Test movement to see the virtual Baxter update
Adding a Simple Sensor
Add a Range Display for an IR sensor
- Add a new ‘Range’ display type, by clicking the ‘Add’ button and finding it under the ‘Builtin’ types.
- Find the ‘Topic’ field under your new Range display, and use the ‘...’ button to open a new window with available Range topics currently being published.
- Select the topic for the left IR sensor, which is under
/robot/range/left_hand_range
, and hit ‘OK’.
Baxter Sensors for Visualization
Cameras
- Topic Name:
/cameras/${side}_hand_camera/image
- Left Hand:
/cameras/left_hand_camera/image
- Right Hand:
/cameras/right_hand_camera/image
- Display Type: Image
Joint States
via Robot Model
- Topic Name:
/robot/joint_states
- Display Type: Robot Model
- Recommended Options:
- Robot Description:
robot_description
via TF
- Topic Name:
/tf
- Display Type: TF
- Recommended Options:
- Disable all links starting with prefix /reference/`
Sonar (Head)
- Topic Name:
/robot/head/sonar/sonar/state
- Display Type: PointCloud
- Recommended Options:
- Color Transformer: Intensity
- Channel Name: Distance
IR Range Sensors (Hands)
- Topic Name:
/robot/range/${side}_hand_range
- Display Type: Range
Troubleshooting
For more information about rviz, see the original documentation for the tool at the ROS wiki:
rviz uses Display Types to visualize different types of ROS messages. This list shows available ROS topics and corresponding Display Types for sensors on Baxter.
Questions when using standard ROS tools are largely asked/responded to on ROS Answers
Segmentation Fault
Segmentation faults often point to incorrect graphics library configuration, or misconfigured rviz setups.
Clean up rviz configuration This low-impact check will reset your rviz configuration:
$ rm ~/.rviz/*
Model is White/Grayed out
Make sure you are receiving all necessary ROS topics and parameters.
$ rostopic echo /robot/joint_states
If unable to echo /robot/joint_states
, please see the Troubleshooting#Network_configuration_issues network configuration troubleshooting guide
Flickering Flickering in rviz 3D and camera views
This can occur with some graphics drivers (depends on computer and monitor)
Solution: Unset the LIBGL_ALWAYS_INDIRECT
environment variable.
Right before starting rviz (or any gui program), check if the environment variable LIBGL_ALWAYS_INDIRECT
is set.
$ env | grep LIBGL_ALWAYS_INDIRECT
LIBGL_ALWAYS_INDIRECT=1
If so, unset the variable, then you can run rviz normally.
$ unset LIBGL_ALWAYS_INDIRECT
Graphics context not supported (i.e. trying to run rviz in VM)
- (Ogre can’t make GL context)
Global: Fixed Frame is broken on start (set to /map by default)
Global: Fixed Frame is empty, as is drop-down
- Try putting in an intentionally bad frame for Fixed Frame, then look under .Global Status at the error for it. It will hopefully tell you that Fixed Frame is broken and your frame is bad, and then you will hopefully be able to click on the drop-down and see all the available frames.
When you try to Add >> Display Types, the list is empty
Delete rviz configuration,
$ rm ~/.rviz/*
When restarting, verify origin frame is set to /world
RViz in VMWare
- after making sure that my VM was using hardware acceleration, had mesa-utils installed (wasn’t by default, then I could run glxinfo, and glxgears; important information is glxinfo | grep direct --> giving: “direct rendering: Yes”), then I had to change the RTT Preferred Mode from PBuffer to Copy, by instead running rviz like this:
$ OGRE_RTT_MODE=”Copy” rosrun rviz rviz &
- it would work intermittently (maybe not crash 1 out of 6 times)
- Problem: The problem started with an error (when trying to run rviz) of:
[ros - http://ptwo1:11311] rsdkuser@ubuntu:~/dev/ros_ws$ [ INFO] [1357935356.117148281]: rviz revision number 1.6.7 [ INFO] [1357935356.117316987]: ogre_tools revision number 1.6.3 [ INFO] [1357935356.117330449]: compiled against OGRE version 1.7.3 (Cthugha) [ INFO] [1357935356.449287289]: Loading general config from [/home/rsdkuser/.rviz/config] [ INFO] [1357935356.449722678]: Loading display config from [/home/rsdkuser/.rviz/display_config] [ INFO] [1357935356.511535673]: RTT Preferred Mode is PBuffer. [ERROR] [1357935356.513657284]: Caught exception while loading: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /tmp/buildd/ros-electric-visualization-common-1.6.3/debian/ros-electric-visualization-common/opt/ros/electric/stacks/visualization_common/ogre/build/ogre_src_v1-7-3/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
- Solution: mesa was not installed completely
- trying to run glxinfo failed, because it wasn’t installed; told me to install mesa-utils
- ran: $ sudo apt-get install mesa-utils
- now glxinfo works, can run $ glxinfo | grep version to see version info:
- can also run glxgears. (not sure if I may have been able to before too)
- Problem: Still getting same error on rviz start though
- Solution: Found out people get that error when LIBGL_ALWAYS_INDIRECT=”1” is set.
- Also found that that is a compviz error! It is set when you open a terminal using Ctrl+Alt+T!!!
- unset it, and the red exception error went away
- Problem: rviz still won’t start up but crashes intermittently with either an X Error of ‘BadDrawable (invalid Pixmap or Window parameter)’, or just Seg Faults.
- Solution: Found out this is a known intermittent problem by looking at the rviz troubleshooting page. By setting the OGRE_RTT_MODE environment variable from “PBuffer” to “Copy” or “FBO”, can get it to work intermittently.
- Resource page: http://www.ros.org/wiki/rviz/Troubleshooting
- so, to start rviz I run:
$ OGRE_RTT_MODE=”Copy” rosrun rviz rviz &
- .. and it will work intermittently, though the rendering is a little wonky.
Flickering 3D View
- make sure you have unset LIBGL_ALWAYS_INDIRECT
3D Hardware Acceleration
- . Installing/uninstalling graphics drivers
- . VM / capability
- . glxinfo
Bypassing Hardware Acceleration
- In the event you cannot get Hardware Acceleration to work, you can try setting rviz up to only use software rendering:
$ unset LIBGL_ALWAYS_INDIRECT
$ export LIBGL_ALWAYS_SOFTWARE=1
$ rosrun rviz rviz &
- If this still doesn't work, try additionally running with the alternative values for the
OGRE_RTT_MODE
variable (see #6), e.g:
$ OGRE_RTT_MODE=Copy rosrun rviz rviz &