Hi, I have 2 questions.
1) What is meant by reality mode? Is it the mode when Apollo is installed on a real car? And what changes between reality mode and not?
2) What is the difference between work_wheel and assistant_wheel in the TimingWheel class?
Here are some ideas for reference.
- What is meant by reality mode? Is it the mode when Apollo is installed on a real car? And what changes between reality mode and not?
"reality mode" is true by default. If it is set to false, the cyber will not even create nodes and the timer will not work too. That means you can't send msg, but the component can handle proc by itself, so I think it is used for unit test or some test cases when set false.
- What is the difference between work_wheel and assistant_wheel in the TimingWheel class?
If you are familiar with the time wheel, then this is a multi-level time wheel structure, which is similar to the concept of seconds and minutes. After 60 seconds, the minute will advance 1.
assistant_wheel (64) <- work_wheel (512)
work_wheel is 1024ms period(almost 1s), and assistant_wheel is 64*1024ms period(almost 1min)
@daohu527 thanks. Why in timer.cc there Is AddTask call function twice in with the same task?
Can be understood like this.
After the task is done, put it in the next period bucket.
https://github.com/ApolloAuto/apollo/blob/55fe6dab85b48220f9f9cc2a0266fb21fc16f64f/cyber/timer/timer.cc#L122-L124
Add the source task into time wheel, and then repeat the above process
https://github.com/ApolloAuto/apollo/blob/55fe6dab85b48220f9f9cc2a0266fb21fc16f64f/cyber/timer/timer.cc#L135-L137
1.So, here put the task in the time wheel to be processed.
- After the task is done, put it in the next period bucket.
https://github.com/ApolloAuto/apollo/blob/55fe6dab85b48220f9f9cc2a0266fb21fc16f64f/cyber/timer/timer.cc#L122-L124
The first code just add callback, not actually add task, so when do we start the task ?
The second code is used to add the above task into time wheel, we say the first root or parent task, then the callback will run, and cycle add task in callback, the whole process like this.
add first task -> time wheel
|
callback-> add itself into next bucket
In this function, we take the task in the current work wheel, but what does the Async function do?
What happens in the lines from 56 to 62?
It use for execute task callback, callback is a function point, then we run the callback through the function point.