DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Egomotion.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2015-2020 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
61 #ifndef DW_EGOMOTION_EGOMOTION_H_
62 #define DW_EGOMOTION_EGOMOTION_H_
63 
64 #include <dw/core/Config.h>
65 #include <dw/core/Exports.h>
66 #include <dw/core/Context.h>
67 #include <dw/core/Types.h>
68 
70 
71 #include <dw/sensors/imu/IMU.h>
72 
73 #include <dw/rig/Rig.h>
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
79 typedef struct dwEgomotionObject* dwEgomotionHandle_t;
80 typedef struct dwEgomotionObject const* dwEgomotionConstHandle_t;
81 
83 typedef enum dwMotionModel {
120 
157 
158 } dwMotionModel;
159 
168 
189 
209 
217 
225 
229 typedef struct dwEgomotionLinearAccelFilterParams
230 {
232  dwEgomotionLinearAccelerationFilterMode mode;
233 
234  // Simple filter parameters (ignored for other modes)
241 
245 typedef struct
246 {
250 
274 
279 
281 
286 {
290 
294 
299 
303 
307 
310 
317 
319 
323 typedef struct dwEgomotionParameters
324 {
329 
336 
340 
342  dwMotionModel motionModel;
343 
348 
359 
362  uint32_t historySize;
363 
367  float32_t gyroscopeBias[3];
368 
375 
379 
386 
388 
392 typedef enum dwEgomotionDataField {
394 
398 
402 
406 
408 
413 typedef struct
414 {
416 
419 
420  float32_t linearVelocity[3];
421 
425  float32_t angularVelocity[3];
426 
427  float32_t linearAcceleration[3];
428 
429  int32_t validFlags;
431 
445 typedef struct
446 {
448 
449  float32_t linearVelocity[3];
450 
451  float32_t angularVelocity[3];
452 
453  float32_t linearAcceleration[3];
454 
456 
457  int64_t validFlags;
459 
463 typedef struct
464 {
468  bool valid;
470 
499  const char* imuSensorName, const char* canSensorName);
500 
517  uint32_t imuSensorIdx, uint32_t canSensorIdx);
518 
531 dwStatus dwEgomotion_initialize(dwEgomotionHandle_t* obj, const dwEgomotionParameters* params, dwContextHandle_t ctx);
532 
543 dwStatus dwEgomotion_reset(dwEgomotionHandle_t obj);
544 
556 dwStatus dwEgomotion_release(dwEgomotionHandle_t obj);
557 
580  float32_t measuredValue, dwTime_t timestamp,
581  dwEgomotionHandle_t obj);
582 
596 dwStatus dwEgomotion_addVehicleState(const dwVehicleIOState* state, dwEgomotionHandle_t obj);
597 
610 dwStatus dwEgomotion_updateVehicle(const dwVehicle* vehicle, dwEgomotionHandle_t obj);
611 
628 dwStatus dwEgomotion_addIMUMeasurement(const dwIMUFrame* imu, dwEgomotionHandle_t obj);
629 
643 dwStatus dwEgomotion_updateIMUExtrinsics(const dwTransformation3f* imuToRig, dwEgomotionHandle_t obj);
644 
674 dwStatus dwEgomotion_update(dwTime_t timestamp_us, dwEgomotionHandle_t obj);
675 
699  dwTime_t timestamp_us, dwEgomotionConstHandle_t obj);
700 
721  dwEgomotionRelativeUncertainty* uncertainty,
722  dwTime_t timestamp_a, dwTime_t timestamp_b,
723  dwEgomotionConstHandle_t obj);
724 
738 dwStatus dwEgomotion_getEstimationTimestamp(dwTime_t* timestamp, dwEgomotionConstHandle_t obj);
739 
751 dwStatus dwEgomotion_hasEstimation(bool* result, dwEgomotionConstHandle_t obj);
752 
765 dwStatus dwEgomotion_getEstimation(dwEgomotionResult* result, dwEgomotionConstHandle_t obj);
766 
781 dwStatus dwEgomotion_getUncertainty(dwEgomotionUncertainty* result, dwEgomotionConstHandle_t obj);
782 
794 dwStatus dwEgomotion_getHistorySize(size_t* num, dwEgomotionConstHandle_t obj);
795 
811  size_t index, dwEgomotionConstHandle_t obj);
812 
824 dwStatus dwEgomotion_getMotionModel(dwMotionModel* model, dwEgomotionConstHandle_t obj);
825 
826 //-----------------------------
827 // utility functions
828 
843  const dwTransformation3f* poseOld2New,
844  const dwTransformation3f* oldVehicle2World);
845 
866  float32_t* inverseSteeringR,
867  const dwIMUFrame* imuMeasurement,
868  dwEgomotionConstHandle_t obj);
869 
887  dwEgomotionHandle_t obj);
888 
906  dwEgomotionHandle_t obj);
907 
908 #ifdef __cplusplus
909 }
910 #endif
911 
912 #endif // DW_EGOMOTION_EGOMOTION_H_
DW_API_PUBLIC dwStatus dwEgomotion_getUncertainty(dwEgomotionUncertainty *result, dwEgomotionConstHandle_t obj)
Gets the latest state estimate uncertainties.
float32_t imuSamplingRateHz
If known this entry shall indicate expected sampling rate in [Hz] of the IMU sensor.
Definition: Egomotion.h:306
Suspension model type and parameters.
Definition: Egomotion.h:245
DW_API_PUBLIC dwStatus dwEgomotion_initParamsFromRig(dwEgomotionParameters *params, dwConstRigHandle_t rigConfiguration, const char *imuSensorName, const char *canSensorName)
Initialize egomotion parameters from a provided RigConfiguration.
NVIDIA DriveWorks API: Core Types
float float32_t
Specifies POD types.
Definition: Types.h:70
indicates validity of linearVelocity[0]
Definition: Egomotion.h:395
NVIDIA DriveWorks API: Rig Configuration
indicates validity of linearVelocity[2]
Definition: Egomotion.h:397
Fuses odometry model with IMU measurements to estimate motion of the vehicle.
Definition: Egomotion.h:156
indicates validity of linearAcceleration[1]
Definition: Egomotion.h:404
indicates validity of linearAcceleration[0]
Definition: Egomotion.h:403
dwEgomotionDataField
Defines flags that indicate validity of corresponding data in dwEgomotionResult and dwEgomotionUncert...
Definition: Egomotion.h:392
The state data.
Definition: VehicleIO.h:288
float32_t measurementNoiseStdevAcceleration
Standard deviation of measurement noise in acceleration [m/s^2].
Definition: Egomotion.h:239
DW_API_PUBLIC dwStatus dwEgomotion_addOdometry(dwMotionModelMeasurement measuredType, float32_t measuredValue, dwTime_t timestamp, dwEgomotionHandle_t obj)
Notifies the egomotion module of a new odometry measurement.
float32_t velocityFactor
CAN velocity correction factor which is read from can properties in rig file.
Definition: Egomotion.h:316
Models suspension as single-axis damped torsional spring.
Definition: Egomotion.h:223
bool valid
indicates whether uncertainty estimates are valid or not
Definition: Egomotion.h:468
DW_API_PUBLIC dwStatus dwEgomotion_addIMUMeasurement(const dwIMUFrame *imu, dwEgomotionHandle_t obj)
Adds an IMU frame to the egomotion module.
indicates validity of angularVelocity[0]
Definition: Egomotion.h:399
NVIDIA DriveWorks API: VehicleIO car controller
DW_API_PUBLIC dwStatus dwEgomotion_initParamsFromRigByIndex(dwEgomotionParameters *params, dwConstRigHandle_t rigConfiguration, uint32_t imuSensorIdx, uint32_t canSensorIdx)
Same as dwEgomotion_initParamsFromRig however uses sensor indices in rigConfiguration instead of thei...
indicates validity of angularVelocity[2]
Definition: Egomotion.h:401
Defines a single-precision quaternion.
Definition: Types.h:418
DW_API_PUBLIC dwStatus dwEgomotion_getEstimation(dwEgomotionResult *result, dwEgomotionConstHandle_t obj)
Gets the latest state estimate.
float32_t processNoiseStdevAcceleration
Square root of continuous time process noise covariance in acceleration [m/s^2 * 1/sqrt(s)].
Definition: Egomotion.h:237
dwEgomotionSpeedMeasurementType speedMeasurementType
Defines which velocity readings from dwVehicleIOState shall be used for egomotion estimation...
Definition: Egomotion.h:374
bool estimateInitialOrientation
When enabled, initial rotation will be estimated from accelerometer measurements. ...
Definition: Egomotion.h:347
DW_API_PUBLIC dwStatus dwEgomotion_addVehicleState(const dwVehicleIOState *state, dwEgomotionHandle_t obj)
Notifies the egomotion module of a changed vehicle state.
dwTime_t timeInterval
relative motion time interval [us]
Definition: Egomotion.h:467
int32_t validFlags
Bitwise combination of dwEgomotionDataField flags.
Definition: Egomotion.h:429
Holds egomotion uncertainty estimates for a relative motion estimate.
Definition: Egomotion.h:463
dwEgomotionLinearAccelerationFilterParams linearAccelerationFilterParameters
Linear acceleration filter parameters.
Definition: Egomotion.h:378
float32_t accNoiseDensityMicroG
Expected zero mean measurement noise of the linear accelerometer, also known as Noise Density [ug/sqr...
Definition: Egomotion.h:302
dwMatrix3f rotation
a 3x3 covariance of the rotation (order: roll, pitch, yaw) [rad]
Definition: Egomotion.h:465
NVIDIA DriveWorks API: Core Methods
float32_t measurementNoiseStdevSpeed
Standard deviation of measurement noise in speed [m/s].
Definition: Egomotion.h:238
float32_t lateralSlipCoefficient
Lateral slip coefficient [rad*s^2/m].
Definition: Egomotion.h:335
DW_API_PUBLIC dwStatus dwEgomotion_computeSteeringAngleFromIMU(float32_t *steeringAngle, float32_t *inverseSteeringR, const dwIMUFrame *imuMeasurement, dwEgomotionConstHandle_t obj)
Computes steering angle of the vehicle based on IMU measurement.
DW_API_PUBLIC dwStatus dwEgomotion_updateIMUExtrinsics(const dwTransformation3f *imuToRig, dwEgomotionHandle_t obj)
This method updates the IMU extrinsics to convert from the IMU coordinate system to the vehicle rig c...
float32_t gyroBiasRange
If known this value in [rad/s] shall indicate standard deviation of the expected bias range of the gy...
Definition: Egomotion.h:298
dwEgomotionSuspensionParameters suspension
Suspension model parameters.
Definition: Egomotion.h:385
indicates validity of rotation,
Definition: Egomotion.h:393
Sensor measurement noise characteristics.
Definition: Egomotion.h:285
Specifies a 3D rigid transformation.
Definition: Types.h:462
DW_API_PUBLIC dwStatus dwEgomotion_update(dwTime_t timestamp_us, dwEgomotionHandle_t obj)
Runs the motion model estimation for a given timestamp.
dwMotionModel motionModel
Specifies the motion model to be used for pose estimation.
Definition: Egomotion.h:342
uint32_t historySize
Number of state estimates to keep in the history (if 0 specified default of 1000 is used)...
Definition: Egomotion.h:362
dwStatus
Status definition.
Definition: Status.h:166
float32_t accelerationFilterTimeConst
Time constant of the IMU acceleration measurements.
Definition: Egomotion.h:235
struct dwEgomotionObject * dwEgomotionHandle_t
Definition: Egomotion.h:79
DW_API_PUBLIC dwStatus dwEgomotion_release(dwEgomotionHandle_t obj)
Releases the egomotion module.
DW_API_PUBLIC dwStatus dwEgomotion_getHistorySize(size_t *num, dwEgomotionConstHandle_t obj)
Returns the number of elements currently stored in the history.
indicates validity of linearVelocity[1]
Definition: Egomotion.h:396
DW_API_PUBLIC dwStatus dwEgomotion_getEstimationTimestamp(dwTime_t *timestamp, dwEgomotionConstHandle_t obj)
Gets the timestamp of the latest state estimate.
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
dwMotionModel
Defines the motion models.
Definition: Egomotion.h:83
DW_API_PUBLIC dwStatus dwEgomotion_estimate(dwEgomotionResult *pose, dwEgomotionUncertainty *uncertainty, dwTime_t timestamp_us, dwEgomotionConstHandle_t obj)
Estimates the state for a given timestamp.
DW_API_PUBLIC dwStatus dwEgomotion_reset(dwEgomotionHandle_t obj)
Resets the state estimate and all history of the egomotion module.
no filtering of the output linear acceleration
Definition: Egomotion.h:214
float32_t torsionalSpringPitchDampingRatio
Level of damping relative to critical damping around the pitch axis of the vehicle [dimensionless]...
Definition: Egomotion.h:278
float32_t processNoiseStdevSpeed
Square root of continuous time process noise covariance in speed [m/s * 1/sqrt(s)].
Definition: Egomotion.h:236
dwTime_t timestamp
Timestamp of egomotion state estimate [us].
Definition: Egomotion.h:418
DW_API_PUBLIC dwStatus dwEgomotion_computeRelativeTransformation(dwTransformation3f *poseAtoB, dwEgomotionRelativeUncertainty *uncertainty, dwTime_t timestamp_a, dwTime_t timestamp_b, dwEgomotionConstHandle_t obj)
Computes the relative transformation between two timestamps and the uncertainty of this transform...
dwEgomotionSuspensionModel model
Suspension model to use.
Definition: Egomotion.h:249
An IMU frame containing sensor readings from the IMU sensor.
Definition: IMU.h:104
struct dwEgomotionObject const * dwEgomotionConstHandle_t
Definition: Egomotion.h:80
dwTime_t velocityLatency
CAN velocity latency in microseconds which is read from can properties in rig file.
Definition: Egomotion.h:309
struct dwRigObject const * dwConstRigHandle_t
Definition: Rig.h:180
dwTransformation3f imu2rig
IMU extrinsics.
Definition: Egomotion.h:339
Defines a 3x3 matrix of floating point numbers.
Definition: Types.h:237
float32_t gyroNoiseDensityDeg
Expected zero mean measurement noise of the gyroscope, also known as Noise Density [deg/s/sqrt(Hz)] A...
Definition: Egomotion.h:289
bool automaticUpdate
Automatically update state estimation.
Definition: Egomotion.h:358
DW_API_PUBLIC dwStatus dwEgomotion_hasEstimation(bool *result, dwEgomotionConstHandle_t obj)
Check whether has state estimate.
dwEgomotionLinearAccelerationFilterMode
Defines egomotion linear acceleration filter mode.
Definition: Egomotion.h:213
Defines egomotion linear acceleration filter parameters.
Definition: Egomotion.h:229
DW_API_PUBLIC dwStatus dwEgomotion_getHistoryElement(const dwEgomotionResult **pose, const dwEgomotionUncertainty **uncertainty, size_t index, dwEgomotionConstHandle_t obj)
Returns an element from the motion history that is currently available.
DW_API_PUBLIC dwStatus dwEgomotion_steeringWheelAngleToSteeringAngle(float32_t *steeringAngle, float32_t steeringWheelAngle, dwEgomotionHandle_t obj)
Convert steering wheel angle to steering angle.
Vehicle velocity [m/s].
Definition: Egomotion.h:164
dwVehicle vehicle
Vehicle parameters to setup the model.
Definition: Egomotion.h:328
Holds egomotion uncertainty estimates.
Definition: Egomotion.h:445
Indicates that speeds are angular speeds [rad/s] measured at rear wheels.
Definition: Egomotion.h:207
Holds egomotion state estimate.
Definition: Egomotion.h:413
dwTime_t timestamp
Timestamp of egomotion uncertainty estimate [us].
Definition: Egomotion.h:455
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:80
dwMatrix3f translation
a 3x3 covariance of the translation (x,y,z) [m]
Definition: Egomotion.h:466
dwEgomotionSpeedMeasurementType
Defines speed measurement types.
Definition: Egomotion.h:172
dwEgomotionLinearAccelerationFilterMode mode
Linear acceleration filter mode. Default (0): no filtering.
Definition: Egomotion.h:232
No suspension model. Equivalent to perfectly rigid suspension.
Definition: Egomotion.h:222
DW_API_PUBLIC dwStatus dwEgomotion_getMotionModel(dwMotionModel *model, dwEgomotionConstHandle_t obj)
Returns the type of the motion model used.
DW_API_PUBLIC dwStatus dwEgomotion_initialize(dwEgomotionHandle_t *obj, const dwEgomotionParameters *params, dwContextHandle_t ctx)
Initializes the egomotion module.
Steering wheel angle [rad].
Definition: Egomotion.h:166
Holds initialization parameters for the Egomotion module.
Definition: Egomotion.h:323
NVIDIA DriveWorks API: Core Exports
Indicates that speed is linear speed [m/s] measured at front wheels (along steering direction)...
Definition: Egomotion.h:188
DW_API_PUBLIC dwStatus dwEgomotion_steeringAngleToSteeringWheelAngle(float32_t *steeringWheelAngle, float32_t steeringAngle, dwEgomotionHandle_t obj)
Convert steering angle to steering wheel angle.
float32_t gyroDriftRate
Expected gyroscope drift rate in [deg/s].
Definition: Egomotion.h:293
indicates validity of linearAcceleration[2]
Definition: Egomotion.h:405
simple low-pass filtering of the acceleration
Definition: Egomotion.h:215
dwMotionModelMeasurement
Defines motion measurements.
Definition: Egomotion.h:163
dwEgomotionSuspensionModel
Defines egomotion suspension model.
Definition: Egomotion.h:221
#define DW_API_PUBLIC
Definition: Exports.h:56
NVIDIA DriveWorks API: IMU
Given odometry information, estimates motion of the vehicle using a bicycle model.
Definition: Egomotion.h:119
dwQuaternionf rotation
Rotation represented as quaternion (x,y,z,w).
Definition: Egomotion.h:415
dwEgomotionSensorCharacteristics sensorParameters
Sensor parameters, containing information about sensor characteristics.
Definition: Egomotion.h:372
float32_t torsionalSpringPitchNaturalFrequency
Torsional spring model parameters.
Definition: Egomotion.h:273
Properties of the vehicle.
Definition: Rig.h:348
indicates validity of angularVelocity[1]
Definition: Egomotion.h:400
DW_API_PUBLIC dwStatus dwEgomotion_updateVehicle(const dwVehicle *vehicle, dwEgomotionHandle_t obj)
This method updates the egomotion module with an updated vehicle.
DW_API_PUBLIC dwStatus dwEgomotion_applyRelativeTransformation(dwTransformation3f *newVehicle2World, const dwTransformation3f *poseOld2New, const dwTransformation3f *oldVehicle2World)
Applies the estimated relative motion as returned by dwEgomotion_computeRelativeTransformation() to a...