mavlink / c_uart_interface_example

Simple MAVLink to UART interface example for *nix systems
264 stars 257 forks source link

Delayed Sensor Data #23

Closed Dalton0022 closed 6 years ago

Dalton0022 commented 7 years ago

So I am trying to run a terrain mapping algorithm using pixHawk IMU data and a line scanning LIDAR. Needless to say I am using this code to pull data from the PixHawk. I also have a way to record data from the LIDAR. A problem occurs with the synchronization of the two sensors.... My system works like this:

1) Initialize the sensors and get them streaming data but do not start recording data. 2)When all sensors are ready I start grabbing and recording the most current messages from all both sensors at once. (trying to get close to synced) 3)When the test is done I stop both sensors together and disconnect.

The time stamps I create when recording tell me that my sensors do in-fact start and stop at the same time and are running at about the same sampling rate. However when I go to create a point cloud from the data the only way to make something even half decent is to trim the start of the pixHawk data like shown below: image This was a quick test where I tried to turn the pixHawk 90 degrees every 5 seconds.... as you can see its about .75-1.25 seconds off at every turn (exception on the first turn when I jumped the gun).

Since I am still getting the correct length of time from both sensors, this makes me feel like the "current" messages being grabbed and recorded from the pixHawk are actually delayed by about a second.... I guess this would be more an internal pixHawk problem than a problem with this code itself but is anyone else getting similar or better results? Is this a normal time delay to get messages from the pixHawk? Any thoughts to fix this would be appreciated.

Thanks