首先默认你已经安装好了docker以及nvidia的ctk,别问为什么,因为我在本机尝试了N次了,均以失败告终,无奈只能选择docker拉取官方给好的环境部署,结果一次成功。(癫狂)
之后创建一个工作空间,这个随你,尽量丢在SSD里
ROS_DISTRO=humble
AUTOWARE_DIR=~/autodrive/autoware
mkdir -p $AUTOWARE_DIR/src && cd $AUTOWARE_DIR
下面是下载autoware.repo文件,但是为了照顾没有魔法的用户或者魔法比较慢,我修改了autoware.repo文件,只需要复制粘贴进去就好
repositories:
# core
core/autoware_msgs:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_msgs.git
version: 1.11.0
core/autoware_adapi_msgs:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_adapi_msgs.git
version: 1.9.1
core/autoware_internal_msgs:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_internal_msgs.git
version: 1.12.1
core/autoware_cmake:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_cmake.git
version: 1.1.0
core/autoware_utils:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_utils.git
version: 1.6.0
core/autoware_lanelet2_extension:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_lanelet2_extension.git
version: 0.12.0
core/autoware_core:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_core.git
version: 1.7.0
core/autoware_rviz_plugins:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_rviz_plugins.git
version: 0.4.0
# universe
universe/autoware_universe:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_universe.git
version: 0.50.0
universe/external/tier4_autoware_msgs:
type: git
url: https://gh-proxy.org/https://github.com/tier4/tier4_autoware_msgs.git
version: v0.58.0
# Fix the version not to merge https://github.com/MORAI-Autonomous/MORAI-ROS2_morai_msgs/pull/9
universe/external/morai_msgs:
type: git
url: https://gh-proxy.org/https://github.com/MORAI-Autonomous/MORAI-ROS2_morai_msgs.git
version: e2e75fc1603a9798773e467a679edf68b448e705
universe/external/muSSP:
type: git
url: https://gh-proxy.org/https://github.com/tier4/muSSP.git
version: c79e98fd5e658f4f90c06d93472faa977bc873b9
universe/external/pointcloud_to_laserscan:
type: git
url: https://gh-proxy.org/https://github.com/tier4/pointcloud_to_laserscan.git
version: d969ec699f84fad827fbadfa3001c9c657482fbe
universe/external/eagleye:
type: git
url: https://gh-proxy.org/https://github.com/MapIV/eagleye.git
version: 575136ebba99892946d36d8398f228aee2136af0
universe/external/rtklib_ros_bridge:
type: git
url: https://gh-proxy.org/https://github.com/MapIV/rtklib_ros_bridge.git
version: ef094407bba4f475a8032972e0c60cbb939b51b8
universe/external/llh_converter:
type: git
url: https://gh-proxy.org/https://github.com/MapIV/llh_converter.git
version: 4fc2a2e1bc9dcf3e6ab0a8085d8257168e160342
universe/external/glog: # TODO(Horibe): to use isGoogleInitialized() API in v0.6.0. Remove when the rosdep glog version is updated to v0.6.0 (already updated in Ubuntu 24.04)
type: git
url: https://gh-proxy.org/https://github.com/tier4/glog.git
version: ea36766fdc2ac8e8c8e3ac988ae69acd6d09bb30
universe/external/bevdet_vendor: # TODO: wrap the original bevdet-tensorrt-cpp source code as a vendor package and provide it to autoware_tensorrt_bevdet package
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/bevdet_vendor.git
version: 0.1.0
universe/external/trt_batched_nms:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/trt_batched_nms.git
version: 0.1.0
universe/external/cuda_blackboard:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/cuda_blackboard.git
version: 0.3.0
universe/external/negotiated:
type: git
url: https://gh-proxy.org/https://github.com/osrf/negotiated.git
version: eac198b55dcd052af5988f0f174902913c5f20e7
universe/external/managed_transform_buffer:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/managed_transform_buffer.git
version: 0.2.0
# launcher
launcher/autoware_launch:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/autoware_launch.git
version: 0.50.0
# sensor_component
sensor_component/external/sensor_component_description:
type: git
url: https://gh-proxy.org/https://github.com/tier4/sensor_component_description.git
version: 03ba094851ec90febfcfc0adb20b64b0e19df7a8
sensor_component/external/nebula:
type: git
url: https://gh-proxy.org/https://github.com/tier4/nebula.git
version: v0.3.2.2
sensor_component/external/sync_tooling_msgs:
type: git
url: https://gh-proxy.org/https://github.com/tier4/sync_tooling_msgs.git
version: 0.2.6
# Fork of transport_drivers that enables reduction of copy operations
sensor_component/transport_drivers:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/transport_drivers
version: 39ebd8afe1bb9760a6cd6272e428468480f6de90
# Continental compatible version of ROS 2 socket CAN
sensor_component/ros2_socketcan:
type: git
url: https://gh-proxy.org/https://github.com/autowarefoundation/ros2_socketcan
version: e39a814180b03f00a5692b6951a5d4e9f0463486
# middleware
# TODO(TIER IV): During the transition period of Agnocast introduction,
# the Agnocast ROS packages are provided as a source build.
# Once the transition stabilizes, use the packages released from the official ROS repository.
# Issue: https://github.com/autowarefoundation/autoware/issues/5968
middleware/external/agnocast:
type: git
url: https://gh-proxy.org/https://github.com/tier4/agnocast.git
version: backport-jazzy-support-v2.1.2
从这一部分开始就准备转到docker里了
sudo docker pull ghcr.nju.edu.cn/autowarefoundation/autoware:universe-devel-cuda-20260306 //赞美nju
//我的机器是3080ti,如果你是30系列跟着我走就行
services:
autoware:
image: ghcr.nju.edu.cn/autowarefoundation/autoware:universe-devel-cuda-20260306
container_name: autoware-universe
privileged: true
network_mode: host
ipc: host # 优化 ROS 2 进程间通信
environment:
- DISPLAY=:1
- QT_X11_NO_MITSHM=1
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
volumes:
# 图形界面支持
- /tmp/.X11-unix:/tmp/.X11-unix:rw
# 挂载你的工作间
- /home/cold/autodrive/autoware:/autoware:rw
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
stdin_open: true
tty: true
command: /bin/bash
启动镜像之后sudo docker exec -it autoware-universe /bin/bash //Docker,启动!
sudo rosdep init 2>/dev/null || true
rosdep update
sudo apt update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
nvidia-smi //确认是否安装到位
export NVCC_PREPEND_FLAGS="--extended-lambda --expt-relaxed-constexpr -arch=sm_86" //这是3080ti 其余型号可以自己搜搜,然后替换sm_XX就行
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=86
//然后你就等把,7900x3d编译了28分钟,如果内存小容易爆,记得增加swap
之后你的系统会开始编译autoware,这里耗时会比较久,具体时常由你电脑性能决定。如果内存比较少记得增加swap
编译完成之后及的source install/setup.bash 如果提示
not found: "/home/rambo/autoware/install/autoware_cuda_utils/share/autoware_cuda_utils/local_setup.bash"
not found: "/home/rambo/autoware/install/autoware_tensorrt_common/share/autoware_tensorrt_common/local_setup.bash"
not found: "/home/rambo/autoware/install/autoware_tensorrt_classifier/share/autoware_tensorrt_classifier/local_setup.bash"
not found: "/home/rambo/autoware/install/autoware_tensorrt_plugins/share/autoware_tensorrt_plugins/local_setup.bash"
not found: "/home/rambo/autoware/install/bevdet_vendor/share/bevdet_vendor/local_setup.bash"
not found: "/home/rambo/autoware/install/cuda_blackboard/share/cuda_blackboard/local_setup.bash"
not found: "/home/rambo/autoware/install/autoware_cuda_pointcloud_preprocessor/share/autoware_cuda_pointcloud_preprocessor/local_setup.bash"
如果你用cpu仿真就没啥影响,nvidia的话你就要去安装对应的驱动然后重新build //后补充如果你是用docker就没这个影响了
colcon build \
--symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Release
之后验证一下节点
ros2 pkg list | grep autoware
创建地图文件夹
mkdir -p ~/autoware_maps && cd ~/autoware_maps
创建完成之后如果你要启动仿真就输入
source install/setup.bash
ros2 launch autoware_launch planning_simulator.launch.xml \
map_path:=/autoware/autoware_map/Town01 \
lanelet2_map_filename:=vector_map.osm \
pointcloud_map_filename:=pointcloud_map.pcd \
vehicle_model:=sample_vehicle \
sensor_model:=sample_sensor_kit
//map_path写你自己的目录 启动后你应该就能看到整体了

