Apollo: Timestamp Inconsistent for different channels

Created on 2 Feb 2021  ·  6Comments  ·  Source: ApolloAuto/apollo

Hello,

I am using cyber_monitor to see the data transferred via cyberRT. It seems to me that data from different channels tend to have different timestamps. I guess the timestamps should be exactly the same for all channels? How could I synchronize them?

differ_time

Cyber

Most helpful comment

I don’t think there is a high probability, because every task is a coroutine unless you have a small number of CPU cores

All 6 comments

The timestamp represents the time of the current module, for example, the message will pass A-> B-> C 3 modules. So if a message in A at 1s, and the calculation took 200ms, then the time of module B is 1.2s, if B module cost 500ms, then C module's time is 1.7s.

So take my screenshot as an example, the message passes through lidar at 1612206032,027 and then it comes to pose at 1612206098,38. The information of pose is over 60 second behind lidar?

Since the definition of timestamp is completely different from 'current_time', how could I get information of exact same time point from all channels?

The localization/pose set the timestamp through
https://github.com/ApolloAuto/apollo/blob/a29a563e95944b603ab9be338cce46e6486a89be/modules/localization/rtk/rtk_localization.cc#L188-L195

The compensator/PointCloud2
https://github.com/ApolloAuto/apollo/blob/06253f8cde316be183c5aa37815d6769bc1b8da0/modules/drivers/lidar/velodyne/compensator/compensator.cc#L77-L81

Next

I‘m not sure that which localization method you used. If it is RTK, then they have different ways of obtaining time. Need to confirm whether this's the problem

Thanks! I need some time to look into cpp code.

I am using the default method in r6.0.0 version which is set to be MSF.

syntax = "proto2";

package apollo.localization;

message LocalizationConfig {
  enum LocalizationType {
    RTK = 0;
    MSF = 1;
  };
  optional LocalizationType localization_type = 1;
}

And currently I choose a dummy way of using time.time() to manually assign the time in listener.py. However, it slows down the simulation.

cyber_start_time = time.time()

def lidar_callback(data):
    global cyber_start_time
    current_time = time.time()
    timestamp = str(current_time - cyber_start_time)

My question for this temporary solution:

Will a complex listener.py affect the performances of apollo modules (localizaton, prediction, routing...etc)?

I don’t think there is a high probability, because every task is a coroutine unless you have a small number of CPU cores

Thanks for your feedback! Then for now I will go with the python solution. Since tt takes me longer to understand cpp code, I will update here once I locate the problem.

Was this page helpful?
0 / 5 - 0 ratings