Embedded Motion Control 2013/Simulator: Difference between revisions
Jlunenburg (talk | contribs) No edit summary |
Jlunenburg (talk | contribs) No edit summary |
||
Line 37: | Line 37: | ||
== Corridor == | === Corridor === | ||
An extra Gazebo world has been added, which contains a simple corridor with a side exit. | An extra Gazebo world has been added, which contains a simple corridor with a side exit. |
Revision as of 13:44, 2 September 2013
Installation
If you followed all steps specified on the installation page , you will already have downloaded the simulator Gazebo and our specific Jazz simulator. To be able to use the Jazz simulator, you first have to compile the downloaded ROS packages:
- Open a terminal (ctrl-alt-t)
- Navigate to the jazz_gazebo ROS package:
roscd jazz_gazebo
- And build and compile the jazz simulator and other necessary packages:
rosmake jazz_gazebo gazebo_map_spawner
Furthermore, Gazebo needs to know where to find the robot description (located in jazz_description) which includes its meshes, textures, kinematic chain, etc, and where to find the plugins for the controllers and sensors. This information can be set in the environment variables GAZEBO_PLUGIN_PATH and GAZEBO_MODEL_PATH:
- Open a terminal (ctrl-alt-t)
- Open .bashrc:
gedit ~/.bashrc
- Add the following lines:
export GAZEBO_PLUGIN_PATH=~/ros/general/jazz_gazebo/lib:~/ros/general/tue_gazebo_plugins/lib:$GAZEBO_PLUGIN_PATH
export GAZEBO_MODEL_PATH=~/ros/general/jazz_description:$GAZEBO_MODEL_PATH
Usage
- Start Gazebo:
gazebo
- Spawn the maze:
rosrun gazebo_map_spawner spawn_maze
- Spawn Jazz:
roslaunch jazz_gazebo jazz.launch
Notice that the Jazz robot is spawned in the Gazebo world. The Gazebo GUI shows how the world actually is. We can also visualize how the robot perceives it through its sensors, by using the ROS tool [ http://ros.org/wiki/rviz Rviz ]. You can start RViz with a pre-defined config showing most of Jazz' sensors using:
rosrun jazz_visualization rviz
... Some more explanation ...
Examples
Here are some examples on how to use the simulator and how to practice the corridor competition in simulation.
Jazz Driving Example
- Have a look at the file jazz_node.cpp in the src folder of the jazz_example package. You should be able to understand what the program will do.
- Build the package:
rosmake jazz_example
- Run the node (make sure the simulator is still running):
rosrun jazz_example jazz_node
Check the result in both Gazebo and RViz. - Load the package in Eclipse, or create your own package, and... have fun!
Corridor
An extra Gazebo world has been added, which contains a simple corridor with a side exit.
- First, make sure you SVN-update the jazz_simulator package, i.e.:
roscd jazz_simulator
svn up
- Then, you can start the simulator with the new world by typing:
roslaunch jazz_simulator start_corridor.launch
Changing the initial robot pose
As you can see, Jazz does not start exactly in the center of the corridor, and its rotation is also slightly off. This is done to make sure that you don't rely on a perfect initial position, i.e., you have to be robust against such deviations. It might be nice to play around with different initial poses. To do so, have a look at the launch file start_corridor.launch in the launch subfolder. You should see a line like this:
<node name="spawn_jazz" pkg="gazebo" type="spawn_model" args="-unpause -urdf -param robot_description -model jazz -x 5.3 -y 0 -Y 1.87" respawn="false" output="screen" />
This line starts the spawn_model node from the gazebo ROS package, with some arguments as defined in args. In this argument list you see -x, -y and -Y, which define the initial X-position, Y-position and rotation (in radians) respectively. Play around with these values to see if your algorithm is robust against different initial poses.
Changing the corridor
It may also be nice to change the corridor, e.g., changing the position of the exit. To do so, simply edit the file tue_corridor.png in the ./Media/materials/textures folder of the jazz_simulator package. As you can see, this is a simple image in which white pixels represent free space, and black pixels represent walls. Of course, you need to restart the simulator to see the effects of your change.
Troubleshoot
Gazebo does not stop gracefully upon exit or interrupt (ctrl-c)
You may get the warning:
Warning [gazebo_main.cc:59] escalating to SIGKILL on server
when stopping Gazebo. This is a known bug and has no consequences, other than that it takes a bit longer to kill Gazebo.