/carla-brain

Autonomous Car System Integration Project on Udacity SDC ND

Primary LanguagePython

Self Driving Car Engineer Nanodegree -- Capstone project

Codacy Badge Build Status Docker Status

This is the project repo for the final project of the Udacity Self-Driving Car Nanodegree: Programming a Real Self-Driving Car.

Team Members

This repository is maintained by the following:

Workflow

Please see wiki for complete description.

Installation

We use ROS Kinetic on Ubuntu 16.04

Native Install

The Udacity provided virtual machine has ROS and Dataspeed DBW already installed, so you can skip the next two steps if you are using this.

Docker Install

Install Docker

Build the docker container

docker build . -t kairosautomotive/carla-brain:latest

or pull the latest docker container from dockerhub

docker pull kairosautomotive/carla-brain:latest

The prefered way for using containers is to use the prebuild.

Run the docker file

docker run -p 4567:4567 -v $PWD:/capstone -v /tmp/log:/root/.ros/ --rm -it kairosautomotive/carla-brain

Simulator

Download the Udacity Simulator

Build and Run in Simulator

  1. Clone the project repository
git clone https://github.com/Kairos-Automotive/carla-brain.git
  1. Install python dependencies
cd carla-brain
pip install -r requirements.txt
  1. Make and run styx
cd ros
catkin_make
source devel/setup.sh
roslaunch launch/styx.launch

If the connection of the simulator is not working as expected it is possible to lauch with the workaround described in the discussion.

roslaunch launch/styx.launch monkey_patch:=true
  1. Run the simulator

Video result on simulator run

Visualize the drive

Mac with X11 and docker

Setup

Install and start X11 (XQuartz).

brew cask install xquartz
open -a Xquartz

Set the preferences as described in docker for mac and gui. Restart Xquartz.

Setup the environment and start docker

ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost + $ip
docker run -p 127.0.0.1:4567:4567 -v $PWD:/capstone -v /tmp/log:/root/.ros/ -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$ip:0 --rm -it kairosautomotive/carla-brain:latest
source devel/setup.sh
roslaunch launch/styx.launch &
rosrun waypoint_updater show_waypoints.py

Linux with X11 and docker

To use the visualizer use below commands to configure the environment:

xhost +SI:localuser:root
docker run -p 127.0.0.1:4567:4567 -v $PWD:/capstone -v /tmp/log:/root/.ros/ -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --rm -it kairosautomotive/carla-brain:latest
source devel/setup.sh
roslaunch launch/styx.launch &
rosrun waypoint_updater show_waypoints.py

Rviz

To run rviz within the docker environment, configure it as described above. Afterwards run within the container:

source devel/setup.sh
rosrun rviz rviz &

Further documentation about rviz can be found in the user guide.

Unit tests

To run the unit tests call

source devel/setup.sh
catkin_make run_tests

Test with ROS bags from real car

  1. Download training bag that was recorded on the Udacity self-driving car (a bag demonstraing the correct predictions in autonomous mode can be found here)

  2. Unzip the file

unzip traffic_light_bag_files.zip
  1. Play the bag file
rosbag play -l traffic_light_bag_files/loop_with_traffic_light.bag

To disable specific topics from the bag they can either be filtered or the topics can be renamed during playback:

rosbag play -l udacity_succesful_light_detection.bag /traffic_waypoint:=/traffic_waypoint_null /final_waypoints:=/final_waypoints_null /base_waypoints:=/base_waypoints_null /vehicle/steering_cmd:=/vehicle/steering_cmd_null 
  1. Launch your project in site mode
cd carla-brain/ros
roslaunch launch/site.launch
  1. Confirm that traffic light detection works on real life images.

Video result on Udacity ROS bag