详见Carla学习笔记(一)服务器跑carla本地显示窗口_Zero_979的博客-CSDN博客
只需要启动服务器端就行:
./CarlaUE4.sh -carla-rpc-port=2000 -RenderOffScreen -graphicsadaper=1
官方库:https://github.com/carla-simulator/ros-bridge
下载完后编译一下
具体操作:参考官方文档Install ROS Bridge for ROS 1 - CARLA Simulator
1. Create a catkin workspace:
mkdir -p ~/carla-ros-bridge/catkin_ws/src
2. Clone the ROS Bridge repository and submodules:
- cd ~/carla-ros-bridge
- git clone --recurse-submodules https://github.com/carla-simulator/ros-bridge.git catkin_ws/src/ros-bridge
5. Set up the ROS environment according to the ROS version you have installed:
source /opt/ros/<melodic/noetic>/setup.bash
6. Install the required ros-dependencies:
- cd catkin_ws
- rosdep update
- rosdep install --from-paths src --ignore-src -r
7. Build the ROS bridge:
catkin build # alternatively catkin_make
下载并且编译完成后,我们来启动运行:
vi ~/carla-ros-bridge/catkin_ws/devel/setup.bash
然后在这个文件里添加两行:
export CARLA_ROOT=/你的路径/CARLA_0.9.13(也可能是其它版本)
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.13-py3.7-linux-x86_64.egg(替换成你egg文件):$CARLA_ROOT/PythonAPI/carla
进入到carla_ad_demo文件夹里,修改代码里的Host为你服务器的地址
source ~/carla-ros-bridge/catkin_ws/devel/setup.bash
roslaunch carla_ad_demo carla_ad_demo.launch
不出意外的话就会弹出窗口,按P进入自动驾驶模式。
在~/catkin_ws/src/ros-bridge/carla_ad_demo/config下启动 rviz carla_ad_demo.rviz
点击左下角的add
就能看到camera成像啦!也可以自己加一些其他的监视。