Gazebo: Road Tutorial

From The Player Project

Jump to: navigation, search

This tutorial has been provided courtesy of Stephen Williams, and details how to use the Road Model in Gazebo.

I have spent quite some time going through the Road model, and thought I would post the results for everyone else.

The road file contains two types of lines, waypoint and track. The format is as follows: waypoint [display distance] [waypoint id] [X Position] [Y Position] [Z Position]

track [display distance] [waypoint id] [X Position] [Y Position] [Z Position] [No of Profile Points] [Profile Height 1] [Profile Height 2] ...

The "waypoints" create a road sign inside the simulation, which displays the [waypoint id] and the [display distance]. The "tracks" add a new point in the road path; a spline is used to connect sequential track points. In the track data line, the [display distance] and [waypoint id] have no effect.

Additionally, inside the world file, the parameter <roadSpacing> is somewhat misleading. The first value is the number of intermediate spline points that will be added between sequential track points. Note that the total number of points (~= track Points * roadSpacing) must equal or exceed 10,000 for the the native Gazebo road to work properly. The second value is the lateral distance in meters between sequential profile points.

Once I adjusted the <roadSpacing> value correctly, the road would render. However, for short roads, the hard-coded 10,000 spline points was causing serious CPU issues. Also, when large changes in the Z Position were present, the road seemed to narrow considerably and occasionally invert.

To fix the above issues, as well as some data redundancy in the road file, I have created a gazebo plugin called (imaginatively) "Road2". The code is attached, or available at [1]

Instructions on how to compile a plugin are available on the main Gazebo site. Additionally, I had to copy the Image.hh file from the Gazebo source to /usr/local/include/gazebo and include the path path /usr/include/libxml2 in the compile statement. Notes on how to use the plugin are written the comments of

Hopefully some of this will help someone, Stephen Williams

Personal tools