apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Control module is not working properly with Carla simulator

Open MaisJamal opened this issue 3 years ago • 16 comments

  • OS Platform and Distribution (e.g., Linux Ubuntu 18.04): Ubuntu 20.04
  • Apollo version : 7.0

Steps to reproduce the issue:

  • I run Carla 0.9.6 in a container
  • I run Carla-Apollo-bridge which uses a docker image of cyber 5.0
  • I run Apollo 7.0
  • Apollo receives data from sensors and car location successfully and sends control commands, but there is something wrong in the control module, and the control sends messages at a very high FrameRatio up to 227 sometimes (delay of 0.01 sometimes) (in the video it's seen how it ranges).

I don't understand what can be the reason of this issue, is it the old cyber version taken from Apollo 5.0 that the bridge uses? is it a problem of synchronization between Apollo and Carla? or is it a difference in controlling method ? Can you please guide me how can I solve the problem?

Supporting materials:

Screenshot from 2022-07-13 12-07-53 Screenshot from 2022-07-22 16-35-21

https://user-images.githubusercontent.com/17913075/180448594-05db7217-244a-4169-bc20-73802f0345b8.mp4

MaisJamal avatar Jul 22 '22 13:07 MaisJamal

how do you start the control module, because the control module is a fixed frequency at 100hz, so it's strange that your frequency is 200.

You can first check if 2 duplicate nodes are started with the following command:

cyber_channel info /apollo/control

daohu527 avatar Jul 22 '22 16:07 daohu527

At the bottom of Carla-Apollo-bridge it says this feature has not been fully developed yet. Maybe some more implementation needs to be done?

“If the 'Control' module is enabled, the bridge will apply its output to the ego vehicle, but this feature has not been fully developed yet. So, the ego's movement may be erratic. The recommended way to use the bridge is to allow it to use the planner output for moving the vehicle.”

YuqiHuai avatar Jul 22 '22 16:07 YuqiHuai

I get this when I check info on apollo/control channel: roleid 10847432455655059976 hostname in-dev-docker processid 84078 nodename control msgtype apollo.control.ControlCommand roleid 10429887034953036268 hostname in-dev-docker processid 83404 nodename simulation_world msgtype apollo.control.ControlCommand

I run the module only in Apollo by running ./scripts/control.sh

and there is a reader in the bridge self.cyber_node = cyber.Node('carla_ego_node') self.cyber_node.create_reader('/apollo/control', ControlCommand, self.cyber_control_command_updated) how can the reader affect the frequency of the module?

MaisJamal avatar Jul 25 '22 07:07 MaisJamal

roleid 10429887034953036268 hostname in-dev-docker processid 83404 nodename simulation_world msgtype apollo.control.ControlCommand

Subscription relationship looks fine, simulation_world is a reader, unless you have changed the code in modules/dreamview/backend/simulation_world/simulation_world_service.cc.

and there is a reader in the bridge

I'm not sure if cyber_channel can view node information of other docker. But read does not affect frequency. Given that the controlcmd frequency is 10 hz, more information is needed to confirm

daohu527 avatar Jul 26 '22 03:07 daohu527

I rerun the bridge with Carla and Apollo, that's info on /apollo/control: /apollo/control roleid 14010369798453647908 hostname in-dev-docker processid 174211 nodename control msgtype apollo.control.ControlCommand roleid 11551628895366276832 hostname in-dev-docker processid 173279 nodename simulation_world msgtype apollo.control.ControlCommand roleid 7031878745251466668 hostname b6a03d6456c1 processid 6436 nodename carla_ego_node msgtype apollo.cyber.message.RawMessage roleid 13058548102520653475 hostname b6a03d6456c1 processid 6541 nodename MonitorReader6541-0 msgtype apollo.cyber.message.RawMessage

I didn't change anything in Apollo 7.0 when I run the bridge immediately all the frequencies change and especially control. if I run only the bridge and carla (without Apollo), I get the following: Screenshot from 2022-07-26 12-05-54 (1)

Is it possible that the change in the frequency of other modules is causing control module to run at a higher frequency?

MaisJamal avatar Jul 26 '22 09:07 MaisJamal

I checked the frequency of control while running Apollo with SVL, it ranges from 20 to 80. Also I made sure in carla-apollo bridge that the frequency of /apollo/canbus/chassis and /apollo/localization/pose is 10 hz and the control frequency is still very high more than 200 hz which I can't understand, shouldn't the frequency of the module control depend on the received frequencies of the chassis and position??

Can you please recommend any method of running Apollo with Carla with a correct control commands? as SVL simulator is not supported anymore

MaisJamal avatar Jul 26 '22 10:07 MaisJamal

which I can't understand, shouldn't the frequency of the module control depend on the received frequencies of the chassis and position??

No, you can run the control module independently, the control module runs in a timer at 100Hz, so you can start the control module in apollo and check the frequency if it's 100Hz or not. If not then we should check the problem with apollo control module.

daohu527 avatar Jul 26 '22 11:07 daohu527

I checked, I run just Apollo in SimControl mode and the frequency is 100 Hz. As seen in the pictures Chassis, Control and Localization modules are running in high frequencies. I should mention that I haven't changed anything in these modules or any others, I downloaded Apollo 7.0 and just added Carla maps.

Screenshot from 2022-07-28 10-28-58 Screenshot from 2022-07-28 10-29-38

please check this issue , it also says that the control frequency is 100

MaisJamal avatar Jul 28 '22 07:07 MaisJamal

The default frequency of control cmd is 100hz, I was wrong before

At the bottom of Carla-Apollo-bridge it says this feature has not been fully developed yet. Maybe some more implementation needs to be done? “If the 'Control' module is enabled, the bridge will apply its output to the ego vehicle, but this feature has not been fully developed yet. So, the ego's movement may be erratic. The recommended way to use the bridge is to allow it to use the planner output for moving the vehicle.”

Based on what you said above, the reason may be on these 2 nodes. It is best to look at the official documentation. In view of the above, there may be some problems with opening control cmd

roleid 7031878745251466668
hostname b6a03d6456c1
processid 6436
nodename carla_ego_node
msgtype apollo.cyber.message.RawMessage
roleid 13058548102520653475
hostname b6a03d6456c1
processid 6541
nodename MonitorReader6541-0
msgtype apollo.cyber.message.RawMessage

daohu527 avatar Jul 28 '22 07:07 daohu527

Can I kill a node in cyber? or is there a way to know if the node is a writer or reader? I found node carla_ego_node but I can't find the other

MaisJamal avatar Jul 28 '22 07:07 MaisJamal

Now that you have their process id, you can just kill the process.

kill -9 process_id

daohu527 avatar Jul 28 '22 15:07 daohu527

Hello, do you solve this problem? I also do the same job. Do you check the planning log? Is it possible it's not the control problem, but the planning problem.

tyqdd2008 avatar Aug 11 '22 13:08 tyqdd2008

I haven't solved the problem yet, I think the problem is in localization. the localization message is not sent correctly, but I don't know how to fix it

MaisJamal avatar Aug 22 '22 07:08 MaisJamal

I have fixed the localization message in the Carla-Apollo bridge that I am developing. The Control behavior is not perfect but it's better than before. The bridge repository is public now, I would be happy if anyone would like to test it and contribute to it .

MaisJamal avatar Nov 02 '22 21:11 MaisJamal

I haven't solved the problem yet, I think the problem is in localization. the localization message is not sent correctly, but I don't know how to fix it

The project https://github.com/guardstrikelab/carla_apollo_bridge also needs your help, invites you to experience the project, and looks forward to your contribution.

meua avatar Jun 08 '23 09:06 meua

how do you start the control module, because the control module is a fixed frequency at 100hz, so it's strange that your frequency is 200.

You can first check if 2 duplicate nodes are started with the following command:

cyber_channel info /apollo/control

is this right?

$ cyber_channel info /apollo/planning
/apollo/planning
        roleid           8673175451930075043
        hostname         in-dev-docker
        processid        3006835
        nodename         planning
        msgtype          apollo.planning.ADCTrajectory
        roleid           3530469501758800985
        hostname         in-dev-docker
        processid        3006301
        nodename         control
        msgtype          apollo.planning.ADCTrajectory
        roleid           10289177923654203951
        hostname         in-dev-docker
        processid        2996621
        nodename         simulation_world
        msgtype          apollo.planning.ADCTrajectory

"

daidai-hua avatar Nov 29 '23 09:11 daidai-hua