当前位置:网站首页>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
边栏推荐
- Quickly build a website with static files
- 二叉搜索树解决落叶问题
- 【day1】
- Research status of target detection at home and abroad
- 牛客2022 暑期多校3 H Hacker(SAM + 线段树查询区间内部最大子段和)
- override学习(父类和子类)
- BMN: Boundary-Matching Network for Temporal Action Proposal Generation阅读笔记
- log4j-slf4j-impl cannot be present with log4j-to-slf4j
- UVa 10003 - Cutting Sticks(白书,区间DP)
- Golang第一章:入门
猜你喜欢

2022-08-02 mysql/stonedb slow SQL-Q18 - memory usage surge analysis

MiniAPI of .NET6 (14): Cross-domain CORS (Part 1)

Click the icon in Canvas App to generate PDF and save it to Dataverse
![[b01lers2020]Life on Mars](/img/d0/d5c9b7224542c8843ce29adc7ef713.png)
[b01lers2020]Life on Mars

2022-08-03 Oracle executes slow SQL-Q17 comparison

Cloud platform construction solutions

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

node连接mysql数据库报错:Client does not support authentication protocol requested by server

ML之yellowbrick:基于titanic泰坦尼克是否获救二分类预测数据集利用yellowbrick对LoR逻辑回归模型实现可解释性(阈值图)案例

Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo
随机推荐
易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元
Testng监听器
如何基于WPF写一款数据库文档管理工具(二)
【bug】汇总Elipse项目中代码中文乱码解决方法!
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
noip preliminary round
代码随想录笔记_动态规划_416分割等和子集
[N1CTF 2018] eating_cms
How to write a database document management tool based on WPF (2)
Golang第一章:入门
RPA power business automation super order!
Cisco ike2 IPSec配置
Recognized by International Authorities | Yunzhuang Technology was selected in "RPA Global Market Pattern Report, Q3 2022"
Codeup brushing notes - simple simulation
The sword refers to the offer question 22 - the Kth node from the bottom in the linked list
Testng listener
Binary search tree to solve the fallen leaves problem
云平台建设解决方案
FinClip最易用的智能电视小程序
CAS:178744-28-0,mPEG-DSPE,DSPE-mPEG,甲氧基-聚乙二醇-磷脂酰乙醇胺供应