This is the project repo for the final project of the Udacity Self-Driving Car Nanodegree: Programming a Real Self-Driving Car.
This repository is maintained by the following:
Please see wiki for complete description.
We use ROS Kinetic on Ubuntu 16.04
- Be sure that your workstation is running Ubuntu 16.04 Xenial Xerus. Ubuntu downloads can be found here.
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.
- Follow these instructions to install ROS
- Install Dataspeed DBW SDK. On a workstation that already has ROS installed use this option: One Line SDK Install (binary)
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
Download the Udacity Simulator
- Clone the project repository
git clone https://github.com/Kairos-Automotive/carla-brain.git
- Install python dependencies
cd carla-brain
pip install -r requirements.txt
- 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
- Run the simulator
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.
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
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
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.
To run the unit tests call
source devel/setup.sh
catkin_make run_tests
-
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)
-
Unzip the file
unzip traffic_light_bag_files.zip
- 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
- Launch your project in site mode
cd carla-brain/ros
roslaunch launch/site.launch
- Confirm that traffic light detection works on real life images.