[autoware学习1] 安装

 

安装

源码方式

选用的是ubuntu 18.04 + ros melodic + autoware v1.12.0

// TODO 未测试CUDA。

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
curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
sudo apt update
sudo apt install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update

在最后一步,常常会失败,多次尝试即可。很随缘,所以写了一个脚本循环尝试。

#! /bin/bash

#echo $?
i=1
rosdep update
while [ $? = 1 ] ; do
	echo "--- " ${i}
	let i+=1
	rosdep update
done

exit 0
sudo apt update
sudo apt install -y python-catkin-pkg python-rosdep ros-$ROS_DISTRO-catkin
sudo apt install -y python3-pip python3-colcon-common-extensions python3-setuptools python3-vcstool
pip3 install -U setuptools

添加Eigen(NOTE: To enable CUDA support on Melodic, Eigen is required to be updated.)

cd && wget http://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz #Download Eigen
mkdir eigen && tar --strip-components=1 -xzvf 3.3.7.tar.gz -C eigen #Decompress
cd eigen && mkdir build && cd build && cmake .. && make && make install #Build and install
cd && rm -rf 3.3.7.tar.gz && rm -rf eigen #Remove downloaded and temporary files

下载源码

mkdir -p autoware.ai/src
cd autoware.ai
wget -O autoware.ai.repos "https://gitlab.com/autowarefoundation/autoware.ai/autoware/raw/1.12.0/autoware.ai.repos?inline=false"
vcs import src < autoware.ai.repos
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

带CUDA编译:

AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

不带CUDA编译:

colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
  • 3.启动
    cd ~/autoware.ai
    source  ~/autoware.ai/install/setup.bash
    roslaunch runtime_manager runtime_manager.launch
    

docker方式

// TODO 未测试CUDA。

卸载旧版本,添加仓库

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

安装

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

根据下一个命令列出的版本,选择其一替换<VERSION_STRING>进行安装

apt-cache madison docker-ce
sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

验证是否安装成功(可选)

sudo docker run hello-world
  • 2.git仓库
git clone https://gitlab.com/autowarefoundation/autoware.ai/docker
  • 3.运行脚本启动

(可选)此处可修改脚本,选择版本,解决因大量修改文件USER_ID需要耗大量时间,设置使用cpu。

启动脚本,会自动下载autoware镜像,并启动。

cd docker/generic/
./run.sh

错误处理

RLException

运行roslaunch runtime_manager runtime_manager.launch,报错:RLException: [runtime_manager.launch] is neither a launch file in package.

解决

安装缺失库psutil。(python2)

示例

官方rosbag demo