Environment Representation/Rviz

The Motion Planning Rviz Plugin provides an easy way to interact directly with the planning scene. Using the plugin, you can create, save and load planning scenes and motion planning queries for later use. You can use the plugin to add objects into the world, scale them, remove them or move them. There are three types of sources that can be used to import objects or entire planning scenes:
 * mesh files
 * text files containing the entire planning scene
 * databases where planning scenes (and associated planning queries) can be stored

STEP 1: Launch the demo
Launch the demo from pr2_moveit_config. This should bring up the PR2 in an empty world with no objects around it.

STEP 2: Switch Rviz into interaction mode
Click on the "Interact" button in Rviz.

STEP 3: Add the Motion Planning Rviz Plugin
If you don't already have it, make sure to add the Motion Planning Rviz Plugin. See the Quick Start tutorial if you want to see how to do this.

Importing Mesh Files
You can import mesh files directly into the Rviz plugin and use them as part of the planning scene. To explore this functionality, first get some mesh resources that you can start working with. Run this command in a directory where you can store files locally:

Adding Mesh Objects to the Planning Scene
Now, in the Motion Planning Plugin, choose the Scene Objects Pane and click on "Import File".



Browse to the STL mesh file that you just downloaded and select it and click "Open". You should now see the box appear inside Rviz (it will be inside the robot) with interactive markers associated with it. You can use the interactive markers to move the box around.



Removing Meshes from the Planning Scene
To remove a mesh, select its name (but don't click on the checkbox) in the Plugin pane and click "Remove".



Copying meshes in the Planning Scene
You can use Ctrl-C to copy meshes/objects in the planning scene.

Importing Collada Files
You can follow the same procedure to import other types of mesh formats, e.g. importing Collada files directly.

Importing from Text Files
You can import entire scenes directly from a special text file format. Note that you should use this option only with text files saved using the Rivz plugin itself (and not try to write such files manually). To try out this capability, first get a scene file that you can work with (again, download this into an appropriate directory where you have write permissions).

Import a Planning Scene from a Text File
Now, in the Scene Objects Tab, click on the "Import From Text" button. Browse to the file you just downloaded and click on "Open". You should see the countertop scene appear in Rviz. Note that the PR2 robot will overlap with the scene right now.



You should also see the Current Scene Objects List in the Plugin pane fill up with a list of objects corresponding to the scene. These are individual objects that comprise the structure of the countertop.



Saving/Importing From a Database
The final means of storing planning scenes is in a database based on the ROS warehouse implementations. We will save the scene that we just imported into the database. First, launch the file that starts up the database server and makes it available for use. Note that you have to provide it a directory where the database will be stored. Here, we are using "~/moveit_db" as the default directory but you can choose any other (writable) location to store the database.

STEP 2: Connect to the database server
Now, in the Context tab of the Motion Planning Plugin, press the "Connect" button. You should see the database connection happen and the display change accordingly. It might take some time for the connection to happen (and you might need to press the "Connect" button multiple times).

&rarr;

STEP 3: Save the scene to the database
Now, switch over to the "Stored Scenes" tab in the Plugin. Press the "Save Scene" button to save this planning scene into the database. The next time you bring up Rviz (along with the database server using the same database), you will have access to this scene.

&rarr;

STEP 4: Loading saved scenes
You can load stored scenes from the "Stored Scenes" tab. Choose the scene from the list of saved scenes and then press the "Load Scene" button.



Links

 * Back to Planning Scene