Skip to content

ROS & Gazebo project for 1/10th scale self-driving race cars

Notifications You must be signed in to change notification settings

kzamzam/ar-tu-do

 
 

Repository files navigation

Autonomous Racing Software Stack and Simulation Enviroment

Build Status

This repository contains software for 1/10th scale autonomous race cars to compete in the F1/10 competition. It is developed by the Autonomous Racing Project Group of TU Dortmund.

Features

We provide several LIDAR based driving algorithms:

  • Fast and efficient wallfollowing based on fitting circles into the LIDAR scan
  • ROS navigation stack based implementation that uses SLAM, a precalculated map and path planning
  • Deep Reinforcement Learning (Q-Learning and Policy Gradient)
  • Neural Networks with evolutionary training

Our software works on physical hardware and in a simulated environment using Gazebo. Further features are:

  • Automatic emergency braking
  • Dead Man's Switch
  • Teleoperation via keyboard, Xbox and Playstation controller
  • Speedometer and Lap Timer

Installation

You need to install the Robot Operating System (ROS) to use our software. We target ROS Kinetic on Ubuntu 16.04, but ROS Melodic seems to work as well.

Note for VM users: Gazebo 7.0.0, which is installed with ROS Kinetic by default, does not work on a virtual machine. To solve this, Gazebo has to be updated to at least 7.4.0. This can be done running the following commands:

sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt update
sudo apt upgrade

# To check the gazebo version you can use this command:
dpkg-query -W | grep gazebo

# Some plugins you may need to install:
sudo apt-get install ros-kinetic-ros-control
sudo apt-get install ros-kinetic-ros-controllers
sudo apt-get install ros-kinetic-gazebo-ros-control
sudo apt-get install ros-kinetic-ackermann-msgs
sudo apt-get install ros-kinetic-joy
sudo apt-get install ros-kinetic-gazebo-ros-pkgs
sudo apt-get install ros-kinetic-teb-local-planner

Install dependencies:

sudo pip uninstall pip && sudo apt install python-pip
sudo apt install libsdl2-dev clang-format python-pyqtgraph
pip install torch autopep8 cython circle-fit
pip install future

# RangeLibc
git clone http://github.com/kctess5/range_libc
cd range_libc/pywrapper
# Either:
./compile.sh            # on VM
# Or:
./compile_with_cuda.sh  # on car - compiles GPU ray casting methods

Clone the repository:

git clone --recurse-submodules https://github.com/Autonomous-Racing-PG/ar-tu-do.git

Install missing ROS dependencies:

cd ar-tu-do/ros_ws
rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO}

Usage

Compile while inside the ros_wsdirectory:

catkin_make

In the case that you get an error concerning changing namespace to leagcy mode for gazebo: Go to ar-tu-do/ros-ws/src/simulation/racer_description/urdf/racer_plugins.gazebo and add the following line inside of the gazebo plugins:

<legacyModeNS>true</legacyModeNS>	

Set up enviroment variables for your shell:

source devel/setup.bash # (or setup.zsh, depending on your shell)

Use a launch file to start ROS and Gazebo:

roslaunch launch/car.launch                   # (Physical car, Wallfollowing)
roslaunch launch/car_navigation_stack.launch  # (Physical car, SLAM & ROS navigation)
roslaunch launch/gazebo.launch                # (Simulation, Wallfollowing)
roslaunch launch/navigation_stack.launch      # (Simulation, SLAM & ROS navigation)
roslaunch launch/q_learning.launch            # (Simulation, Train the Q-Learning model)
roslaunch launch/policy_gradient.launch       # (Simulation, Train the Policy Gradient model)
roslaunch launch/evolutionary.launch          # (Simulation, Train the evolutionary neural network)

Launch file arguments

These arguments can be passed to the launch files above. For example, to use the gazebo.launch file without emergency stop and with car highlighting, run:

roslaunch launch/gazebo.launch emergency_stop:=false car_highlighting:=true

The arguments can be changed permanently by editing the launch files.

Argument Description Supported by launch/<file>.launch
car car_navstack gazebo navigation_stack q_learning, policy_gradient, evolutionary
debug Boolean value whether Gazebo should run in debug mode. Defaults to false.
emergency_stop Boolean value whether the emergency stop should be active. Defaults to true.
gui Boolean value whether Gazebo should show a user interface. Defaults to true.
joystick_type The type of joystick controller. Possible values: ps3, xbox360 and xboxone
map Name of the map to be used by the particle filter. Defaults to a prerecorded map of racetrack_decorated_2.
(no default)
paused Boolean value whether Gazebo should start paused. Defaults to false.
pf_angle_step Angle step of the particle filter. Defaults to 18.
pf_max_particles Maximum amount of particles to be used by the particle filter. Defaults to 500.
pf_squash_factor Squash factor of the particle filter. Defaults to 2.2.
plot_window Integer value indicating the amount of episodes that should be plotted. Defaults to 200. ✓ / ✓ / ✗
realtime_simulation Boolean value whether Gazebo should try to simulate with a real time factor of 1. If false, Gazebo tries to simulate as fast as possible. Defaults to true.
use_gpu Boolean value whether Gazebo should use the GPU when simulating the lidar. Defaults to true.
use_sim_time Boolean value whether all ros nodes should use simulated Gazebo time instead of wall clock time. Defaults to true.
verbose Boolean value whether Gazebo should give verbose standard output. Defaults to true.
visualize_lidar Boolean value whether Gazebo should show the simulated lidar rays. Defaults to false.
world The name of the racetrack. Possible values: racetrack_decorated (default) , racetrack_decorated_2, test_track and racetrack_decorated_2_big

Hardware

Our car is based on a 1/10th scale RC car (Traxxas Ford Fiesta) with these additions:

Documentation

  • For general information and documentation check out our wiki page.
  • For source code documentation check out the auto-generated Doxygen documentation.

License

This project (excluding git submodules) is under MIT and GPLv3 dual licensed - see the MIT.LICENSE and GPLv3.LICENSE file for details.

About

ROS & Gazebo project for 1/10th scale self-driving race cars

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 60.0%
  • Python 29.2%
  • CMake 6.1%
  • Shell 2.2%
  • Lua 1.3%
  • C 0.7%
  • Makefile 0.5%