DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Relative Egomotion Workflow
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.



To initialize motion model certain parameters, such as imu calibration or vehicle data, must be passed to the module. These parameters can be extracted from a dwRig module, see Rig Configuration Hence a typical initialization code sequence will look like this:

// read vehicle configuration
dwRig_initializeFromFile(&rig, sdkContext, "path/to/rig.json");
const dwVehicle *vehicle = nullptr;
dwRig_getVehicle(&vehicle, rig);
// get IMU sensor from the vehicle configuration
uint32_t imuIdx = 0;
dwRig_findSensorByName(&imuIdx, "imu.xsens", rig);
// setup motion model
params.vehicle = *vehicle;
params.sensorParameters.imuSamplingRate = 100.f;
dwRig_getSensorToRigTransformation(&params.imu2rig, imuIdx, rig);
// initialize egomotion module
dwEgomotion_initialize(&egomotion, &params, sdkContext);

Run-time filter update and motion estimation

At runtime the estimator has to be filled with input measurements. The following shows the sequence in a typical application using the Egomotion module:

// read and parse CAN messages for odometry information
if (hasCANMessage())
float32_t steering = 0;
float32_t velocity = 0;
dwTime_t timestamp = 0;
if (parseCAN(steeringAngle, velocity, timestamp))
// read IMU measurements
if (hasIMUMeasurement())
dwEgomotion_addIMUMeasurement(getIMUFrame(), egomotion);
// update filter every 10 milliseconds
// note: one can also perform auto-update by setting dwEgomotionParameters.automaticUpdate = true
if (timePassedSinceLastUpdate >= 10000)
dwEgomotion_update(getCurrentTime(), egomotion);
// query filter for a relative motion since last request
dwTransformation3f motionLastToNow;
dwEgomotion_computeRelativeTransformation(&motionLastToNow, getLastTime(), getCurrentTime(), egomotion);
// query filter for the latest known absolute estimation
dwEgomotionResult estimation;
dwEgomotion_getEstimation(&estimation, motion);

This workflow is demonstrated in the following sample: Egomotion Sample