Difference between revisions of "Rviz"

From sdk-wiki
Jump to: navigation, search
(Troubleshooting)
(Installation)
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[File:rviz_2014.png]]
 
[[File:rviz_2014.png]]
<div class="toclimit-3" style="float:left; margin-right:10px; clear:left;">__TOC__</div>
+
<div class="toclimit-2" style="float:left; margin-right:10px; clear:left;">__TOC__</div>
  
 
<div style="clear:both">
 
<div style="clear:both">
Line 13: Line 13:
 
= Installation =
 
= Installation =
 
<tabs>
 
<tabs>
<tab title="ROS Groovy">
+
<tab title="ROS Indigo">
 
<source lang="bash">
 
<source lang="bash">
 
$ sudo apt-get update
 
$ sudo apt-get update
$ sudo apt-get install ros-groovy-visualization
+
$ sudo apt-get install ros-indigo-rviz
 
</source>
 
</source>
 
</tab>
 
</tab>
Line 22: Line 22:
 
<source lang="bash">
 
<source lang="bash">
 
$ sudo apt-get update
 
$ sudo apt-get update
$ sudo apt-get install ros-hydro-visualization
+
$ sudo apt-get install ros-hydro-rviz
 
</source>
 
</source>
<tab>
+
</tab>
 +
<tab title="ROS Groovy">
 +
<source lang="bash">
 +
$ sudo apt-get update
 +
$ sudo apt-get install ros-groovy-rviz
 +
</source>
 +
</tab>
 
</tabs>
 
</tabs>
  
Line 44: Line 50:
  
 
== Robot Visualization ==
 
== Robot Visualization ==
 +
 +
[[File:Rviz.png]]
 +
 
==== Add a Robot Model Display ====
 
==== Add a Robot Model Display ====
  
Line 49: Line 58:
  
 
'''Note:''' By default, all the parameters should be set correctly but just in case check the following:
 
'''Note:''' By default, all the parameters should be set correctly but just in case check the following:
* Robot Description:  <code>robot_description</code>. <code>robot_description</code> 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)</div>
+
* Robot Description:  <code>robot_description</code>. <code>robot_description</code> 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/___’.
 
* 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/___’.
Line 96: Line 105:
  
  
== Troubleshooting ==
+
= Troubleshooting =
 
For more information about rviz, see the original documentation for the tool at the [http://ros.org/wiki/rviz ROS wiki]:
 
For more information about rviz, see the original documentation for the tool at the [http://ros.org/wiki/rviz ROS wiki]:
  
Line 113: Line 122:
 
</source>
 
</source>
  
=== Model is White/Grayed out===
+
==== Model is White/Grayed out ====
  
 
Make sure you are receiving all necessary ROS topics and parameters.
 
Make sure you are receiving all necessary ROS topics and parameters.
Line 120: Line 129:
 
</source>
 
</source>
  
== Known Issues ==
+
If unable to echo <code>/robot/joint_states</code>, please see the [[Troubleshooting#Network_configuration_issues network configuration troubleshooting guide]]
=== 1. Flickering in rviz 3D and camera views can occur with some graphics drivers (depends on computer and monitor). ===
+
 
 +
==== Flickering Flickering in rviz 3D and camera views ====
 +
This can occur with some graphics drivers (depends on computer and monitor)
 +
 
 
'''Solution:''' Unset the <code>LIBGL_ALWAYS_INDIRECT</code> environment variable.   
 
'''Solution:''' Unset the <code>LIBGL_ALWAYS_INDIRECT</code> environment variable.   
 
Right before starting rviz (or any gui program), check if the environment variable <code>LIBGL_ALWAYS_INDIRECT</code> is set.   
 
Right before starting rviz (or any gui program), check if the environment variable <code>LIBGL_ALWAYS_INDIRECT</code> is set.   
 
<source lang="bash">
 
<source lang="bash">
        $ env | grep LIBGL_ALWAYS_INDIRECT
+
$ env | grep LIBGL_ALWAYS_INDIRECT
        LIBGL_ALWAYS_INDIRECT=1
+
LIBGL_ALWAYS_INDIRECT=1
 
</source>
 
</source>
 
If so, unset the variable, then you can run rviz normally.
 
If so, unset the variable, then you can run rviz normally.
 
<source lang="bash">
 
<source lang="bash">
        $ unset LIBGL_ALWAYS_INDIRECT
+
$ unset LIBGL_ALWAYS_INDIRECT
 
</source>
 
</source>
  
== Possible Issues ==
+
==== Graphics context not supported (i.e. trying to run rviz in VM) ====
=== 1. Network Connectivity ===
+
 
+
=== 2. Graphics context not supported (i.e. trying to run rviz in VM) ===
+
 
* (Ogre can’t make GL context)  
 
* (Ogre can’t make GL context)  
  
=== 3. Global: Fixed Frame is broken on start  (set to /map by default) ===
+
==== Global: Fixed Frame is broken on start  (set to /map by default) ====
  
=== 4. Global: Fixed Frame is empty, as is drop-down ===
+
==== 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.  
 
* 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.  
  
=== 5. When you try to Add >> Display Types, the list is empty ===
+
==== When you try to Add >> Display Types, the list is empty ====
* seen this multiple times, I think on desktop machine and laptop
+
Delete rviz configuration,
* think I’ve seen this even when the Fixed Frame has worked
+
 
* might be something to do with ROS_IP/HOSTNAME stuff ... doesn’t look like it
+
<source lang="bash">
 +
$ rm ~/.rviz/*
 +
</source>
 +
 
 +
When restarting, verify origin frame is set to <code>/world</code>
  
NOTE: It is intermittent, restarting rviz made it work (this is after setting a proper frame in a previous rviz run, and then on this time it worked, the frame was blank at first, then appeared).
+
==== RViz in VMWare ====
  
=== 6. RViz in VMWare (Add TROUBLESHOOTING) ===
 
 
* 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:  <code>$ OGRE_RTT_MODE=”Copy” rosrun rviz rviz &</code>
 
* 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:  <code>$ OGRE_RTT_MODE=”Copy” rosrun rviz rviz &</code>
 
* it would work intermittently (maybe not crash 1 out of 6 times)
 
* it would work intermittently (maybe not crash 1 out of 6 times)
Line 178: Line 190:
 
** .. and it will work intermittently, though the rendering is a little wonky.
 
** .. and it will work intermittently, though the rendering is a little wonky.
  
=== 7. Flickering 3D View ===
+
==== Flickering 3D View ====
 
* make sure you have unset LIBGL_ALWAYS_INDIRECT
 
* make sure you have unset LIBGL_ALWAYS_INDIRECT
  
=== 8. 3D Hardware Acceleration ===
+
==== 3D Hardware Acceleration ====
 
*. Installing/uninstalling graphics drivers
 
*. Installing/uninstalling graphics drivers
 
*. VM / capability
 
*. VM / capability
 
*. glxinfo
 
*. glxinfo
  
=== 9. Bypassing Hardware Acceleration ===
+
==== Bypassing Hardware Acceleration ====
 
* In the event you cannot get Hardware Acceleration to work, you can try setting rviz up to only use software rendering:
 
* In the event you cannot get Hardware Acceleration to work, you can try setting rviz up to only use software rendering:
 
<source lang="bash">
 
<source lang="bash">

Latest revision as of 21:48, 7 January 2015

Rviz 2014.png

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

    Rviz.png

    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.

    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 &