当前位置:网站首页>rosbridge-WSL2 && carla-win11
rosbridge-WSL2 && carla-win11
2022-08-03 22:53:00 【Lemon_Yam】
安装 ROS
- 方法一:You can refer to my previous blog《WSL+ROS》,It describes how to be there WSL 中安装
ROS1and give the corresponding simple CPP、Python 程序和 launch 文件(本人使用的) - 方法二:通过在 WSL 终端运行
wget http://fishros.com/install -O fishros && . fishrosYou can choose to install the appropriate content according to your needs,该方法来自Yuxiang Community.If you use this method, you can consider installing it rosdepc,因为后面需要用到(The second method is more convenient)

安装 ROS bridge
️本人使用的是 ROS1,So the main talk below ROS1 的 ROS bridge 怎么安装.此外,If used later .egg The files are downloaded directly from the official website,则需要用到 python3.7 环境,否则会出现很多问题!python 环境可使用 conda 来创建,但 conda 创建 python environment will appear ROS:ModuleNotFoundError: No module named ‘rospkg‘ 等错误,可通过 pip 安装相应包(Watch out for error messages,The package missing information is in the middle of the error message for me,需要仔细排查),I probably installed it 4 个包,Which ones were not recorded carefully
方法一:通过 apt-get 安装,但只适用于 Ubuntu18.04,具体命令如下
# Set up the Debian repository in your system
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"
# Install the ROS bridge
sudo apt-get update # Update the Debian package index
sudo apt-get install carla-ros-bridge # Install the latest ROS bridge version, or update the current installation
# Check the ROS bridge has been installed successfully in the /opt/ folder
方法二:从源码中编译(本人使用的)
- 创建
catkin工作空间,The following command will create one in the user directory文件夹(工作空间)
mkdir -p ~/carla-ros-bridge/catkin_ws/src
- 从 github 上下载 ROS bridge Source code and its related modules
cd ~/carla-ros-bridge
git clone --recurse-submodules https://github.com/carla-simulator/ros-bridge.git catkin_ws/src/ros-bridge

- 根据已安装的 ROS1 设置 ROS 环境,Optional here
melodic(Ubuntu18.04) 和noetic(Ubuntu20.04)
source /opt/ros/<melodic/noetic>/setup.bash
- 安装必须的 ROS 依赖,若安装 ROS method two is used,则
rosdep需改成rosdepc
cd catkin_ws
rosdep update # 若 update Some do not Hit to repeat the operation
rosdep install --from-paths src --ignore-src -r
# 若出现错误 ERROR: the following rosdeps failed to install,则安装 pip 或 pip3


- 构建 ROS bridge
catkin build # alternatively catkin_make
# 若出现错误:catkin: command not found,则根据 python version run the following command to install manually according to
sudo apt install python3-catkin-tools
sudo apt install python-catkin-tools

运行 ROS bridge
- 运行 carla,The source code compiled can be directly clicked
CarlaUE4.uproject.若未安装 carla,可参考我之前的博客《win11 下编译 CARLA0.9.13》 - 将 carla 模块添加到 Python 路径,
CARLA_ROOT为 carla 安装的根路径,由于是在 WSL 中 export 路径,所以需要添加/mnt,而PYTHONPATH中的.eggThe file path is searched according to the path of its own installation.Passable at the back WSL 终端echo $PYTHONPATH命令查看 PYTHONPATH,If similar/opt/ros/noetic/lib/python3/dist-packages:/mnt/e/carla/PythonAPI/carla/dist/carla-0.9.13-py3.7-win-amd64.egg:/mnt/e/carla/PythonAPI/carlashould be successful(export 只在当前终端生效!)
export CARLA_ROOT=/mnt/e/carla # /mnt/e/carla 为安装 carla 的路径(在 win 中是 e 盘下 carla 目录)
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.13-py3.7-linux-x86_64.egg:$CARLA_ROOT/PythonAPI/carla # carla-0.9.13-py3.7-linux-x86_64.egg 是 carla 名称
由于 ROS bridge 是安装在 WSL 中,所以使用的 .egg 文件需要是 linux 版本的,若使用 win version will appear invalid ELF header 错误!该 linux Versions are available through the official GitHub 库下载,也可下载我上传的资源(包括0.9.12 和 0.9.13)
- 根据安装 ROS bridge 的方式为 ROS bridge Workspace added
source path
# 从 Github compiled from source code(我使用的方式)
source ~/carla-ros-bridge/catkin_ws/devel/setup.bash
# 直接安装 ROS bridge 的
source /opt/carla-ros-bridge/<melodic/noetic>/setup.bash
To avoid repeating the above environment configuration directives,One can be created under the project root path envs.bash 文件,Integrate instructions together,然后在终端中运行 source envs.bash(One terminal can be run once,不然会出现错误),Each new terminal needs to run the following if the file is not created 3 条命令,文件内容参考如下:
export CARLA_ROOT=/mnt/e/carla
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.13-py3.7-linux-x86_64.egg:$CARLA_ROOT/PythonAPI/carla
source ~/carla13-ros-bridge/catkin_ws/devel/setup.bash
- Thanks to the article ROS bridge 是安装在 WSL 中,所以需要先确定 WSL 和 win Whether the host can communicate,可参考这篇博客.通常 win The host is able to
ping通 WSL 的,而若 WSLping不通 win 主机,则以管理员身份运行powershell并输入如下命令:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
- 在启动前,The connection needs to be modified CARLA 服务端地址 ,as we want to run
carla_ros_bridge.launch文件,modify the filehost参数,该参数是 win 在 WSL 中的地址,具体如下:

- 启动 ROS bridge,The default map used is
Town1,Switch to this map first
# Each terminal should activate accordingly python 环境
# 终端 1,启动 ROS bridge
source envs.bash
roslaunch carla_ros_bridge carla_ros_bridge.launch
# 终端 2,Generate related objects,包括 ego vehicle
source envs.bash
roslaunch carla_spawn_objects carla_spawn_objects.launch
# 终端 3,控制 ego vehicle,If you need manual control, you need to press first B 键,Otherwise you can't control it,P The key is autopilot
source envs.bash
roslaunch carla_manual_control carla_manual_control.launch
# 终端 4,启动 RVIZ 可视化
rosrun rviz rviz

运行上述 4 command and configure RVIZ 后的结果
I use multiple terminals to run here instead of directly roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch Is because put the last one launch After the file is terminated CARLA An unresponsive state will appear,不知道问题出在哪里.If there is no response, you can end the process through the task manager
边栏推荐
- Testng监听器
- 《数字经济全景白皮书》金融数字用户篇 重磅发布!
- 走迷宫 BFS
- [RYU] rest_router.py source code analysis
- websocket多线程发送消息报错TEXT_PARTIAL_WRITING--自旋锁替换synchronized独占锁的使用案例
- ML's yellowbrick: A case of interpretability (threshold map) for LoR logistic regression model using yellowbrick based on whether Titanic was rescued or not based on the two-class prediction dataset
- October 2019 Twice SQL Injection
- Research status of target detection at home and abroad
- complete binary tree problem
- 2022/8/3 考试总结
猜你喜欢

Recognized by International Authorities | Yunzhuang Technology was selected in "RPA Global Market Pattern Report, Q3 2022"

Pytest学习-setup/teardown

Software testing is seriously involution, how to improve your competitiveness?

软件测试内卷严重,如何提升自己的竞争力呢?

October 2019 Twice SQL Injection

Cisco ike2 IPSec configuration

完全二叉树问题

授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节试读版

win10系统下yolov5-V6.1版本的tensorrt部署细节教程及bug修改

First domestic open source framework 】 【 general cloud computing framework, any program can be made into cloud computing.
随机推荐
亿流量大考(2):开发一套高容错分布式系统
Golang第二章:程序结构
Summary bug 】 【 Elipse garbled solution project code in Chinese!
The development status of cloud computing at home and abroad
直播预告 | 构建业务智联,快速拥抱财务数字化转型
如何基于WPF写一款数据库文档管理工具(二)
伴随着元宇宙、web3.0等概念的兴起,数字人、数字场景等诸多数字化的形态开始出现
Canvas App中点击图标生成PDF并保存到Dataverse中
创建函数报错,提示DECLARE定义语法问题
OPC UA 与IEC61499 深度融合(1)
2022-08-03 Oracle executes slow SQL-Q17 comparison
Bytebase database schema change management tool
PowerMockup 4.3.4::::Crack
for loop exercises
complete binary tree problem
Quickly build a website with static files
获国际权威认可 | 云扩科技入选《RPA全球市场格局报告,Q3 2022》
LabVIEW代码生成错误 61056
override learning (parent and child)
With the rise of concepts such as metaverse and web3.0, many digital forms such as digital people and digital scenes have begun to appear.