This is a simulation of a Prius in gazebo 11 with sensor data being published using ROS 2 humble The car's throttle, brake, steering, and gear shifting are controlled by publishing a ROS message. A ROS node allows driving with a gamepad/joystick (not yet tested) or keyboard (also directly in gazebo when mcity.world is loaded).
A video and screenshots of the demo can be seen in this blog post: https://www.osrfoundation.org/simulated-car-demo/
This demo has been tested on Ubuntu Xenial (20.04) with ROS2 humble and inside docker.
-
Using ROS2 humble installation:
-
Using Docker:
- An X server
- Docker
- nvidia-docker2 [optional]
- The current user is a member of the docker group or other group with docker execution rights.
- rocker [optional]
First clone the repo, then run the script build_demo.bash
.
- From source using ROS2 Humble installation:
$ cd ~/ros2_ws/
$ vcs import --input https://raw.githubusercontent.com/NovoG93/car_demo/humble/rosinstall.yaml src
$ colcon build --packages-up-to car_demo --symlink-install
- Using Docker:
$ cd car_demo
$ ./build_demo.bash
- Using ROS2 humble installation
$ source ~/ros2_ws/install/setup.bash
$ ros2 launch car_demo demo.launch.py
- Using Docker
Use the script
run_demo.bash
to run the demo.
$ ./run_docker.bash
- Using Rocker
$ ./run_rocker.bash
In all cases an RVIZ window will open showing the car and sensor output.
A gazebo window will appear showing the simulation.
Either use the controller to drive the prius around the world, or click on the gazebo window and use the WASD
keys to drive the car or use the teleop window that opens in xterm.