apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Question regarding how a message is created to how it is published

Open ghost opened this issue 8 years ago • 2 comments

I’m trying to understand the flow code-wise starting with how a message is created by a module and ending with the publishing of it. I cannot comprehend how this works. For example, where is a PerceptionObstacle protobuf message created inside the perception module, which scripts are involved in creating it and which script is publishing it? It seems like some adapter files are involved but I cannot figure out in what way.

Best Regards

ghost avatar Mar 02 '18 08:03 ghost

Firstly, Apollo is based on ROS. You need to get familiar with ROS. The page explains how ROS send/receive message: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29. Apollo uses AdapterManager to handle messages. For each kind of message, it contains methods to receive/publish the message. For each module, you can see its Start() method to see how its adapter is initialized (reading the module config file and proto definination file). Taking the localization module as example, refer to msf_localization.cc, Start() method init the AdapterManager, register the message receiver callback. In the callback methods, they process the received message and publish localiztion message. BTW, you can compile Apollo code with debug info (add compile flags for debugging), then debug the code to find how it works.

wqqn avatar Mar 03 '18 13:03 wqqn

Thank you!

ghost avatar Mar 23 '18 11:03 ghost