前提: ubuntu20.04,英伟达显卡。
ROS2-Galactic安装
wget http://fishros.com/install -O fishros && . fishros
选择galactic(ROS2)版本,桌面版
ROS2-dev-tools安装
sudo apt install python3-testresources
sudo apt update && sudo apt install -y
build-essential
cmake
git
python3-colcon-common-extensions
python3-flake8
python3-pip
python3-pytest-cov
python3-rosdep
python3-setuptools
python3-vcstool
wget
python3 -m pip install -U
flake8-blind-except
flake8-builtins
flake8-class-newline
flake8-comprehensions
flake8-deprecated
flake8-docstrings
flake8-import-order
flake8-quotes
pytest-repeat
pytest-rerunfailures
pytest
setuptools
rmw-implementation安装
sudo apt-get -y update
sudo apt-get -y install git
mkdir autoware_universe
cd autoware_universe/
git clone https://github.com/autowarefoundation/autoware.git -b galactic
./setup-dev-env.sh
cd autoware_universe/
source amd64.env
#For details: https://docs.ros.org/en/galactic/How-To-Guides/Working-with-multiple-RMW-implementations.html
sudo apt update
rmw_implementation_dashed=
(
e
v
a
l
s
e
d
−
e
"
s
/
/
−
/
g
"
<
<
<
"
(eval sed -e "s/_/-/g" <<< "
(evalsed−e"s//−/g"<<<"{rmw_implementation}")
sudo apt install ros-
r
o
s
d
i
s
t
r
o
−
{rosdistro}-
rosdistro−{rmw_implementation_dashed}
#(Optional) You set the default RMW implementation in the ~/.bashrc file.
echo ‘’ >> ~/.bashrc && echo “export RMW_IMPLEMENTATION=${rmw_implementation}” >> ~/.bashrc
pacmod安装
#wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/galactic/amd64.env && source /tmp/amd64.env
cd autoware_universe/
source amd64.env
#Taken from https://github.com/astuff/pacmod3#installation
sudo apt install apt-transport-https
sudo sh -c 'echo "deb [trusted=yes] https://s3.amazonaws.com/autonomoustuff-repo/
(
l
s
b
r
e
l
e
a
s
e
−
s
c
)
m
a
i
n
"
>
/
e
t
c
/
a
p
t
/
s
o
u
r
c
e
s
.
l
i
s
t
.
d
/
a
u
t
o
n
o
m
o
u
s
t
u
f
f
−
p
u
b
l
i
c
.
l
i
s
t
′
s
u
d
o
a
p
t
u
p
d
a
t
e
s
u
d
o
a
p
t
i
n
s
t
a
l
l
r
o
s
−
(lsb_release -sc) main" > /etc/apt/sources.list.d/autonomoustuff-public.list' sudo apt update sudo apt install ros-
(lsbrelease−sc)main">/etc/apt/sources.list.d/autonomoustuff−public.list′sudoaptupdatesudoaptinstallros−{rosdistro}-pacmod3
autoware universe dependencies安装
sudo apt install geographiclib-tools
sudo geographiclib-get-geoids egm2008-1
安装pre-commit
clang_format_version=14.0.6
pip3 install pre-commit clang-format==${clang_format_version}
#Install Golang (Add Go PPA for shfmt)
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt install golang
CUDA安装
wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/galactic/amd64.env && source /tmp/amd64.env
cd autoware_universe/
source amd64.env
Modified from:
https://developer.nvidia.com/cuda-11-4-4-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_network
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
sudo add-apt-repository “deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /”
sudo apt-get update
cuda_version_dashed=
(
e
v
a
l
s
e
d
−
e
"
s
/
[
.
]
/
−
/
g
"
<
<
<
"
(eval sed -e "s/[.]/-/g" <<< "
(evalsed−e"s/[.]/−/g"<<<"{cuda_version}")
sudo apt install cuda-${cuda_version_dashed} --no-install-recommends
一个指令一个指令输入
cuDNN and TensorRT安装
wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/galactic/amd64.env && source /tmp/amd64.env
cd autoware_universe/
source amd64.env
#Taken from: https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing
sudo apt-get install libcudnn8= c u d n n v e r s i o n l i b c u d n n 8 − d e v = {cudnn_version} libcudnn8-dev= cudnnversionlibcudnn8−dev={cudnn_version}
sudo apt-mark hold libcudnn8 libcudnn8-dev
sudo apt-get install libnvinfer8= t e n s o r r t v e r s i o n l i b n v o n n x p a r s e r s 8 = {tensorrt_version} libnvonnxparsers8= tensorrtversionlibnvonnxparsers8={tensorrt_version} libnvparsers8= t e n s o r r t v e r s i o n l i b n v i n f e r − p l u g i n 8 = {tensorrt_version} libnvinfer-plugin8= tensorrtversionlibnvinfer−plugin8={tensorrt_version} libnvinfer-dev= t e n s o r r t v e r s i o n l i b n v o n n x p a r s e r s − d e v = {tensorrt_version} libnvonnxparsers-dev= tensorrtversionlibnvonnxparsers−dev={tensorrt_version} libnvparsers-dev= t e n s o r r t v e r s i o n l i b n v i n f e r − p l u g i n − d e v = {tensorrt_version} libnvinfer-plugin-dev= tensorrtversionlibnvinfer−plugin−dev={tensorrt_version}
sudo apt-mark hold libnvinfer8 libnvonnxparsers8 libnvparsers8 libnvinfer-plugin8 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev
Autoware.Universe源码下载
vcs import src < autoware.repos
sudo mkdir -p /etc/ros/rosdep/sources.list.d/
sudo curl -o /etc/ros/rosdep/sources.list.d/20-default.list https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
export ROSDISTRO_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/rosdistro/index-v4.yaml
rosdep update --include-eol-distros
echo ‘export ROSDISTRO_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/rosdistro/index-v4.yaml’ >> ~/.bashrc
source /opt/ros/galactic/setup.bash
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
编译空间
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
只编译指定包
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-select 包名
忽略指定包
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-ignore 包名
遇到编译错误继续编译其他模块
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --continue-on-error
启动程序(相关资源已经下载完毕)
https://autowarefoundation.github.io/autoware-documentation/galactic/tutorials/ad-hoc-simulation/rosbag-replay-simulation/
bag包启动
source ~/autoware/install/setup.bash
ros2 launch autoware_launch logging_simulator.launch.xml map_path:=$HOME/autoware_map/sample-map-rosbag vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
source ~/autoware/install/setup.bash
ros2 bag play ~/autoware_map/sample-rosbag/sample.db3 -r 0.2 -s sqlite3