Skip to content

Open AD Kit:适用于 Autoware 的容器化工作负载#

Open AD Kit 提供两种类型的 Docker 映像,让您快速开始使用 Autoware: develruntime.

  1. devel 映像使您能够开发 Autoware,而无需设置本地开发环境.
  2. runtime 映像仅包含运行时可执行文件,使您能够快速试用 Autoware.

信息

在继续之前,请确认并同意 NVIDIA Deep Learning Container 许可证.提取和使用 Autoware Open AD Kit 映像,即表示您接受许可证的条款和条件.

先决条件#

  • Docker
  • NVIDIA Container Toolkit(首选)
  • 兼容 NVIDIA CUDA 12 的 GPU 驱动程序(首选)
  1. 克隆 autowarefoundation/autoware 并移动到该目录.

    git clone https://github.com/autowarefoundation/autoware.git
    cd autoware
    
  2. setup script 将使用以下命令安装所有必需的依赖项:

    ./setup-dev-env.sh -y docker
    

    要在不支持 NVIDIA GPU 的情况下进行安装:

    ./setup-dev-env.sh -y --no-nvidia docker
    

提示

某些功能(如对象检测和红绿灯检测/分类)需要 GPU 加速.有关如何在没有 GPU 的情况下启用这些功能的详细信息,请参阅 在没有 CUDA 的情况下运行 Autoware的 Tho Dav.

用法#

运行#

您可以使用 run.sh 来运行包含地图数据的 Autoware 运行时容器:

./docker/run.sh --map-path path_to_map_data

有关更多启动选项,您可以附加自定义启动命令,而不是使用默认启动命令,即 ros2 launch autoware_launch autoware.launch.xml .

以下是使用自定义启动命令运行运行时容器的示例:

./docker/run.sh --map-path ~/autoware_map/sample-map-rosbag ros2 launch autoware_launch planning_simulator.launch.xml map_path:=/autoware_map vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit

提示

您可以使用 --no-nvidia 在没有 NVIDIA GPU 支持的情况下运行,使用 --headless 在没有显示的情况下运行,这意味着没有 RViz 可视化.

运行 Autoware 教程#

在容器内,您可以通过以下链接运行 Autoware 教程:

规划模拟

Rosbag 重播模拟.

开发环境#

./docker/run.sh --devel

提示

默认情况下,容器上挂载的 workspace 将是当前目录(pwd),您可以通过 --workspace path_to_workspace 更改 workspace 路径.对于不支持 NVIDIA GPU 的开发环境,请使用 --no-nvidia.

如何设置工作区#

  1. 创建 src 目录并将存储库克隆到其中.

    mkdir src
    vcs import src < autoware.repos
    

    如果您是一名活跃的开发人员,您可能还希望提取包含最新更新的 nightly 存储库:

    vcs import src < autoware-nightly.repos
    

    ⚠️ 注意:nightly 仓库不稳定,可能包含 bug.请谨慎使用它们.

    Optionally, you may also download the extra repositories that contain drivers for specific hardware, but they are not necessary for building and running Autoware:

    或者,您还可以下载包含特定硬件驱动程序的额外存储库,但它们不是构建和运行 Autoware 所必需的:

    vcs import src < extra-packages.repos
    
  2. 更新依赖的 ROS 软件包.

    创建 Docker 映像后,Autoware 的依赖项可能已更改. 在这种情况下,您需要运行以下命令来更新依赖项.

    # Make sure all ros-$ROS_DISTRO-* packages are upgraded to their latest version
    sudo apt update && sudo apt upgrade
    rosdep update
    rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
    
  3. 构建工作区.

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

    如果存在任何构建问题,请参阅 故障排除中.

更新工作区

cd autoware
git pull
vcs import src < autoware.repos

# If you are using nightly repositories, also run the following command:
vcs import src < autoware-nightly.repos

vcs pull src
# Make sure all ros-$ROS_DISTRO-* packages are upgraded to their latest version
sudo apt update && sudo apt upgrade
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

It might be the case that dependencies imported via vcs import have been moved/removed. VCStool does not currently handle those cases, so if builds fail after vcs import, cleaning and re-importing all dependencies may be necessary:

rm -rf src/*
vcs import src < autoware.repos
# If you are using nightly repositories, import them as well.
vcs import src < autoware-nightly.repos

使用 VS Code 远程容器进行开发#

使用 Visual Studio CodeRemote - Containers 扩展,您可以轻松地在容器化环境中开发 Autoware.

获取 Visual Studio Code 的 远程 - 容器 扩展. 并通过从命令面板 (F1) 中选择 Remote-Containers: Reopen in Container 来重新打开容器中的工作区.

您可以选择 Autoware 或 Autoware-cuda 映像进行开发,无论是否支持 CUDA.

从头开始构建 Docker 镜像#

如果您想在本地构建这些镜像以进行开发,请执行以下命令:

cd autoware/
./docker/build.sh

要在不使用 CUDA 的情况下构建,请使用 --no-cuda 选项:

./docker/build.sh --no-cuda

要仅构建开发镜像,请使用 --devel-only 选项:

./docker/build.sh --devel-only

要指定平台,请使用 --platform 选项:

./docker/build.sh --platform linux/amd64
./docker/build.sh --platform linux/arm64

使用除 latest 以外的 Docker 镜像#

还有一些映像根据 daterelease tag 进行版本控制. 当您需要图像的固定版本时,请使用它们.

版本列表可以在 这里 找到.