carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.11k stars 3.58k forks source link

Camera cannot receive the vehicle rendered from carla server in synchronization simulation with SUMO #7918

Open thinker310 opened 2 months ago

thinker310 commented 2 months ago

CARLA version: 0.9.14 Platform/OS: windows 11 Problem you have experienced: Camera cannot receive the rendered vehicle from carla server in synchronization simulation with SUMO. I modified the run_synchronizarion.py file to add a camera on intersection, sumo and carla server both operated normally, but the image saved to disk or displayed in real-time in pygame window only contain the background and no vehicle is captured. So what should I do? Could anyone help me ? Thank you in advance! Below image is my case: carla server: image saved image: 1952354_32795 94327536225 image in pygame: image

it is so weird, I print world.get_actors() in the code and it print the current vehicles in carla server, but the images in the camera show no vehicle and pygame tends to freeze. What you expected to happen: I hope the camera can show the normal carla server in operating and show the running vehicles. Steps to reproduce: I just modified the run_synchronization.py in co-simulation folder to add a camera.

Could you help me solve it? Thank you!

EmmettJZK commented 1 month ago

I don't have experience with SUMO and CARLA joint simulations. However, based on my past development experience, I can point out a few potential issues:

  1. I looked at the demo Python code for SUMO, which includes the tick() function to trigger CARLA simulation steps. Therefore, if you use the manual_control.py script, it's best to use asynchronous mode.
  2. Printing out the frame number is important to ensure that the images you save correspond to the server's rendering results, as the save_to_disk function often runs very slowly.

我没有sumo和CARLA联合仿真的经验。但可以从我过往开发的经验给你提几个有可能存在问题的地方: 1、我看了sumo的demo python代码,里面是包含了触发CARLA仿真步进的tick()函数,所以如果用manual_control.py脚本,最好用异步模式 2、打印出frame帧号很重要,能确定你保存的图片和Server的渲染结果是否对应。因为save_to_disk函数往往运行的很慢。

如果希望有更详细的咨询讨论,可以加我微信:1824729026