当前位置:网站首页>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 中安装
ROS1
and give the corresponding simple CPP、Python 程序和 launch 文件(本人使用的) - 方法二:通过在 WSL 终端运行
wget http://fishros.com/install -O fishros && . fishros
You 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
中的.egg
The 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/carla
should 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
边栏推荐
- 创建函数报错,提示DECLARE定义语法问题
- Cloud platform construction solutions
- RPA助力商超订单自动化!
- Conditional Statements for Shell Programming
- Cisco ike2 IPSec配置
- redis持久化方式
- 2019年10月SQL注入的两倍
- Makefile
- Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo
- Pytest learn-setup/teardown
猜你喜欢
Analysys Analysis: The transaction scale of China's online retail B2C market in Q2 2022 will reach 2,344.47 billion yuan
FinClip,助长智能电视更多想象空间
Shell编程的条件语句
3D 语义分割——2DPASS
ML之interpret:基于titanic泰坦尼克是否获救二分类预测数据集利用interpret实现EBC模型可解释性之全局解释/局部解释案例
Gains double award | know micro easily won the "2021 China digital twin solution suppliers in excellence" "made in China's smart excellent recommended products" double award!
2019年10月SQL注入的两倍
牛客2022 暑期多校3 H Hacker(SAM + 线段树查询区间内部最大子段和)
获国际权威认可 | 云扩科技入选《RPA全球市场格局报告,Q3 2022》
【开源框架】国内首个通用云计算框架,任意程序都可做成云计算。
随机推荐
FinClip,助长智能电视更多想象空间
软测人每个阶段的薪资待遇,快来康康你能拿多少?
【论文阅读】TRO 2021: Fail-Safe Motion Planning for Online Verification of Autonomous Vehicles Using Conve
物联网新零售模式,引领购物新潮流
2022-08-02 mysql/stonedb慢SQL-Q18-内存使用暴涨分析
Live Preview | Build Business Intelligence, Quickly Embrace Financial Digital Transformation
utils 定时器
log4j-slf4j-impl cannot be present with log4j-to-slf4j
Interpretation of ML: A case of global interpretation/local interpretation of EBC model interpretability based on titanic titanic rescued binary prediction data set using interpret
utlis 线程池
为什么我们需要回调
云平台建设解决方案
Storage engine written by golang, based on b+ tree, mmap
What is memoization and what is it good for?
Bytebase database schema change management tool
完全二叉树问题
How to write a database document management tool based on WPF (2)
Optimize the query (work in progress)
2022-08-02 mysql/stonedb slow SQL-Q18 - memory usage surge analysis
AOSP CameraLatencyHistogram的原理与使用