Rviz guide

From Robin

Jump to: navigation, search

Rviz is a great visualization tool for visualizing information published on ROS topics. This includes being able to visualize what the robot is sensing through its sensors, maps of the environment, and so on, along the robot model itself.

Contents

Setup

To make it easier working with Tiago and ROS, you can use a Singularity container where the most basic packages you need are already installed. See how you can use the Singularity container on the robin wiki page here.

You might need to set some environment variables to be able to run simulations on your computer successfully. After you enter the Singulairty shell and you are ready to start simulating, check the environment variables ROS_MASTER_URI and ROS_IP. The ROS master should be set to run locally on your computer and the ROS ip should be set to your computer, like this:

 $ export ROS_MASTER_URI=http://localhost:11311
 $ export ROS_IP=vixen-nb.uio.no

If you are not using the vixen computer, change the IP to the computer you are using. In addition, you might need to set these environment variables every time you enter a new Singularity shell.


Visualizing different types of information in Rviz

Using Rviz, you can visualize the information from various sensors. Below are some examples of data you can visualize and how to do so.

First, in one terminal, open up Gazebo in an office enviroment like so:

 $ singularity shell --nv /projects/robin/programs/sing-con/ros-melodic-pal/ros-melodic-pal.sif
 $ source /opt/ros/melodic/setup.bash
 $ source /tiago_public_ws/devel/setup.bash
 $ roslaunch tiago_gazebo tiago_gazebo.launch world:=small_office public_sim:=true end_effector:=pal-gripper

In another terminal, launch an empty Rviz window:

 $ rosrun rviz rviz

Now, lets add Tiago. Click on Add, find RobotModel (under the By display type tab) and click on OK. Change the fixed frame to "odom". Now you should see Tiago, like in the picture below.

Now we can add different windows to visualize information. Click on Add and then on the By topic tab. Here you can see the topics we can visualize, as seen in the figure below.



Try to add different windows, such as from the topics:

  • RGB-D camera (raw image): /xtion/rgb/image_raw - click on "Camera".
  • RGB-D camera (point cloud): /xtion/depth_registered/points - click on "PointCloud2".
  • LIDAR: /scan_raw - click on "LaserScan".
  • Sonars: /sonar_base - click on "Range".
  • Wrist force sensor: /wrist_ft - click on "WrenchStamped".



Running a premade navigation simulation in Rviz

To run a premade navigation example in Rviz, you should first enter a Singularity shell, source ROS and the workspace, and then launch the program. First enter the Singularity shell using the following command:

 $ singularity shell --nv /projects/robin/programs/sing-con/ros-melodic-pal/ros-melodic-pal.sif

Next, source ROS and the workspace like this:

 $ source /opt/ros/melodic/setup.bash
 $ source /tiago_public_ws/devel/setup.bash

Then launch the simulation with this command:

 $ roslaunch tiago_2dnav_gazebo tiago_mapping.launch public_sim:=true robot:=steel

This will open up both Gazebo and Rviz. The Gazebo window shows the simulation of the world, consisting of the loaded environment of an office and Tiago. The Rviz window shows how the robot perceives its environment through its sensors, alongside a map of the environment. You can move the robot around by clicking on “2D Nav Goal” button in the menu and choose where the robot should move and what its end orientations should be. When you do so, you can observe how the map expands as Tiago explores more of it.

You can also use the arrows on your keyboard to move Tiago around in the environment, as shown in the Tiago handbook. To do this, open another terminal, enter the Singularity shell, and source ROS and the workspace. Then, run the following command and use the arrows to move Tiago.

 $ rosrun key_teleop key_teleop.py

Using Rviz with the physical Tiago

Rviz is used in the same way with the physical Tiago as in simulation, where the only difference lies in the way you launch Rviz. To do this, make sure you set the ROS_MASTER_URI variable to be the robot and follow the steps below:

 $ singularity shell --nv /projects/robin/programs/sing-con/ros-melodic-pal/ros-melodic-pal.sif
 $ source /opt/ros/melodic/setup.bash
 $ source /tiago_public_ws/devel/setup.bash
 $ ROS_MASTER_URI=http://tiago-135c:11311
 $ rosrun rviz rviz -d `rospack find tiago_bringup`/config/tiago.rviz

Then you can visualize information from Tiago's sensors as before. You can get more information about this in the Tiago handbook pages 111-114.

Personal tools
Front page