首页 最新 热门 推荐

  • 首页
  • 最新
  • 热门
  • 推荐

在Ubuntu20.04下安装Autoware.universe和Carla并进行联合仿真

  • 23-09-26 22:41
  • 2574
  • 10745
blog.csdn.net

在Ubuntu20.04下安装Autoware.universe和Carla并进行联合仿真

  • 一、安装Carla0.9.13
  • 二、安装 UnrealEngine 4.26
  • 三、安装Autoware.universe
  • 四、设置 OpenPlanner
  • 五、运行Carla和Autoware

一、安装Carla0.9.13

1、安装 Carla 0.9.13

pip install --user pygame numpy
pip3 install --user pygame numpy
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1AF1527DE64CB8D9
sudo add-apt-repository "deb [arch=amd64] http://dist.carla.org/carla $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install carla-simulator=0.9.13
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

二、安装 UnrealEngine 4.26

1、进入UE网页,按照顺序完成以下6步。

http://iyenn.com/index/link?url=https://www.unrealengine.com/en-US/ue-on-github

在这里插入图片描述
2、进入EpicGame的Github
http://iyenn.com/index/link?url=https://github.com/EpicGames

点击UnrealEngine
在这里插入图片描述

2、直接clone出来是最新版,需要设置classic token,可以参考:
http://iyenn.com/index/link?url=https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

在这里插入图片描述
3、复制密钥后,下载UnrealEngine

git clone --depth 1 -b carla https://github.com/CarlaUnreal/UnrealEngine.git ~/UnrealEngine_4.26
  • 1

输入用户名和刚才的密钥

4、编译

cd UnrealEngine_4.26/
./Setup.sh
./GenerateProjectFiles.sh
make
  • 1
  • 2
  • 3
  • 4

在make时报以下错:
ERROR: Platform Linux is not a valid platform to build. Check that the SDK is installed properly.
可以参考:
在编译UnrealEngine4.26时报错:ERROR: Platform Linux is not a valid platform to build. Check that the SDK is

5、检查是否安装成功

cd UnrealEngine_4.26/Engine/Binaries/Linux 
./UE4Editor
  • 1
  • 2

6、添加环境变量

echo "export UE4_ROOT=~/UnrealEngine_4.26" >> ~/.bashrc
  • 1

三、安装Autoware.universe

在第3步自动安装依赖时,可以将ROS2 Galactic一并安装,也可以提前自己手动安装,参考如下:

在Ubuntu20.04下安装ROS2 Galactic

1、安装git

sudo apt-get -y update
sudo apt-get -y install git
  • 1
  • 2

2、克隆Autoware到本地

mkdir autoware_universe
cd autoware_universe/
git clone https://github.com/autowarefoundation/autoware.git -b galactic
  • 1
  • 2
  • 3

3、自动安装相关依赖

cd autoware
./setup-dev-env.sh
  • 1
  • 2

如果有以下报错:
The following packages have unmet dependencies:“, " cuda-drivers : Depends: cuda-drivers-530 (= 530.30.02-1) but it is not going to be installed”]}

解决办法:

在Ubuntu20.04下安装Autoware.universe使用命令安装依赖时报错

4、创建 src 文件夹

mkdir src
  • 1

5、修改 autoware.repos 文件

sudo gedit autoware.repos
  • 1

在autoware.repos 文件中,28行位置加入以下内容

universe/external/open_planner:
    type: git
    url: https://github.com/ZATiTech/open_planner.git
    version: main
  • 1
  • 2
  • 3
  • 4

6、下载代码库到本地

vcs import src < autoware.repos
  • 1

7、安装 Autoware 依赖包

rosdep update --include-eol-distros
source /opt/ros/galactic/setup.bash
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
  • 1
  • 2
  • 3

在安装open3d时速度慢,报错,可以参考:
安装ROS依赖时,安装open3d速度慢,报错问题

遇到 Invalid version: ‘0.23ubuntu1’ (package: distro-info) 报错问题,可以参考:
安装ROS依赖时,Invalid version: ‘0.23ubuntu1报错

8、编译工作空间

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

在编译过程中卡死或者崩溃,或者其他问题,可以参考:

https://autowarefoundation.github.io/autoware-documentation/galactic/support/troubleshooting/#build-issues

四、设置 OpenPlanner

1、下载代码

cd ~/autoware_universe
mkdir op_carla
cd op_carla/
git clone https://github.com/hatem-darweesh/op_bridge.git -b ros2
git clone https://github.com/hatem-darweesh/op_agent.git -b ros2
git clone https://github.com/hatem-darweesh/scenario_runner.git
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

2、从google drive上下载Town01.pcd 和 Town01.osm地图。

http://iyenn.com/index/link?url=https://drive.google.com/drive/folders/1Or0CMS08AW8XvJtzzR8TfhqdY9MMUBpS

以下网盘链接中只有Town01.pcd 和 Town01.osm地图,可供下载。

链接:https://pan.baidu.com/s/1xhUj71nMniECfQrM2MniPw
提取码:i4ll

创建 Town01 文件夹,将 Town01.pcd 和 Town01.osm 复制到Town01_map 文件夹中。
Town01.pcd重命名为pointcloud_map.pcd
Town01.osm重命名为lanelet2_map.osm

3、修改 run_exploration_mode_ros2.sh 文件

sudo gedit ~/autoware_universe/op_carla/op_bridge/op_scripts/run_exploration_mode_ros2.sh
  • 1

在第8行
如果不在同一台电脑上运行仿真,需要设置运行仿真的电脑的 IP 地址。如下:
export SIMULATOR_LOCAL_HOST=“192.168.11.5”
如果在本机上运行仿真需要修改为:
export SIMULATOR_LOCAL_HOST=“localhost”

3、修改 start_ros2.sh 文件

sudo gedit ~/autoware_universe/op_carla/op_agent/start_ros2.sh 
  • 1

在第15行
按照实际的安装路径修改。
source /home/username/autoware_universe/autoware/install/setup.bash
在第18行
按照实际的安装路径修改launch文件路径,按照Town01的路径修改map_path。
ros2 launch /home/username/autoware_universe/autoware/src/launcher/autoware_launch/autoware_launch/launch/autoware.launch.xml map_path:=/home/username/autoware_universe/autoware/src/${map_name} vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit

4、修改 autoware.launch.xml 文件

sudo gedit ~/autoware_universe/autoware/src/launcher/autoware_launch/autoware_launch/launch/autoware.launch.xml
  • 1

在第11行
添加如下:


  • 1

在第17行
将launch_sensing_driver中的true改成false,可以直接复制以下替换第17行。

  
  • 1

在第23行
将use_sim_time中的false改成true,可以直接复制以下替换第23行。


  • 1

在第52行
添加如下:

  
    
		
	
  • 1
  • 2
  • 3
  • 4

5、修改 gnss.launch.xml 文件

sudo gedit ~/autoware_universe/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_launch/launch/gnss.launch.xml 
  • 1

在第4行
将coordinate_system中的1改成2,可以直接复制以下替换第4行。


  • 1

在第5行
添加如下:


  • 1

5、修改 sensor_kit_calibration.yaml 文件

sudo gedit ~/autoware_universe/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensor_kit_calibration.yaml 
  • 1

由于修改较多,可以直接全部替换:

sensor_kit_base_link:
  camera0/camera_link:
    x: 0.7
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  camera1/camera_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  camera2/camera_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  camera3/camera_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  camera4/camera_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  camera5/camera_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  traffic_light_right_camera/camera_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  traffic_light_left_camera/camera_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  velodyne_top_base_link:
    x: 0.0
    y: 0.0
    z: 0.8
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  velodyne_left_base_link:
    x: -0.5
    y: 0.0
    z: 0.8
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  velodyne_right_base_link:
    x: 0.5
    y: 0.0
    z: 0.8
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  gnss_link:
    x: 0.0
    y: 0.0
    z: 0.8
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  tamagawa/imu_link:
    x: 0.0
    y: 0.0
    z: 0.8
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92

6、修改 sensors_calibration.yaml 文件

sudo gedit ~/autoware_universe/autoware/src/sensor_kit/sample_sensor_kit_launch/sample_sensor_kit_description/config/sensors_calibration.yaml 
  • 1

由于修改较多,可以直接全部替换:

base_link:
  sensor_kit_base_link:
    x: 0.0
    y: 0.0
    z: 1.6
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  velodyne_rear_base_link:
    x: 0.0
    y: 0.0
    z: 0.0
    roll: 0.0
    pitch: 0.0
    yaw: 0.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

7、修改环境变量

sudo gedit ~/.bashrc
  • 1

根据安装位置修改路径后,再添加到环境变量中。

export CARLA_ROOT=/opt/carla-simulator
export SCENARIO_RUNNER_ROOT=/home/username/autoware_universe/op_carla/scenario_runner
export LEADERBOARD_ROOT=/home/username/autoware_universe/op_carla/op_bridge
export TEAM_CODE_ROOT=/home/username/autoware_universe/op_carla/op_agent
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI/util
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI/carla
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI/carla/agents
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.13-py3.8-linux-x86_64.egg
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

五、运行Carla和Autoware

cd $CARLA_ROOT
./CarlaUE4.sh -quality-level=Epic -world-port=2000 -resx=800 -resy=600
  • 1
  • 2

在这里插入图片描述

再打开一个终端:

cd ~/autoware_universe/op_carla/op_bridge/op_scripts
source ~/autoware_universe/autoware/install/setup.bash
./run_exploration_mode_ros2.sh
  • 1
  • 2
  • 3

如果报错,需要什么依赖,安装什么依赖:

pip install py-trees
pip install networkx
pip install tabulate
sudo apt-get install ros-galactic-sensor-msgs-py
  • 1
  • 2
  • 3
  • 4

在这里插入图片描述

完成以上,可以实现选择终点,自动路径规划,自动寻迹,如果想加入NPC车辆测试感知,可以查看下面的博客。

在Carla+Autoware.universe仿真中加入NPC车辆

注:本文转载自blog.csdn.net的少年独剑倚清秋的文章"https://blog.csdn.net/yuteng12138/article/details/130102293"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接
复制链接
相关推荐
发表评论
登录后才能发表评论和回复 注册

/ 登录

评论记录:

未查询到任何数据!
回复评论:

分类栏目

后端 (14832) 前端 (14280) 移动开发 (3760) 编程语言 (3851) Java (3904) Python (3298) 人工智能 (10119) AIGC (2810) 大数据 (3499) 数据库 (3945) 数据结构与算法 (3757) 音视频 (2669) 云原生 (3145) 云平台 (2965) 前沿技术 (2993) 开源 (2160) 小程序 (2860) 运维 (2533) 服务器 (2698) 操作系统 (2325) 硬件开发 (2491) 嵌入式 (2955) 微软技术 (2769) 软件工程 (2056) 测试 (2865) 网络空间安全 (2948) 网络与通信 (2797) 用户体验设计 (2592) 学习和成长 (2593) 搜索 (2744) 开发工具 (7108) 游戏 (2829) HarmonyOS (2935) 区块链 (2782) 数学 (3112) 3C硬件 (2759) 资讯 (2909) Android (4709) iOS (1850) 代码人生 (3043) 阅读 (2841)

热门文章

101
推荐
关于我们 隐私政策 免责声明 联系我们
Copyright © 2020-2025 蚁人论坛 (iYenn.com) All Rights Reserved.
Scroll to Top