|  |  | @ -28,135 +28,6 @@ openpilot tools and the following setup steps are developed and tested on Ubuntu | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | Setup |  |  |  | Setup | 
			
		
	
		
		
			
				
					
					|  |  |  | ============ |  |  |  | ============ | 
			
		
	
		
		
			
				
					
					|  |  |  | <!-- |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | TODO: These instructions maybe outdated, follow ubuntu_setup.sh setup instructions |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 1. Install native dependencies (Mac and Ubuntu sections listed below) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     **Ubuntu** |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - core tools |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo apt install git curl python-pip |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo pip install --upgrade pip>=18.0 pipenv |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - ffmpeg (tested with 3.3.2) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo apt install ffmpeg libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libavresample-dev libavfilter-dev |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - build tools |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo apt install autoconf automake clang clang-3.8 libtool pkg-config build-essential |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - libarchive-dev (tested with 3.1.2-11ubuntu0.16.04.4) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo apt install libarchive-dev |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - qt python binding (tested with python-qt4, 4.11.4+dfsg-1build4) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo apt install python-qt4 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - zmq 4.2.3 (required for replay) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       curl -LO https://github.com/zeromq/libzmq/releases/download/v4.2.3/zeromq-4.2.3.tar.gz |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       tar xfz zeromq-4.2.3.tar.gz |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       cd zeromq-4.2.3 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ./autogen.sh |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ./configure CPPFLAGS=-DPIC CFLAGS=-fPIC CXXFLAGS=-fPIC LDFLAGS=-fPIC --disable-shared --enable-static |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       make |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo make install |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     **Mac** |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - brew |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - core tools |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       brew install git |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       sudo pip install --upgrade pip pipenv |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       xcode-select --install |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - ffmpeg (tested with 3.4.1) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         brew install ffmpeg |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - build tools |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         brew install autoconf automake libtool llvm pkg-config |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - libarchive-dev (tested with 3.3.3) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         brew install libarchive |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - qt for Mac |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         brew install qt |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     - zmq 4.3.1 (required for replay) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         brew install zeromq |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 2. Install Cap'n Proto |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     curl -O https://capnproto.org/capnproto-c++-0.6.1.tar.gz |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     tar xvf capnproto-c++-0.6.1.tar.gz |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     cd capnproto-c++-0.6.1 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ./configure --prefix=/usr/local CPPFLAGS=-DPIC CFLAGS=-fPIC CXXFLAGS=-fPIC LDFLAGS=-fPIC --disable-shared --enable-static |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     make -j4 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     sudo make install |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 2. Clone openpilot if you haven't already |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     git clone https://github.com/commaai/openpilot.git |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     cd openpilot |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     pipenv install # Install dependencies in a virtualenv |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     pipenv shell # Activate the virtualenv |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     **For Mac users** |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     Recompile longitudinal_mpc for mac |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     Navigate to: |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ``` bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     cd selfdrive/controls/lib/longitudinal_mpc |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     make clean |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     make |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 3. Install tools dependencies |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     cd tools |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     pip install -r requirements.txt # Install tools dependencies in virtualenv |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 4. Add openpilot to your `PYTHONPATH`. |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     For bash users: |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ```bash |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     echo 'export PYTHONPATH="$PYTHONPATH:<path-to-openpilot>"' >> ~/.bashrc |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     source ~/.bashrc |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ``` |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | --> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 1. Run ubuntu_setup.sh, make sure everything completed correctly |  |  |  | 1. Run ubuntu_setup.sh, make sure everything completed correctly | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 2. Compile openpilot by running ```scons``` in the openpilot directory |  |  |  | 2. Compile openpilot by running ```scons``` in the openpilot directory | 
			
		
	
	
		
		
			
				
					|  |  | 
 |