-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timestamp baisis in callback mode #3942
Comments
@ztorok , according to the log the metadata is properly configured. But there are certain things in the code that need to be addressed/clarified:
realSenseConfig.enable_stream(RS2_STREAM_INFRARED, 640, 480, RS2_FORMAT_Y8, 30);
realSenseConfig.enable_stream(RS2_STREAM_ACCEL, RS2_FORMAT_MOTION_XYZ32F, 250);
realSenseConfig.enable_stream(RS2_STREAM_GYRO, RS2_FORMAT_MOTION_XYZ32F, 400); The second time you run with Librealsense-recommended config which selects Depth+IR+Accel+Gyro . This time you work with synchronous // Declare RealSense pipeline, encapsulating the actual device and sensors
rs2::pipeline pipe;
// Start streaming with default recommended configuration
pipe.start();
... Is this on purpose, and if so - what is it?
for (const auto &fr : frameset)
{
if (auto vf = fr.as<rs2::video_frame>())
{ for (auto&& frame : pipe.wait_for_frames())
{
// We can only save video frames as pngs, so we skip the rest
if (auto vf = frame.as<rs2::video_frame>())
{
There is a good chance that after taking a second look into the code you'll be able to resolve the issue. |
Thanks @ev-mp. The problem is that the frame.get_timestamp() function returns inconsistent timestamps for motion and video frames. See following log: As you can see, the motion frame timestamp is generated from hardware clock, whereas the IR frame gets system time. I generated this log basically with the same code as my asynchronous example by printing out the frame information in the callback:
I was trying to use the rs-save-to-disk example to easily reproduce my issue and noticed that it can access the metadata I need for the video frame, which is the sensor timestamp. However, it seems to me that difference in the amount of metadata wasn't because of the synchronous/asynchronous modes, but because of the different streams I used: depth vs. IR. |
@ztorok hi,
Inspecting the script's output will tell whether the initial installation went well by reporting that no changes were needed. Otherwise you'll see that new registry keys were generated. After running the script follow the instructions, replug the camera and repeat the timestamps check with |
@ev-mp Thanks. Unfortunately, my PC doesn't allow the execution of the registry script, even though I started PowerShell as administrator:
So I followed the manual prodedure. |
@ev-mp So, I ran the script, but it didn't seem to change anything:
And the IR streams show system time, whereas the depth hardware clock: |
The snapshot suggests that the metadata registry key for IR endpoint was not set properly, and since it was done manually - there are chances for typos/mismatches.
Then once again - reconnect the camera and check the timestamps. |
@ztorok, according to the report
there are discrepancies - each registry entry two keys should be set:
It seem that after the manual addition/removal of registry entries there are still some leftovers/inconsistencies that prevent the automation script to run properly.
If all the above fails then I'd suggest to revert the registry to the state before the changes by using Windows recovery points and then again rerun the automation script. |
@ev-mp Thanks, I can confirm that by adding the missing MetadataBufferSizeInKB1 entries in the registry solves the wrong timestamp domain. |
@ztorok , thanks for the update. |
I also encountered a similar problem. I used the rs-callback in the example to obtain IMU and depth data, and found that when printing their timestamps at the same time, the depth data is about 25-30ms earlier than the IMU data.why?How to make them aligned |
Issue Description
I'm trying to align IR frames with IMU measurements, but I can't figure out how to read out the frames and IMU with the same time stamp basis (hardware clock, instead of system time).
I have followed this issue and did everything as described, but it didn't solve my issue: #3205
I modified the rs-save-to-disk.cpp example as follows:
`int main(int argc, char * argv[]) try
{
// Declare depth colorizer for pretty visualization of depth data
rs2::colorizer color_map;
}
catch(const rs2::error & e)
{
std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch(const std::exception & e)
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}`
The two generated files have the following content:
No 1.:
Stream,Infrared
Metadata Attribute,Value
Time Of Arrival,1557408861706
Backend Timestamp,1557408861682
Actual Fps,30
No 2.:
Stream,Depth
Metadata Attribute,Value
Frame Counter,31
Frame Timestamp,2011290813
Sensor Timestamp,2011289961
Actual Exposure,1704
Gain Level,16
Auto Exposure,1
Time Of Arrival,1557408863824
Backend Timestamp,1557408863794
Actual Fps,30
Frame Laser Power,150
Frame Laser Power Mode,1
Exposure Priority,1
Exposure Roi Left,160
Exposure Roi Right,1120
Exposure Roi Top,90
Exposure Roi Bottom,630
Basically, the issue is that I don't get the "Sensor Timestamp" metadata when I start the RealSense in callback mode.
Any help is much appreciated.
The text was updated successfully, but these errors were encountered: