MaisJamal / carla_apollo_bridge

This project provides a bridge for communication between the autonomous driving platform Apollo and Carla simulator. Receiving data from Carla, Apollo controls the autonomous vehicle.
Apache License 2.0
53 stars 13 forks source link

About running the co-simulation in synchronous mode #12

Closed Cyrus-k closed 1 year ago

Cyrus-k commented 1 year ago

Hello developers, I would like to ask you a question about running in synchronous mode. When I used your bridge, I found something wrong with the ego car in the co-simulation if I run the script manual_control.py in synchronous mode. Ego car has a strong swing and finally it will crash off the road. But if I run the script without synchronous mode then the co-simulation goes well. I don't know why such things happened. Besides, I would like to know what kind of differences or changes you made in manual_control.py and manual_control_13.py. As for me, it seems like that I cannot run the manual_control_13.py correctly, the dreamview will keep flashing. Thanks for your patience.

MaisJamal commented 1 year ago

Thanks for your interest. You are correct, the control doesn't work well in the synchronous mode. This is mainly because when I tuned the control parameters, I ran Carla server/client in asynchronous mode. One of the advantages of running simulation in the asynchronous mode is that it has a higher frame rate, a higher frequency of applying the control commands is always better. For this reason, I have tuned control in this mode. So, as a conclusion, currently the Carla/Apollo bridge runs best in asynchronous mode, I recommend using it only in asynchronous mode.

The difference between manual_control.py and manual_control_13.py: manual_control_13.py was my first attempt to make the bridge, it has a lot of unnecessary code. So to make it easier for the user I got the default script manual_control.py from Carla simulator and added only few things:

  1. set damping_rate_zero_throttle_clutch_engaged in physics_control to 0.35. (necessary step)
  2. set the host and port automatically by the bridge. (necessary step)
  3. set _actor_filter to 'vehicle.lincoln.mkz_2017' (necessary step)
  4. set the weather in the simulation to CloudyNoon, which requires minimum GPU resources of all weather modes. So, by this, you can run any Carla script that you need, you just have to add the previously mentioned things to your script. There is no need anymore to use manual_control_13.py
Cyrus-k commented 1 year ago

Thank you for your reply. I still have some questions about your modified map. Now I run the whole co-simulation in map Town01 and I found that there are four junctions which have traffic lights. As I see the raw file base_map.txt of Town01, I found that you finished 12 signals and 12 junctions. That made such 4 junctions with traffic lights and some junctions with no traffic light. I would like to know whether you added the 12 signals and the junctions by manual. If you use some kind of tools instead of adding signal, overlap code in base_map.txt directly, I would like to know what the tool is. As for me, I would like to add some more traffic lights in this map but I found that if I imitate your way( the already added signals ), it is a little complicated. Apart from that, do I need to judge the positions of traffic lights I added are the same as they are in Carla maps accurately or It allows some error? After I added that traffic lights, will ground truth still work well for new added ones? Can you give me some instructions? Thank you very much for your patience.

MaisJamal commented 1 year ago

I have added 12 signals to the map manually. I first get their location from Carla, then I adjust the value on Y by multiplying by (-1). As the locations of signals are ready, I use a script to auto generate the text of signals to be added to base_map.txt. However, after that I still have to find the id of the lanes that overlap with the signal and define the start s and end s of the overlap with the lane that come immediately before the signal. I get the id and s start and end by sending a routing request on the lane of interest and then monitoring these values in cyber_monitor. The final step, to enable ground truth of the added signal, is to map the signal's location in Carla with the name of the signal in base_map. The mapping is implemented in msg_getters in the bridge. If you are willing to collaborate and add more signals to the base map, I can provide you with the material I have, just let me know via email.

Cyrus-k commented 1 year ago

Sure, I am willing to collaborate and add more signals to the base map. My email is cyruslvk99@gmail.com, and I am looking forward to your current material. By the way, did you use Apollo's script add_signal.py to add signal to base_map.txt?

MaisJamal commented 1 year ago

I haven't used Apollo's script add_signal.py .