ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.25k stars 9.72k forks source link

how can I get USB camera unix timestamp #12691

Open geiliwanghaichao opened 4 years ago

geiliwanghaichao commented 4 years ago

In the apollo5.0 code, when the USB camera gets a frame of data, I see this description (modules/drives/camera/usb_cam.cc): len = buf.bytesused; raw_image->tv_sec = static_cast(buf.timestamp.tv_sec); raw_image->tv_usec = static_cast(buf.timestamp.tv_usec); As far as I know, this time is the elapsed time from when the system is started to when the data frame is received. This time is not a unix timestamp. In the apollo architecture, there are many sensors. To ensure that the time of these sensors is synchronized, each sensor must have a unified time stamp. How does the camera do this, or how to get the time stamp of one frame of camera data. Thank you very much!

daohu527 commented 4 years ago

In fact, the system has no way to obtain the time of shooting this frame. Just as you take a picture with a mobile phone, the displayed system time is the time of the current picture. The system obtains the time through the usb driver, and the driver runs on the operating system.

synchronize

Here are some ways to synchronize the camera

  1. Some cameras have trigger function, multiple cameras use triggers to take photos together.
  2. The time from shooting to imaging is affected by the start time, frame rate, exposure time, etc. The first thing that can be done is to increase the frame rate, and then test to make up for the time of each camera.
oska874 commented 4 years ago

Buy baidu's sensorbox then you can get shooting time.