Apollo: What is a node?

Created on 15 Sep 2020  ·  8Comments  ·  Source: ApolloAuto/apollo

Hi, I'm trying to understand deeply how works apollo. To work it needs to create a node. The node is unique for the istance, so for each car, or there are more node in the same car? When the node is created and in which file?

Cyber Help wanted

Most helpful comment

Hi @Turi30

You need to check out the source code of Cyber RT at /apollo/cyber/ especially /apollo/cyber/transport/receiver and /apollo/cyber/transport/transmitter folder.

There are three types of communication mechanism,

  • intra where messages are passed by shared pointers, (same module, different components),
  • shm where messages are passed by shared memory between processes (i.e. between modules)
  • rtps where messages are passed by socket connections, via network card. (different host)

For the example you just mentioned, the message between the planning module and the control module is saved in shared memory.

All 8 comments

Hi,

I'm still new to Apollo but below is my understanding:

Apollo has many modules, such as perception, prediction, localization, routing, and control, etc. and they communicate via the CyberRT framework, which is similar to ROS.

Node is a functional unit that is able to publish and subscribe to certain channels in the CyberRT framework.
The concept is also similar to that in ROS.

Within each module, such as the perception module, there are many components i.e. Detection component, recognition component, and fusion component. Each component class has a node instance in it to perform communication with other components.

so to answer your first question: yes there should be more than one node, each performing different functionalities and communicating with each other.


Second Question:

You may check out this document, for a quick start on the Cyber RT framework.

In the beginning, you could simply use the high-level class cyber:: Component, to get started, the "Node" creation is already wrapped inside.

@ntutangyun Thank you very much. If it is not a problem I have an other question. For example, in the control module, if I'm not mistaken, there is only one component. In this file I don't see the node creation. Where the node is created in this module?

@ntutangyun Thank you very much. If it is not a problem I have an other question. For example, in the control module, if I'm not mistaken, there is only one component. In this file I don't see the node creation. Where the node is created in this module?

The ControlComponent inherits from the TimerComponent and the node creation is done in the Initialize function of TimerComponent.

@changsh726 Ok thanks.
1) The components communicate through nodes. A component create a writer and write in own node and if an other component wants to read there topic create a reader in own node. It is right?
2) In which kind of data structure the message is stored? what is the class where the "real" message is written?

@changsh726 Ok thanks.

  1. The components communicate through nodes. A component create a writer and write in own node and if an other component wants to read there topic create a reader in own node. It is right?
  2. In which kind of data structure the message is stored? what is the class where the "real" message is written?

One node can contains more than one writer and reader , If you want to read , you need create a reader which corresponds to unique channel, at the other hand , if you need more channel, you will need more reader.

@changsh726 Ok thanks.

  1. The components communicate through nodes. A component create a writer and write in own node and if an other component wants to read there topic create a reader in own node. It is right?
  2. In which kind of data structure the message is stored? what is the class where the "real" message is written?

One node can contains more than one writer and reader , If you want to read , you need create a reader which corresponds to unique channel, at the other hand , if you need more channel, you will need more reader.

I understood this. My issue is how works the communication between two nodes. For example, the planning component writes the trajectory through a writer in the planning node and the control module reads this trajectory with a readers in the module node, but this message where is stored? what are the class and the data structure to do it?

Hi @Turi30

You need to check out the source code of Cyber RT at /apollo/cyber/ especially /apollo/cyber/transport/receiver and /apollo/cyber/transport/transmitter folder.

There are three types of communication mechanism,

  • intra where messages are passed by shared pointers, (same module, different components),
  • shm where messages are passed by shared memory between processes (i.e. between modules)
  • rtps where messages are passed by socket connections, via network card. (different host)

For the example you just mentioned, the message between the planning module and the control module is saved in shared memory.

Hi @Turi30 , it seems that your issue is resolved. So I am going to close this issue now. If you have other questions, please feel free to create a new issue.

Thanks everyone for supporting Apollo!

Was this page helpful?
0 / 5 - 0 ratings