Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Setting Up Development Environment for Autonomous Driving Path Planning Frameworks

Tech May 8 3

System Prerequisites

Ubuntu 18.04 LTS or 20.04 LTS is recommended. Dual-boot setups are strongly advised; virtual machines may fail to support simulation tools like CARLA reliably.

Python Runtime Selection

  • Ubuntu 18.04: Default system Python 2.7 is sufficient. Conda environments are optional but useful for project isolation.
  • Ubuntu 20.04: Use Conda to create a dedicated Python 3.7 environment, avoiding conflicts with system packages.

Package Repository Configuration

Update /etc/apt/sources.list to use a fast mirror (e.g., Tsinghua University’s archive). Ensure the distribution codename matches your OS:

  • For Ubuntu 18.04 (Bionic), use bionic-targeted repositories.
  • For Ubuntu 20.04 (Focal), use focal sources.

Then refresh package indices:

sudo apt-get update

Complier Toolchain Setup

Install multiple GCC/G++ versions for compatibility across dependencies:

# On Ubuntu 20.04
sudo apt-get install gcc-9 g++-9 gcc-10 g++-10

# On Ubuntu 18.04, install available versions (e.g., gcc-7/g++-7)
sudo apt-get install gcc-7 g++-7

Configure alternatives if needed:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10

ROS Installation

Install ROS Noetic (for Ubuntu 20.04) or Melodic (for Ubuntu 18.04):

# Example for Noetic
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-noetic-desktop-full
source /opt/ros/noetic/setup.bash

Initialize rosdep:

sudo rosdep init
rosdep update

Numerical Optimization Libraries

OSQP and OSQP-Eigen

Clone and build version-matched releases:

git clone https://gitee.com/xiacanming/osqp-0.5.0.git
cd osqp-0.5.0 && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
sudo make install

git clone https://gitee.com/xiacanming/osqp-eigen-0.4.1.git
cd osqp-eigen-0.4.1 && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
sudo make install

ADOL-C and ColPack

Build ColPack first:

git clone https://github.com/CSCsw/ColPack.git
cd ColPack/build/automake
autoreconf -vif
mkdir build && cd build
../configure --prefix=/usr/local
make -j$(nproc)
sudo make install

Then ADOL-C:

sudo apt-get install libboost-all-dev
git clone -b releases/2.6.3 https://github.com/coin-or/ADOL-C.git
cd ADOL-C
./configure --prefix=/usr/local
make -j$(nproc)
sudo make install

Verify installation:

ls /usr/local/include/adolc*
ls /usr/local/lib/libadolc*

IPOPT

Prefer binary installation:

sudo apt-get install coinor-libipopt-dev cppad gfortran

qpOASES

Use the provided script or build manually:

git clone https://github.com/coin-or/qpOASES.git
cd qpOASES && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
make -j$(nproc)
sudo make install

YAML Parsing Libray

Use yaml-cpp v0.6.0 explicitly:

git clone -b yaml-cpp-0.6.0 https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp && mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
sudo make install

CMake Version Management

If CMake < 3.12 causes build failures, install it locally:

wget https://cmake.org/files/v3.12/cmake-3.12.0.tar.gz
tar -xzf cmake-3.12.0.tar.gz
cd cmake-3.12.0
./configure --prefix=/usr/local/cmake
make -j$(nproc)
sudo make install
sudo ln -sf /usr/local/cmake/bin/cmake /usr/bin/cmake

g2o Graph Optimization Library

Required for TEB local planner integration:

sudo apt-get install cmake libeigen3-dev libsuitesparse-dev libqglviewer-dev-qt5

git clone -b 20200410_git https://github.com/RainerKuemmerle/g2o.git
cd g2o && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
sudo make install

To uninstall:

sudo rm -rf /usr/local/include/g2o /usr/local/lib/libg2o* /usr/local/bin/g2o* /usr/local/lib/cmake/g2o

Protocol Buffers

Install protobuf 3.12+ from source or via package manager:

sudo apt-get install protobuf-compiler libprotobuf-dev

Or build from source if strict version control is required.

Optional Visualization Support

For plotting in Python 2.7 (Ubuntu 18.04 only):

sudo apt-get install python2.7-dev python-tk
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | sudo python2
sudo pip2 install matplotlib

ROS Workspace Compilation

Ensure message definitions are built before full compilation:

# For ROS 1
catkin build object_msgs waypoint_msgs carla_msgs
catkin build

# For ROS 2
colcon build --packages-select object_msgs waypoint_msgs carla_msgs
colcon build

CARLA Integration (Optional)

CARLA 0.9.11 is compatible with Ubuntu 18.04. Download the appropriate release binary and configure CARLA_ROOT. Launch with:

$CARLA_ROOT/CarlaUE4.sh -opengl

Set environment variables in your shell profile:

export CARLA_ROOT=/path/to/CarlaUE4
export PYTHONPATH=$CARLA_ROOT/PythonAPI/carla:$PYTHONPATH

Cleanup Script (Optional)

To reclaim disk space after installations:

sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
rm -rf osqp osqp-eigen ColPack ADOl-C yaml-cpp qpOASES g2o

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.