Jazz Simulator: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
No edit summary
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Getting Started =
== Getting Started ==


''' This tutorial assumes that you have successfully completed the ROS tutorials.'''
''' This tutorial assumes that you have successfully completed the ROS tutorials.'''
Line 6: Line 6:
To get the Jazz simulator up and running, do the following:
To get the Jazz simulator up and running, do the following:


# Download the '''jazz_simulator''' and '''jazz_example''' packages [http://cstwiki.wtb.tue.nl/images/Jazz_packages.zip here].
# Check-out the Jazz packages from the SVN, as described [[Embedded_Motion_Control_2012#SVN | here]].
# Extract the packages in your ''~/ros'' folder.
# If you set-up your environment correctly, you should be able to ''roscd'' to the '''jazz_simulator''' and '''jazz_example''' packages, ''e.g.'':<pre>roscd jazz_simulator</pre>
# If you set-up your environment correctly, you should be able to ''roscd'' to the '''jazz_simulator''' and '''jazz_example''' packages, ''e.g.'':<pre>roscd jazz_simulator</pre>


== Jazz Simulator ==
=== Jazz Simulator ===


# Build the '''jazz_simulator''' package:<pre>rosmake jazz_simulator</pre>
# Build the '''jazz_simulator''' package:<pre>rosmake jazz_simulator</pre>
Line 16: Line 15:
# Play around with the Gazebo interface, and make yourself familiar with RViz. To visualize the sensor data from the laser range finder, in RViz press ''Add'', Choose ''Laser Scan'', and in the left panel select the topic ''scan''.
# Play around with the Gazebo interface, and make yourself familiar with RViz. To visualize the sensor data from the laser range finder, in RViz press ''Add'', Choose ''Laser Scan'', and in the left panel select the topic ''scan''.


== Jazz Driving Example ==
=== 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.
# 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.
Line 22: Line 21:
# Run the node (make sure the simulator is still running):<pre>rosrun jazz_example jazz_node</pre>Check the result in both Gazebo and RViz.
# Run the node (make sure the simulator is still running):<pre>rosrun jazz_example jazz_node</pre>Check the result in both Gazebo and RViz.
# Load the package in Eclipse, or create your own package, and... have fun!
# 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.:<pre>roscd jazz_simulator</pre><pre>svn up</pre>
# Then, you can start the simulator with the new world by typing:<pre>roslaunch jazz_simulator start_corridor.launch</pre>
=== 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:
<pre><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" /></pre>
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.

Latest revision as of 17:03, 29 May 2012

Getting Started

This tutorial assumes that you have successfully completed the ROS tutorials.


To get the Jazz simulator up and running, do the following:

  1. Check-out the Jazz packages from the SVN, as described here.
  2. If you set-up your environment correctly, you should be able to roscd to the jazz_simulator and jazz_example packages, e.g.:
    roscd jazz_simulator

Jazz Simulator

  1. Build the jazz_simulator package:
    rosmake jazz_simulator
  2. To start the simulator, start the launch file contained in the package:
    roslaunch jazz_simulator start.launch
    This starts up the Gazebo simulator, loads the robot model and controllers, spawns the robot, and starts the visualization tool RViz. Be sure to have a look at the launch file.
  3. Play around with the Gazebo interface, and make yourself familiar with RViz. To visualize the sensor data from the laser range finder, in RViz press Add, Choose Laser Scan, and in the left panel select the topic scan.

Jazz Driving Example

  1. 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.
  2. Build the package:
    rosmake jazz_example
  3. Run the node (make sure the simulator is still running):
    rosrun jazz_example jazz_node
    Check the result in both Gazebo and RViz.
  4. 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.

  1. First, make sure you SVN-update the jazz_simulator package, i.e.:
    roscd jazz_simulator
    svn up
  2. 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.