This repository provides a Gazebo model of a Polaris GEM, as well as worlds and models to simulate the tasks of the competition.
After cloning into a ROS workspace, run the following the command from the root of the workspace to install the necessary ROS package dependencies to make everything work correctly:
rosdep install --from-paths src --ignore-src -r
roslaunch gazebo_ros empty_world.launch
To load a custom Gazebo world file, pass its file path to the world_name argument:
roslaunch gazebo_ros empty_world.launch world_name:=<complete path to world file here\>
Spawn the GEM model in Gazebo with spawn_gem.launch in the igvc_self_drive_gazebo package:
roslaunch igvc_self_drive_gazebo spawn_gem.launch
The spawn_gem.launch file has arguments that allow the user to control some aspects of the spawned GEM:
-
start_x,start_y,start_z: Thex,y,zposition of the vehicle in Gazebo -
start_yaw: The direction the vehicle faces relative to the Gazebo world frame -
twist_mode: If true, the GEM subscribes to ageometry_msgs/Twisttopic to move around the world. If false, it subscribes to individual actuator command topics. See the discussion of these modes below. -
pub_tf: If true, a ground truth TF transform fromworldframe tobase_footprintframe is published
The self_drive_tasks.world file in the igvc_self_drive_gazebo package simulates the specific tasks as described in the official rules document, which can be found [here].
To load the world and spawn the vehicle at the starting point for a particular task, run the corresponding launch file in the igvc_self_drive_gazebo package. For example, to run task F3, the right turn test where the vehicle has to stop at the intersection:
roslaunch igvc_self_drive_gazebo f3_gazebo.launch
At the moment, the F9 task is not implemented in the self_drive_tasks.world Gazebo world, even though the launch file for it exists.
The following topics are published by Gazebo:
-
/fix: GPS position given in latitude and longitude in the form of asensor_msgs/NavSatFixmessage -
/camera_front/image_raw/*: Standard group of image topics fromimage_proc -
/scan: LIDAR scan data in the form of asensor_msgs/LaserScanmessage -
/twist: The current measurement of the vehicle's speed and yaw rate in ageometry_msgs/TwistStampedmessage. Thelinear.xfield contains the speed in m/s andangular.zcontains the yaw rate in rad/s -
/gear_state: The current gear of the vehicle in astd_msgs/UInt8message:- 0 = Forward
- 1 = Reverse
-
/sonar/*: Group of 10 sonar sensor range measurement topics in separatesensor_msgs/Rangemessages. There are three sensors on the front of the vehicle, three on the rear, and two on either side.
The Gazebo GEM model can be controlled in two different modes:
-
Twist Mode: Send a
geometry_msgs/Twistmessage on the/cmd_veltopic with desired speed and yaw rate, and let the simulation generate the appropriate actuator commands. -
Actuator Mode: Send throttle, brake, steering, and gear actuator commands directly to the simulator.
The control mode is specified by setting the twist_mode argument to the spawn_gem.launch file to true or false. This argument defaults to true, so if you don't have to change anything to use Twist Mode.
The linear.x field of the user's geometry_msgs/Twist message should contain the desired speed in m/s, and the angular.z field should contain the desired yaw rate in rad/s.
By setting the twist_mode argument to false, the Gazebo plugin instead subscribes to four separate actuator command topics so the user can control them directly:
-
/throttle_cmd:std_msgs/Float64topic containing commanded throttle percentage (0 to 1) -
/brake_cmd:std_msgs/Float64topic containing commanded brake torque in Newton-meters (0 to 1000) -
/steering_cmd:std_msgs/Float64topic containing commanded steering wheel angle in radians (-9.5 to +9.5) -
/gear_cmd:std_msgs/UInt8topic containing commanded gear, as controlled by the switch on the dashboard of the real vehicle:- 0 = Forward
- 1 = Reverse
-
Gear ratio between steering wheel and equivalent bicycle steer angle = 17 : 1
-
Wheelbase = 2.4 meters
-
Track width = 1.2 meters
-
Wheel radius = 0.36 meters