Autoware安装教程

安装Autoware前需要的配置

  1. 操作系统:Ubuntu 22.04
  2. ROS:ROS 2 Humble
  3. Git
    sudo apt-get -y update
    sudo apt-get -y install git
    

本教程默认读者已经安装好Ubuntu 22.04,因此从 ROS 2 开始安装。

一、ROS 2 Humble安装

关于ROS2的安装,我强烈建议大家可以直接参考官网安装教程,不仅是因为官网教程是很难出错的,还因为作为一名开发者,直接阅读工程文档是好习惯!ROS官网安装教程

当然本文同样提供了安装步骤:

1.1 设置 locale

  1. 确保你的本地语言支持 UTF-8
    用以下命令测试是否支持:
locale

如果出现以下类似画面,说明没问题。读者可以直接跳至设置源

check for UTF-8

  1. 如果不支持,请进行第2步:
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

locale  # verify settings

1.2 设置源

  1. 首先需要在系统中添加 ROS 2 apt 仓库。确保 Ubuntu Universe 仓库已启用。
sudo apt install software-properties-common
sudo add-apt-repository universe
  1. 用 apt 添加 ROS 2 GPG 密钥
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
  1. 将版本库添加到源列表中
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

1.3 安装ROS 2

  1. 设置软件源后,更新 apt 软件源缓存。
sudo apt update

ROS 2 软件包基于经常更新的 Ubuntu 系统。建议在安装新软件包之前确保系统是最新的。

sudo apt upgrade
  1. 安装Desktop:ROS, RViz, demos, tutorials.
sudo apt install ros-humble-desktop

1.4 环境设置

通过获取以下文件来设置环境。

# Replace ".bash" with your shell if you're not using bash
# Possible values are: setup.bash, setup.sh, setup.zsh
source /opt/ros/humble/setup.bash

1.5 检查ROS 2 是否安装成功

  1. 在一个终端中运行 C++ talker:
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker
  1. 在另一个终端中运行Python listener:
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listener
  1. 出现以下信息就验证了 C++ 和 Python API 都能正常工作。

在这里插入图片描述
至此,,恭喜你,ROS2 安装成功!

二、Autoware安装

这里同样推荐参考官方安装教程,不过本文的教程更好用,解决了官方教程没有提到的bug。

2.1 创建开发环境

  1. 克隆 autowarefoundation/autoware项目,并进入该目录。
git clone https://github.com/autowarefoundation/autoware.git
cd autoware
  1. 使用提供的脚本自动安装依赖项。
./setup-dev-env.sh

如果ROS2 安装没有问题,到这一步为止应该不会有什么bug出现。

2.2 创建工作空间

  1. 创建 src 目录并克隆软件源
    Autoware 使用 vcstool 构建工作区。
cd autoware
mkdir src
vcs import src < autoware.repos
  1. 安装依赖的 ROS 软件包
    除核心组件外,Autoware 还需要一些 ROS 2 软件包。工具 rosdep 可自动搜索并安装此类依赖包。在使用rosdep install之前,需要运行rosdep update更新 rosdep 。
source /opt/ros/humble/setup.bash
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

这一步会出现一个关于pacmod3_msgs找不到的错误,这个问题不解决就无法安装完成,后面编译也不会成功。(笔者在这耗费了很多时间)
后来发现这是autoware还没有修复的bug, 按照以下步骤单独安装pacmod3_msgs就可以解决。(或参考:pacmod3_msgs安装
运行下面的命令,安装成功即可,${rosdistro}要替换为ROS的版本,例如本文是humble

wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/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/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/autonomoustuff-public.list'
sudo apt update
sudo apt install ros-${rosdistro}-pacmod3

成功后再重新运行:

source /opt/ros/humble/setup.bash
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

看到以下内容,证明安装完成!
在这里插入图片描述

2.3 编译工作空间

Autoware 使用 colcon 编译工作空间。

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

看到以下内容,证明编译完成!
在这里插入图片描述

2.4 测试是否安装成功

我们可以运行官方的demo来测试我们的环境是否配置成功。

2.4.1 准备工作

下载一个地图:
手动下载:地图
命令行下载(推荐):

gdown -O ~/autoware_map/ 'https://docs.google.com/uc?export=download&id=1499_nsbUbIeturZaDj7jhUownh5fvXHd'
unzip -d ~/autoware_map ~/autoware_map/sample-map-planning.zip

检查是否有 ~/autoware_data 文件夹和其中的文件。

cd ~/autoware_data
ls -C -w 30
image_projection_based_fusion
lidar_apollo_instance_segmentation
lidar_centerpoint
tensorrt_yolo
tensorrt_yolox
traffic_light_classifier
traffic_light_fine_detector
traffic_light_ssd_fine_detector
yabloc_pose_initializer

如果没有~/autoware_data文件夹,则使用以下方式手动下载:
安装 ansible 收集程序:

cd ~/autoware # The root directory of the cloned repository
ansible-galaxy collection install -f -r "ansible-galaxy-requirements.yaml"

运行:

ansible-playbook autoware.dev_env.download_artifacts -e "data_dir=$HOME/autoware_data" --ask-become-pass

这将下载并解压工件到指定目录。

2.4.2 运行demo:车道驾驶场景

  1. Launch Autoware
source ~/autoware/install/setup.bash
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/autoware_map/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit

注意:此处不能使用 ~ 代替 $HOME。如果使用 ~,地图将无法加载。
2. 按照以下视频操作即可看到小车自动驾驶。

Lane driving scenario demo

如果运行成功则证明Autoware安装成功!

三、autoware-build-gui 安装(可选)

3.1 安装依赖

要直接运行 .deb 文件,首先需要检查是否安装了这些依赖项。

sudo apt install libwebkit2gtk-4.1-0 libjavascriptcoregtk-4.1-0 libsoup-3.0-0 libsoup-3.0-common

要开发 Autoware Build GUI,您需要在系统中安装 Rust 和 Node.js。

3.2 安装Rust

  1. 运行下面的命令安装Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh
  1. 在终端页面中按enter默认安装即可。
  2. 检查是否安装成功
rustc --version

3.3 安装 Node.js

  1. 运行:
sudo apt update
sudo apt install nodejs
  1. 测试是否安装成功:
node --version
  1. 安装 npnm
npm install -g pnpm

3.4 正式安装 GUI

  1. 克隆GUI项目
git clone https://github.com/leo-drive/autoware-build-gui.git
cd autoware-build-gui
  1. 安装依赖包
pnpm i
  1. 运行开发版本的应用程序:
pnpm tauri dev

这一步会出现类似下面的错误:

Package atk was not found in the pkg-config search path.
  Perhaps you should add the directory containing atk.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'atk' found
  Package atk was not found in the pkg-config search path.
  Perhaps you should add the directory containing atk.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'atk' found
Package gdk-3.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing gdk-3.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'gdk-3.0' found
Package javascriptcoregtk-4.1 was not found in the pkg-config search path.
  Perhaps you should add the directory containing javascriptcoregtk-4.1.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'javascriptcoregtk-4.1' found

要解决这个问题,缺什么包安装即可。例如:

sudo apt-get install javascriptcoregtk-4.1

然后重新运行:

pnpm tauri dev

如果 GUI 界面能打开,则证明安装成功!

四、参考文献

  1. https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
  2. https://github.com/autowarefoundation/autoware-documentation/blob/main/docs/installation/autoware/source-installation.md
  3. https://github.com/autowarefoundation
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值