ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.19k stars 9.71k forks source link

Control module is not working properly with Carla simulator #14532

Open MaisJamal opened 2 years ago

MaisJamal commented 2 years ago

Steps to reproduce the issue:

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

daohu527 commented 2 years ago

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
YuqiHuai commented 2 years ago

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.”

MaisJamal commented 2 years ago

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?

daohu527 commented 2 years ago

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

MaisJamal commented 2 years ago

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 commented 2 years ago

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

daohu527 commented 2 years ago

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.

MaisJamal commented 2 years ago

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

daohu527 commented 2 years ago

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
MaisJamal commented 2 years ago

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

daohu527 commented 2 years ago

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

kill -9 process_id
tyqdd2008 commented 2 years ago

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.

MaisJamal commented 2 years ago

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 commented 2 years ago

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 .

meua commented 1 year ago

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.

daidai-hua commented 11 months ago

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

"