Carla for Windows and virtual machine ROS Bridge and interaction

Carla is an open source autopilot testing framework, similar to Airsim. If you search for this article, you should probably already know what to do carla a.

 

Carla There are pre built binary, Linux and Windows platforms, there are official build tutorial, I tried to compile under Windows. The first step results appeared compiler error, because I was lazy so I just took his official binary.

https://github.com/carla-simulator/carla/releases

In 0.9.5 Windows binary downloads have the

 

After the open root directory extracting executable file, is generated at a similar interface may FIG.

 

 

 

 

This is generated when a Server, is a world. You can control the viewing angle Ego with wasd and mouse, flying everywhere.

There is a file folder named example in PythonAPI folder, there are some real python list of files can be set to show the client and server interaction.

 

 

 

Of course, we are talking about today is to bridge the interaction and ROS. ROS bridge 0.9.5 can be downloaded at the link below

https://github.com/carla-simulator/ros-bridge/releases

 

After downloading codecs, specifically how to compile and use it can be found in

https://github.com/carla-simulator/ros-bridge

 

For me, because I want to run ROS bridge in the VM (Why? Because this is the group's decision ...), it is a little larger than the average trouble.

Other basic does not matter, the most critical is that this two-step, if you want to run the VM ROS bridge

export PYTHONPATH=$PYTHONPATH:<path-to-carla>/PythonAPI/carla/dist/carla-<carla_version_and_arch>.egg
source ~/carla-ros-bridge/catkin_ws/devel/setup.bash

First, because your<path-to-carla>在Windows系统上,所以需要先设置一个shared directory,这个就是Windows上carla的文件夹,然后在虚拟机上挂载这个文件夹。最后记得在/mnt下看看文件夹是否已经被挂载。

Then of course first need to modify the PYTHONPATH command <path-to-carla> write / mnt folder in the carla.

second,carla-<carla_version_and_arch>.egg 需要被替换成和你VM版本一致的Egg文件。因为主机是Windows,二进制的egg也是for windows, 所以额外下载一个Linux的binary,把里面的egg文件拷贝到windows carla相应的路径里。为什么?因为ROS bridge会和这个egg文件交互,执行ROS bridge python脚本的肯定是VM下的Linux的Python Interpreter,所以如果你的egg是Windows版本会有问题,因为某些脚本会执行egg里边的pyd文件。Linux的python执行pyd?你逗我?

 

Then you can run the ROS bridge:roslaunch carla_ros_bridge carla_ros_bridge.launch

 这里也有一个东西,因为VM和主机不是一个localhost,所以你需要改一下lauch文件里的host,把localhost改成10.0.2.2,这个就是主机在虚拟机网络里主机的地址。

 

Finally, you can play a game with ROS bridge carla. Lidar can be embedded cameras and sensors, as well as lane invasion and obstacle sensors, the two should be fused.

 

 

 

 

If you do not need to run ROS bridge under VM, the process will be much simpler to build

Guess you like

Origin www.cnblogs.com/symbiosis/p/12406510.html