Learn Apollo and autoware self-driving path planning from scratch - environment configuration
Previously, everyone encountered different problems. The configuration steps and current problems encountered are recorded here, and error solutions will be continuously updated. If an error is reported during configuration, please read the error reporting experience carefully.
Environment configuration steps (both 18.04 and 20.04 are acceptable, just don’t encounter some problems)
1. Update the image source.
First, update the image source , such as the Tsinghua source of ubuntu20.04. Baidu pile: Tsinghua source of ubuntu20.04 .
2. Install gcc, g++
Here, we need to add another software source to install gcc, g++. What I am talking about here is the gcc and g++ installation of ubuntu20. It seems that 18 does not have versions 9 and 10. I remember it is version 7, but you can install these two compilers yourself. Baidu.
sudo gedit /etc/apt/sources.list
Increase
deb http://cn.archive.ubuntu.com/ubuntu xenial main
Note that this source is for ubuntu20, and it may be different for 18.
implement
sudo apt-get update
Secondly, install gcc and g++:
sudo apt-get install gcc-9 g++-9
sudo apt-get install gcc-10 g++-10
3. Install ros and python3 environment.
There are too many online tutorials. You can install the corresponding ros version according to your own system. Mine is ubuntu20.04, and ros-noetic is installed. It is recommended not to use ubuntu16, because I have not tried it. Use 18 or 20, which are melodic and noetic .
4. Install the osqp solver
and run install_osqp.sh in /src/planning/installers
sudo ./install_osqp.sh
5. Install dependent libraries: ADOL-C
first follows method one (there may be version mismatch issues). If an error is reported or there are running problems, uninstall and use method two again.
Method one:
Install Colpack first
git clone http://github.com/CSCsw/ColPack.git
cd ColPack/build/automake
autoreconf -vif
mkdir build
cd build
../configure --prefix=usr/local
make -j
sudo make install
Then install ADOL-c
git clone -b releases/2.6.3 http://github.com/coin-or/ADOl-C.git
解压进入文件夹
sudo ./configure prefix=/usr/local
sudo make -j8
sudo make install
Method 2:
Run install_adolc.sh in /src/installers
to open the install_adolc.sh file. First modify the path marked in red in the figure below to download the absolute path of ADOL-C-2.6.3 to your computer, such as /home/xx/ Auto_driving/src/install/ADOL-C-2.6.3, otherwise lib64 will not be found. Then execute:
sudo ./install_adolc.sh
6. Install dependent libraries: ipopt solver
Recently I found that the library download link that comes with ipopt is invalid, so the installation of this package is a little more troublesome. A few
words first.
sudo apt-get update
sudo apt-get install cppad gfortran
Then refer to other people's blogs, I installed it directly using the command line:
Ubuntu20.04 Install Ipopt + cppAD process, one click without nonsense (copy flow guide) When
running, you can refer to the error reporting in point 15 of the article
7. Install matplotcpp and
run/ install-matplotcpp.sh in src/installers
sudo ./install-matplotcpp.sh
8. Install other ros package dependencies
and run install_base.sh in /src/installers
sudo ./install_base.sh
Note that there is ros-melodic in it, which is for the ros-melodic version. The noetic version should be changed to ros-noetic.
9. Install Qt5 (optional)
Reference: https://blog.csdn.net/Joker__123/article/details/122438138
10. Install the qpoases solver
sudo ./install_qp_oases.sh
11. Install yaml reading (version 0.6.0 is an example, version 0.5.2 is also available. If autoware has been compiled, it needs to be uninstalled)
sudo ./install_yaml.sh
12 The prerequisite for installing cmake 3.12
is that there is an error:
Otherwise, there is no need to change the version. Just install this version for bare-metal installation to ensure safety.
wget https://cmake.org/files/v3.12/cmake-3.12.0.tar.gz --no-check-certificate
tar -xf cmake-3.12.0.tar.gz
cd cmake-3.12.0/
./configure --prefix=/usr/local/cmake
make && sudo make install
sudo ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
If the error "ln: failed to create symbolic link '/usr/bin/cmake': File exists" is reported when executing the above command and it shows that there is already a soft link ('/usr/bin/cmake'), then execute the following command to delete the soft link. (The soft link /usr/bin/cmake' is only an example, please refer to the actual situation)
sudo rm -rf /usr/bin/cmake
Verify version
cmake --version
13 carla joint simulation, skip if not
Ubuntu18.04 reports an error when using carla0.9.5 joint simulation environment
Error reporting experience
1
CMake Error at /opt/ros/noetic/share/catkin/cmake/empy.cmake:30 (message):
Unable to find either executable 'empy' or Python module 'em'... try
installing the package 'python3-empy'
Note that because I installed the conda environment and compiled it under base , this problem may occur. The solution is:
pip install empy
2
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/local/anaconda3/bin/python3
"/opt/ros/noetic/share/catkin/cmake/parse_package_xml.py"
"/opt/ros/noetic/share/catkin/cmake/../package.xml"
"/home/cg/Automatic_driving/build/catkin_tools_prebuild/catkin/catkin_generated/version/package.cmake")
returned error code 1
Note that because I installed the conda environment and compiled it under base , this problem may occur. The solution is:
pip install catkin_pkg
Again
catkin build
3
/usr/bin/ld: /lib/x86_64-linux-gnu/libapr-1.so.0: undefined reference to `uuid_generate@UUID_1.0'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ui_console.dir/build.make:150:/home/cg/Automatic_driving/devel/.private/ui_console/lib/ui_console/ui_console] 错误 1
make[1]: *** [CMakeFiles/Makefile2:166:CMakeFiles/ui_console.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2
The reason for this error is still because of the conda environment. QT refers to qt in anaconda, because I use qt to draw pictures in ui_console. Of course, you can delete this folder and solve it. Solution:
Go to anaconda/lib under the anaconda installation folder:
sudo mkdir libuuid_bk
mv libuuid* libuuid_bk/
4
Traceback (most recent call last):
File "/opt/ros/noetic/lib/joint_state_publisher/joint_state_publisher", line 35, in <module>
import rospy
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 49, in <module>
from .client import spin, myargv, init_node, \
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/client.py", line 52, in <module>
import roslib
File "/opt/ros/noetic/lib/python3/dist-packages/roslib/__init__.py", line 50, in <module>
from roslib.launcher import load_manifest # noqa: F401
File "/opt/ros/noetic/lib/python3/dist-packages/roslib/launcher.py", line 42, in <module>
import rospkg
ModuleNotFoundError: No module named 'rospkg'
The reason for this error is still because of the conda environment. The solution is:
pip install rospkg
5
The link library cannot be found, whether it is ladolc , libqpOASES or other ones starting with l or lib . Solution:
a. Open the **/etc/ld.so.conf** file:
sudo gedit /etc/ld.so.conf
b. Add the directory where the dynamic library file is located: add below include ld.so.conf.d/*.conf
/usr/local/lib
If it is in another directory, add the other directory.
c. After saving, execute in the command line terminal:
sudo ldconfig
6
chmod o+x ./xxx.sh
Execute again
sudo ./xxx.sh
7
This is not easy to download from github, so re-run or use the ladder.
8.
First compile the object_msgs package separately.
catkin build object_msgs
Then compile it as a whole.
9.
First compile the derived_object_msgs package separately.
catkin build derived_object_msgs
Compile as a whole
10
Check the cmake version, the version requirement is 3.12
11
sudo apt-get install ros-noetic-uuid-msgs
或者
sudo apt-get install ros-melodic-uuid-msgs
12
sudo apt-get install ros-noetic-ackermann-msgs
或者
sudo apt-get install ros-melodic-ackermann-msgs
13
sudo apt-get install ros-noetic-derived-object-msgs
或者
sudo apt-get install ros-melodic-derived-object-msgs
14
sudo apt-get install ros-noetic-vision-msgs
或者
sudo apt-get install ros-melodic-vision-msgs
15Modify
/usr/include/coin/IpSmartPtr.hpp:
Just add these two lines, #define HAVE_CSTDDEF and #undef HAVE_CSTDDEF
16
sudo apt-get install libasio-dev libtinyxml2-dev