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.4.1.7402
other
Host Machine Version
native Ubuntu 18.04
other
Hi,
we are having trouble with using SensorManager on Drive AGX Pegasus in combination with a CAN-based IMU-Sensor Plugin. Here is an example of the code:
int main (int argc, char** argv)
{
dwContextHandle_t m_ctx = DW_NULL_HANDLE;
dwSALHandle_t m_sal = DW_NULL_HANDLE;
dwSensorManagerHandle_t m_sm = DW_NULL_HANDLE;
dwContextParameters sdkParams = {};
dwInitialize(&m_ctx, DW_VERSION, &sdkParams);
dwSAL_initialize(&m_sal, m_ctx);
dwSensorManager_initialize(&m_sm, 1000, m_sal);
std::string protocol = "imu.custom";
std::string params = "decoder-path=libimu_plugin.so,can-proto=can.socket,device=can2";
dwSensorParams sensorParams{};
sensorParams.parameters = params.c_str();
sensorParams.protocol = protocol.c_str();
dwSensorManager_addSensor(sensorParams, 0, m_sm);
dwSensorManager_start(m_sm);
dwStatus ret = DW_SUCCESS;
const dwSensorEvent* event = nullptr;
while (ret == DW_SUCCESS || ret == DW_TIME_OUT)
{
ret = dwSensorManager_acquireNextEvent(&event, 1000, m_sm);
if (ret == DW_TIME_OUT)
{
std::cout << "timeout" << std::endl;
continue;
}
switch (event->type) {
case DW_SENSOR_CAMERA: break;
case DW_SENSOR_CAN: break;
case DW_SENSOR_RADAR: break;
case DW_SENSOR_TIME: break;
case DW_SENSOR_DATA: break;
case DW_SENSOR_COUNT: break;
case DW_SENSOR_LIDAR: break;
case DW_SENSOR_IMU:
{
std::cout << "received imu event" << std::endl;
break;
}
case DW_SENSOR_GPS:
{
std::cout << "received gps event" << std::endl;
break;
}
}
ret = dwSensorManager_releaseAcquiredEvent(event, m_sm);
}
dwSensorManager_stop(m_sm);
dwSensorManager_release(m_sm);
dwSAL_release(m_sal);
dwRelease(m_ctx);
return 0; }
On Host-PC this works fine:
christian@NvidiaHost:~$ ./install_isolated/lib/sensor_manager/minimal_example_node received imu event received imu event received imu event received imu event received imu event received imu event received imu event received imu event received imu event received imu event received imu event received imu event
On DRIVE AGX though, we get senor timeouts:
nvidia@tegra-ubuntu:~$ ./install_isolated/lib/sensor_manager/minimal_example_node timeout timeout timeout timeout timeout timeout timeout timeout timeout timeout timeout timeout
We can confirm via candump can2
that correct data is coming on can2-channel, in fact sample_imu_logger
works perfectly fine with our IMU-plugin on DRIVE AGX:
nvidia@tegra-ubuntu:~$ /usr/local/driveworks/bin/sample_imu_logger --driver=imu.custom --params=decoder-path=libimu_plugin.so,can-proto=can.socket,device=can2 [21-09-2019 03:11:22] Platform: Detected DDPX - Tegra A [21-09-2019 03:11:22] TimeSource: monotonic epoch time offset is 1569027512042074 [21-09-2019 03:11:22] PTP Time is available from NVPPS Driver [21-09-2019 03:11:24] Platform: number of GPU devices detected 2 [21-09-2019 03:11:24] Platform: currently selected GPU device discrete ID 0 [21-09-2019 03:11:24] SDK: Resources mounted from /usr/local/driveworks-2.2/data/ [21-09-2019 03:11:24] SDK: Create NvMediaDevice [21-09-2019 03:11:24] egl::Display: found 2 EGL devices [21-09-2019 03:11:24] egl::Display: use drm device: drm-nvdc [21-09-2019 03:11:24] TimeSource: monotonic epoch time offset is 1569027512042074 [21-09-2019 03:11:24] PTP Time is available from NVPPS Driver [21-09-2019 03:11:24] Initialize DriveWorks SDK v2.2.3136 [21-09-2019 03:11:24] Release build with GNU 7.3.1 from heads/buildbrain-branch-0-gca7b4b26e65 against Drive PDK v5.1.6.1 [21-09-2019 03:11:24] SensorFactory::createSensor() -> imu.custom, decoder-path=libimu_plugin.so,can-proto=can.socket,device=can2 [21-09-2019 03:11:24] SensorFactory::createSensor() -> can.socket, decoder-path=libimu_plugin.so,can-proto=can.socket,device=can2 [21-09-2019 03:11:24] CANSocket: Cannot get current state of hardware time stamping: ioctl(SIOCGHWTSTAMP, can2) -> Operation not supported [21-09-2019 03:11:24] CANSocket: software based timestamps will be used for can2 [21-09-2019 03:11:24] CANSocket: use SW based timestamps for can2 [21-09-2019 03:11:24] CANSocket: started can2 [1569028284963339] Orientation(R:-3.30422 P:0.931091 Y:-7.95033 ) OrientationQuaternion(X:-0.0281983 Y:0.0101013 Z:-0.0690613 W:0.997132 ) [1569028284963743] Gyro(X:0.002 Y:-0.002 Z:0.002 ) [1569028284964273] Acceleration(X:-0.117 Y:-0.5226 Z:9.8124 ) [1569028284964351] Magnetometer(X:-0.0527344 Y:0.90918 Z:-0.120117 ) [1569028284963339] Orientation(R:-3.30422 P:0.931091 Y:-7.95033 ) OrientationQuaternion(X:-0.0281983 Y:0.0101013 Z:-0.0690613 W:0.997132 ) [1569028284963743] Gyro(X:0.002 Y:-0.002 Z:0.002 ) [1569028284964273] Acceleration(X:-0.117 Y:-0.5226 Z:9.8124 ) [1569028284964351] Magnetometer(X:-0.0527344 Y:0.90918 Z:-0.120117 ) [1569028284963339] Orientation(R:-3.30422 P:0.931091 Y:-7.95033 ) OrientationQuaternion(X:-0.0281983 Y:0.0101013 Z:-0.0690613 W:0.997132 ) [1569028284963743] Gyro(X:0.002 Y:-0.002 Z:0.002 ) [1569028284964273] Acceleration(X:-0.117 Y:-0.5226 Z:9.8124 ) [1569028284964351] Magnetometer(X:-0.0527344 Y:0.90918 Z:-0.120117 ) [1569028284963339] Orientation(R:-3.30422 P:0.931091 Y:-7.95033 ) OrientationQuaternion(X:-0.0281983 Y:0.0101013 Z:-0.0690613 W:0.997132 ) [1569028284963743] Gyro(X:0.002 Y:-0.002 Z:0.002 ) [1569028284964273] Acceleration(X:-0.117 Y:-0.5226 Z:9.8124 ) [1569028284964351] Magnetometer(X:-0.0527344 Y:0.90918 Z:-0.120117 ) [1569028284963339] Orientation(R:-3.30422 P:0.931091 Y:-7.95033 ) OrientationQuaternion(X:-0.0281983 Y:0.0101013 Z:-0.0690613 W:0.997132 ) [1569028284963743] Gyro(X:0.002 Y:-0.002 Z:0.002 ) [1569028284964273] Acceleration(X:-0.117 Y:-0.5226 Z:9.8124 ) [1569028284964351] Magnetometer(X:-0.0527344 Y:0.90918 Z:-0.120117 ) [1569028284963339] Orientation(R:-3.30422 P:0.931091 Y:-7.95033 ) OrientationQuaternion(X:-0.0281983 Y:0.0101013 Z:-0.0690613 W:0.997132 ) [1569028284963743] Gyro(X:0.002 Y:-0.002 Z:0.002 ) [1569028284964273] Acceleration(X:-0.117 Y:-0.5226 Z:9.8124 ) [1569028284964351] Magnetometer(X:-0.0527344 Y:0.90918 Z:-0.120117 ) [1569028284963339] Orientation(R:-3.30422 P:0.931091 Y:-7.95033 ) OrientationQuaternion(X:-0.0281983 Y:0.0101013 Z:-0.0690613 W:0.997132 )
Strangely enough, a couple of days ago our code with SensorManager randomly started working on DRIVE AGX without changing anything in our program or our vehicle architecture. The next day, it did not work anymore. This is really strange behaviour and to me indicates memory problems somewhere in SensorManager.
In contrast, we have a custom GPS-plugin which is also CAN-based. The functionality of the plugin is basically the same to our IMU-plugin in that it reads data from CAN and translates it into a Sensorframe. For both plugins we used the sample code for GPS and IMU-plugins provided with Driveworks samples. The GPS-plugin works fine, both on Host-PC as well as on DRIVE-AGX.
How can it be that our IMU-plugin works fine with sample_imu_logger
but not with SensorManager on DRIVE-AGX? Does SensorManager somehow allocate Sensors differently in Memory? Why does it work on Host-PC but not on DRIVE AGX? Why does it work for GPS-Sensor but not for IMU-Sensor? I triple checked any potential source of error, to me this must be some bug within SensorManager.
Any help would be greatly appreciated.
Thanks,
Christian