Click here for the full youtube video
This project uses an Extended Kalman Filter to track a car in 2D. The filter fuses both radar and sensor data in order to track the (x,y) position and (Vx,Vy) velocity. The red dots are lidar and the blue dots with the directional arrows in them are radar. The green triangles are the predicted positions.
To get this project up and running please follow these steps:
- Clone this repo
- Install the simulator which you can find here
- Make sure that you have the Dependencies listed below.
- Once everything is installed make a build directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it: ./ExtendedKF`
- Open the simulator and select the first option "Project 1/2: EKF and UKF"
- Select which dataset to use then click start.
Note: Start from option 6 if you want run the simulation again.
INPUT: values provided by the simulator to the c++ program
["sensor_measurement"] => the measurement that the simulator observed (either lidar or radar)
OUTPUT: values provided by the c++ program to the simulator
["estimate_x"] <= kalman filter estimated position x
["estimate_y"] <= kalman filter estimated position y
["rmse_x"]
["rmse_y"]
["rmse_vx"]
["rmse_vy"]
The minimum project dependency versions are:
- cmake: 3.5
- All OSes: click here for installation instructions
- make: 4.1 (Linux and Mac), 3.81 (Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install [Xcode command line tools to get make] (https://developer.apple.com/xcode/features/)
- Windows: Click here for installation instructions
- gcc/g++: 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- uWebSocketIO (jump to the operating system below uWebSockets)
This repository includes two files that can be used to set up and install uWebSocketIO for either Linux or Mac systems. For windows you can use either Docker, VMware, or even Windows 10 Bash on Ubuntu to install uWebSocketIO.
Note: Only uWebSocketIO branch e94b6e1, which the scripts reference, is compatible with the package installation.
From the project repository directory run the script: install-ubuntu.sh
From the project repository directory run the script: install-mac.sh
Some users report needing to use cmakepatch.txt which is automatically referenced and is also located in the project repository directory.
Although it is possible to install uWebSocketIO to native Windows, the process is quite involved. Instead, you can use one of several Linux-like environments on Windows to install and run the package.
One of the newest features to Windows 10 users is an Ubuntu Bash environment that works great and is easy to setup and use. Here is a nice step by step guide for setting up the utility.
We recommend using the newest version of Ubunut Bash 16.04, which is able to run the install-ubuntu.sh
script without complications. The link here can help you check which version of Ubuntu Bash you are running, and also help you upgrade if you need to. Once you have installed bash nagivgate to the project repository directory and run the script: install-ubuntu.sh
If you don't want to use Bash on Windows, or you don't have Windows 10, then you can use a virtual machine to run a Docker image that already contains all the project dependencies.
First install Docker Toolbox for Windows.
Next, launch the Docker Quickstart Terminal. The default Linux virtual environment should load up. You can test that Docker is setup correctly by running docker version
and docker ps
.
You can enter a Docker image that has all the Term 2 project dependencies by running:
docker run -it -p 4567:4567 -v 'pwd':/work udacity/controls_kit:latest
Once inside Docker you can clone over the GitHub project repositories and run the project from there.
Port forwarding is required when running code on VM and simulator on host
For security reasons, the VM does not automatically open port forwarding, so you need to manually enable port 4567. This is needed for the C++ program to successfully connect to the host simulator.
Port Forwarding Instructions
- First open up Oracle VM VirtualBox
- Click on the default session and select settings.
- Click on Network, and then Advanced.
- Click on Port Forwarding
- Click on the green plus, adds new port forwarding rule.
- Add a rule that assigns 4567 as both the host port and guest Port, as in the screenshot.
Setting up port forwarding for 4567 in a Virtual Machine
The tips below may be helpful in setting up your environment and getting term 2 projects up and running. Windows 10 Users please note that Ubuntu BASH is the recommended option.
Not all steps will be necessary, for example, installing git and cloning the project repository, if this has already been done.
sudo apt-get update
sudo apt-get install git
sudo apt-get install cmake
sudo apt-get install openssl
sudo apt-get install libssl-dev
git clone https://github.com/udacity/CarND-Kidnapped-Vehicle-Project
or whatever CarND projectsudo rm /usr/lib/libuWS.so
- navigate to the top level directory of the project
./install-ubuntu.sh
- at the top level of the project repository
mkdir build && cd build
- from /build
cmake .. && make
- Launch the simulator from Windows and execute the run command for the project, for example
./ExtendedKF
or./particle_filter
(Make sure you also run the simulator on the Windows host machine) If you see this message, it is workingListening to port 4567 Connected!!!
After following these steps there may be some messages regarding makefile not found or can't create symbolic link to websockets. There is likely nothing wrong with the installation. Before doing any other troubleshooting make sure that steps 10 and 11 have been executed from the top level of the project directory, then test the installation using step 12.
Step 9 may fail for number of reasons as listed below:
-
install-ubuntu.sh
has only rw but no x permission. Runchmod a+x install-ubuntu.sh
to give execution permission -
Cannot find the package
libuv1-dev
- To install the package run
sudo apt-get install libuv1.dev
- If you still cannot install the package run the following to get the package and install it:
sudo add-apt-repository ppa:acooks/libwebsockets6
sudo apt-get update
sudo apt-get install libuv1.dev
- To install the package run
-
May complain about the version of cmake you have. You need a version greater than 3.0. Here is a link which describes how to get version 3.8. Look at Teocci's response in this link
-
Installing cmake requires g++ compiler. Install a g++ version 4.9 or greater. Here are the steps:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
A Note Regarding Step 11 This step can fail if the bash shell is still referring to an older g++ version. To address this, please refer to this Ask Ubuntu post.
A common pitfall is to not log in to the docker container. The first time you run docker run -it -p 4567:4567 -v 'pwd':/work udacity/controls_kit:latest
the controls_kit may download, but the system may not log you in to the container. If you are logged in instead of a $
prompt, you should see something like this: root@27b126542a51:/work#
. If you are not logged into the container commands such as apt-get
and make
will not be recognized, so be sure to execute docker run -it -p 4567:4567 -v 'pwd':/work udacity/controls_kit:latest
again, if you do not see the correct prompt.
Tip regarding port forwarding when running code on vm and simulator on host
When using a virtual machine and running the simulator on the host machine, it is critical to set up port forwarding, as described above.
Note Regarding Ubuntu Bash on Windows
The Ubuntu Bash system can be accessed from Windows, any files altered in this way may no longer be recognizable by Ubuntu BASH. This often manifest itself in the file disappearing from Ubuntu BASH.
A student contributed IDE profile can be found here.
For most instances of missing packages and messages regarding uWebsockets, refer to Linux and Windows troubleshooting. Below are some common issues and their solutions.
- .sh files not recognized on run: Try chmod a+x for example
chmod a+x install-mac.sh
- missing
openssl
,libuv
, orcmake
: install-mac.sh contains the linebrew install openssl libuv cmake
, which will not execute properly ifhomebrew
is not installed. To determine ifhomebrew
is installed, executewhich brew
in a terminal. If a path returns it is installed, otherwise you seebrew not found
. Follow the guidance here to install homebrew, then try runninginstall-mac.sh
again. - If the step above does not resolve issues regarding openssl, please try the guidance provided here
- Issues with rootless mode in recent versions of OSx: Some recent versions of OSx have a rootless mode by default that cause some install script commands to fail, even when running as root or sudo. To disable this reboot in recovery mode (
command+R
), and executecsrutil disable
in a terminal. After this is complete, try running the install script.
After following these steps there may be some messages regarding makefile not found or can't create symbolic link to websockets. There is likely nothing wrong with the installation. Before doing any other troubleshooting make sure that build steps (10 and 11 from Windows and Linux instructions) have been executed from the top level of the project directory, then test the installation using running the code (step 12 from Windows and Linux instructions).
Some people have reported rapid expansion of log files when using the simulator. This appears to be associated with not being connected to uWebSockets. If this does occur, please make sure you are conneted to uWebSockets. The following workaround may also be effective at preventing large log files.
- create an empty log file
- remove write permissions so that the simulator can't write to log