Recording IMU Data and Playback

Please provide the following info (check/uncheck the boxes after clicking “+ Create Topic”):
Software Version
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
[+] NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version
other

Target Operating System
[+] Linux
QNX
other

Hardware Platform
[+] NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
[+] 1.5.0.7774
other

Host Machine Version
[+] native Ubuntu 18.04
other

Hello,

I’ve created a custom IMU plugin and .so file. The plugin is working great with real-time IMU data. I want to record the IMU data and then playback using my plugin just like sample_imu_logger using sample binary file.

How do I create my own binary file to decode it using my .so file?

  • I tried logging IMU data into a text file. (candump slcan0 > log_file)
  • Convert the text to binary. (xxd -r -p log_file > log_file.bin)
  • When i try to run sample_imu_logger and provide the path to this new binary file and my plugin.so, i get an error saying no seek table found.

What is the right way of doing this? can you please direct me to the documentation if any?

Thanks in advance.

Regards,
Rishit

Hi @rborad ,
Could you take a look at Driveworks plugin for an IMU integrated GNSS? His imu plugin seems to work well. Maybe some information there will help you.

Hi @VickNV ,

Thank you for the reply. The link you shared is useful. However, I am getting error when I am using the capture tool ./recorder or ./recorder-tui. I tried running the recorder both when the sample_logger is running and not running. I am also attaching config.json that i am providing to the recorder. Can you please advise?

Thanks in advance.

Errors:

root@tegra-ubuntu:/usr/local/driveworks-2.2/tools/capture# ./recorder-tui /home/nvidia/Desktop/recordNew.json
- Rig recordNew.json
Copying rigs and setup code…
Platform setup…
Running disk bandwidth sanity checks

ERROR: No valid mounts

root@tegra-ubuntu:/usr/local/driveworks-2.2/tools/capture# ./recorder /home/nvidia/Desktop/recordNew.json
[30-04-2021 22:27:12] Platform: Detected DDPX - Tegra A
[30-04-2021 22:27:12] TimeSource: monotonic epoch time offset is 1619818835298100
[30-04-2021 22:27:12] PTP Time is available from NVPPS Driver
terminate called after throwing an instance of ‘dw::core::CudaException’
what(): Platform: cannot acquire CUDA context, error cudaErrorNoDevice: no CUDA-capable device is detected
Aborted (core dumped)

recordNew.json (4.3 KB)

FYI, I am able to run ./sample_imu_logger using following command successfully:

./sample_imu_logger --driver=imu.custom --params=decoder-path=/home/nvidia/Desktop/Plugin/libopenimu_plugin.so,can-proto=can.socket,device=can1,packetRate=1,packetType=15

It seems your system has no dGPU so you don’t need “export CUDA_VISIBLE_DEVICES=1”. Which was removed in DriveWorks 3.5 document page.

Thank you for the reply. That was it. I was able to get the recording tool to work. It created the bin and bin.seek files. However, When i use it with my ./sample_imu_logger, i do not see IMU data. What am I doing wrong here?

Please find the log when I run these commands and also .bin and .bin.seek attached here.
can_vehicle.bin (903.7 KB) can_vehicle.bin.seek (1.5 KB)

Recording:

root@tegra-ubuntu:/usr/local/driveworks/tools/capture# ./recorder /home/nvidia/Desktop/recordNew.json
[03-05-2021 16:42:34] Platform: Detected DDPX - Tegra A
[03-05-2021 16:42:34] TimeSource: monotonic epoch time offset is 1620057927380621
[03-05-2021 16:42:34] PTP Time is available from NVPPS Driver
[03-05-2021 16:42:34] Platform: number of GPU devices detected 1
[03-05-2021 16:42:34] Platform: currently selected GPU device integrated ID 0
[03-05-2021 16:42:35] SDK: Resources mounted from /usr/local/driveworks-2.2/data/
[03-05-2021 16:42:35] SDK: Create NvMediaDevice
[03-05-2021 16:42:35] egl::Display: found 1 EGL devices
[03-05-2021 16:42:35] egl::Display: use drm device: drm-nvdc
[03-05-2021 16:42:35] TimeSource: monotonic epoch time offset is 1620057927380621
[03-05-2021 16:42:35] PTP Time is available from NVPPS Driver
[03-05-2021 16:42:35] Initialize DriveWorks SDK v2.2.3136
[03-05-2021 16:42:35] Release build with GNU 7.3.1 from heads/buildbrain-branch-0-gca7b4b26e65 against Drive PDK v5.1.6.1
[03-05-2021 16:42:35] Platform: currently selected GPU device integrated ID 0
[03-05-2021 16:42:35] Loading rig file: /home/nvidia/Desktop/recordNew.json
[03-05-2021 16:42:35] SensorFactory::createSensor() → can.socket, device=can1,packetRate=1,packetType=15
Rig: recordNew.json NewSink: /dev/null
[03-05-2021 16:42:35] CANSocket: use SW based timestamps for can1
[03-05-2021 16:42:35] CANSocket: started can1
[03-05-2021 16:42:35] SensorManager: started
Press s to start, just to see progress, q to quit.

Rig: recordNew.json Sensor: can:vehicle Bytes: 636200
Rig: recordNew.json EndOfSensorsInfo
s
Rig: recordNew.json NewSink: .
Rig: recordNew.json Sensor: can:vehicle Bytes: 2216
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 120464
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 149168
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 175454
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 199712
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 225920
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 250334
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 275138
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 464288
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 564440
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 658352
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 778160
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 795008
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 800546
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 809048
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 812870
Rig: recordNew.json EndOfSensorsInfo

Rig: recordNew.json Sensor: can:vehicle Bytes: 817472
Rig: recordNew.json EndOfSensorsInfo
q
[03-05-2021 16:43:26] Sensor statistics for: can.socket, device=can1,packetRate=1,packetType=15
[03-05-2021 16:43:26] Events: 0
Errors: 0
Drops: 0
minDelta: 373.0000000
maxDelta: 8652.0000000
meanDelta: 2499.847900
Standard deviation: 3361.369873
[03-05-2021 16:43:26] SensorManager: stopped
[03-05-2021 16:43:26] IndexTable: saving to file “/usr/local/driveworks-2.2/tools/capture/can_vehicle.bin.seek”
[03-05-2021 16:43:26] Releasing Driveworks SDK Context
[03-05-2021 16:43:26] SDK: Release NvMediaDevice
[03-05-2021 16:43:27] SDK: Release NvMedia2D

Play Recording:

/usr/local/driveworks/bin$ ./sample_imu_logger driver=imu.virtual --params=file=/usr/local/driveworks/tools/capture/can_vehicle.bin,decoder-path=/home/nvidia/Desktop/Plugin/libopenimu_plugin.so
[03-05-2021 16:46:56] Platform: Detected DDPX - Tegra A
[03-05-2021 16:46:56] TimeSource: monotonic epoch time offset is 1620057927380620
[03-05-2021 16:46:56] PTP Time is available from NVPPS Driver
[03-05-2021 16:46:57] Platform: number of GPU devices detected 1
[03-05-2021 16:46:57] Platform: currently selected GPU device integrated ID 0
[03-05-2021 16:46:57] SDK: Resources mounted from /usr/local/driveworks-2.2/data/
[03-05-2021 16:46:57] SDK: Create NvMediaDevice
[03-05-2021 16:46:57] egl::Display: found 1 EGL devices
[03-05-2021 16:46:57] egl::Display: use drm device: drm-nvdc
[03-05-2021 16:46:57] TimeSource: monotonic epoch time offset is 1620057927380621
[03-05-2021 16:46:57] PTP Time is available from NVPPS Driver
[03-05-2021 16:46:57] Initialize DriveWorks SDK v2.2.3136
[03-05-2021 16:46:57] Release build with GNU 7.3.1 from heads/buildbrain-branch-0-gca7b4b26e65 against Drive PDK v5.1.6.1
[03-05-2021 16:46:57] SensorFactory::createSensor() → imu.virtual, file=/usr/local/driveworks/tools/capture/can_vehicle.bin,decoder-path=/home/nvidia/Desktop/Plugin/libopenimu_plugin.so
[03-05-2021 16:46:57] IMUVirtual: File Magic number: 3320769266 Version: 2
[03-05-2021 16:46:57] IMUVirtual: the file appears to be of non-binary format, try Xsens NMEA ASCII type.
[03-05-2021 16:46:57] IndexTable: loading from file “/usr/local/driveworks/tools/capture/can_vehicle.bin.seek”
[03-05-2021 16:46:57] IMU: seek table with 47 entries covering 11863 events ranging from 1620060177054410 to 1620060206706051 usecs
IMU end of stream reached
[03-05-2021 16:46:57] Releasing Driveworks SDK Context
[03-05-2021 16:46:57] SDK: Release NvMediaDevice
[03-05-2021 16:46:57] SDK: Release NvMedia2D

These are suspicious messages. Could you share your recordNew.json?

Please refer to Sensor plugin (IMU, GPS) and recorder tool. The developer didn’t encounter the issue with his imu plugin. Maybe you can check if any difference.

Please find it here. Thanks for the reply.
Rishit

As the topic pointed out in my previous post, you need to use imu.custom protocol to access the custom imu.
You can also check the follow document pages:

Thank you for the quick response and custom imu tip. My following command works.

./sample_imu_logger --driver=imu.custom --params=decoder-path=/home/nvidia/Desktop/Plugin/libopenimu_plugin.so,can-proto=can.virtual,packetRate=1,packetType=15,file=/usr/local/driveworks/tools/capture/can_vehicle.bin

Hopefully this is the last item i want your help with. I’ve configured my IMU to send out 3 messages at 200hz. I am recording for about 30 seconds. But my playback shows only repeat packets. Is that expected?

Edit: I think the recorder is capturing only few sample and playing them in loop. I just tried recording only Acceleration messages and it captured 5 messages and playing them in loop.

[1620083123204899] Gyro(X:-0.5625 Y:0.335938 Z:-0.5 )
[1620083123213922] Orientation(R:-250 P:-250 Y:0 )
[1620083123195043] Gyro(X:-0.15625 Y:0.164062 Z:-0.515625 )
[1620083123203780] Orientation(R:-250 P:-250 Y:0 )
[1620083123204335] Acceleration(X:0.130005 Y:0.039978 Z:9.92999 )
[1620083123204899] Gyro(X:-0.5625 Y:0.335938 Z:-0.5 )
[1620083123213922] Orientation(R:-250 P:-250 Y:0 )
[1620083123195043] Gyro(X:-0.15625 Y:0.164062 Z:-0.515625 )
[1620083123203780] Orientation(R:-250 P:-250 Y:0 )
[1620083123204335] Acceleration(X:0.130005 Y:0.039978 Z:9.92999 )
[1620083123204899] Gyro(X:-0.5625 Y:0.335938 Z:-0.5 )
[1620083123213922] Orientation(R:-250 P:-250 Y:0 )
[1620083123195043] Gyro(X:-0.15625 Y:0.164062 Z:-0.515625 )
[1620083123203780] Orientation(R:-250 P:-250 Y:0 )
[1620083123204335] Acceleration(X:0.130005 Y:0.039978 Z:9.92999 )
[1620083123204899] Gyro(X:-0.5625 Y:0.335938 Z:-0.5 )
[1620083123213922] Orientation(R:-250 P:-250 Y:0 )
[1620083123195043] Gyro(X:-0.15625 Y:0.164062 Z:-0.515625 )
[1620083123203780] Orientation(R:-250 P:-250 Y:0 )
[1620083123204335] Acceleration(X:0.130005 Y:0.039978 Z:9.92999 )
[1620083123204899] Gyro(X:-0.5625 Y:0.335938 Z:-0.5 )
[1620083123213922] Orientation(R:-250 P:-250 Y:0 )
[1620083123195043] Gyro(X:-0.15625 Y:0.164062 Z:-0.515625 )
[1620083123203780] Orientation(R:-250 P:-250 Y:0 )
[1620083123204335] Acceleration(X:0.130005 Y:0.039978 Z:9.92999 )

Please see if you can debug this further by adding some messages in your plugin. Thanks.