DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

VehicleIO.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-2019 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 
48 #ifndef DW_VEHICLEIO_H_
49 #define DW_VEHICLEIO_H_
50 
51 #include <dw/core/Config.h>
52 #include <dw/core/Exports.h>
53 #include <dw/core/Context.h>
54 #include <dw/core/Types.h>
55 #include <dw/sensors/Sensors.h>
56 #include <dw/sensors/canbus/CAN.h>
57 #include <dw/rig/Rig.h>
58 
59 #include <stdint.h>
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 typedef struct dwVehicleIOObject* dwVehicleIOHandle_t;
66 
67 typedef enum dwVehicleIODrivingMode {
72 
76 
80 
84 
85 typedef enum dwVehicleIOType {
94 
95 typedef enum dwVehicleIOFaults {
103 
104 typedef enum dwVehicleIOOverrides {
111 
112 typedef enum dwVehicleIOGear {
114 
115  // Automatic vehicles
121 
122  // Stick shift vehicles
134 
135 typedef enum dwVehicleIOTurnSignal {
142 
143 typedef enum {
148 
149 typedef enum dwVehicleIOMoonroof {
154 
155 typedef enum dwVehicleIOMirror {
162 
163 typedef enum dwVehicleIOHeadlights {
168  DW_VEHICLEIO_HEADLIGHTS_DRL = 4 //DAYTIME RUNNING LIGHTS
170 
171 // AEB - Automatic Emergency Braking System Status to report externally
172 typedef enum dwVehicleIOAEBState {
173  DW_VEHICLEIO_AEB_STATE_UNKNOWN = 0, // System is in an unknown state
174  DW_VEHICLEIO_AEB_STATE_OFF = 1, // System is off
175  DW_VEHICLEIO_AEB_STATE_READY = 2 // System is operational and ready to fire if necessary
177 
178 // FCW - Forward Collision Warning Status to report externally
179 typedef enum dwVehicleIOFCWState {
180  DW_VEHICLEIO_FCW_STATE_UNKNOWN = 0, // System is in an unknown state
181  DW_VEHICLEIO_FCW_STATE_OFF = 1, // System is off
182  DW_VEHICLEIO_FCW_STATE_READY = 2 // System is operational and ready to fire if necessary
184 
188 typedef struct dwVehicleIOCommand
189 {
190 
191  bool enable;
192 
193  // Steering command
196 
198 
199  // Throttle command - command to the accelerator pedal deflection as a value from 0 to 1
201 
202  // Brake command - command to the brake pedal deflection as a value from 0 to 1
204 
205  // Deceleration command - target deceleration rate for the vehicle. NOTE: Depending on IO driver,
206  // there are potentially multiple ways to command the vehicle - directly with actuator commands
207  // or with targets (deceleration for example) to downstream systems (brake controller).
209 
210  // Acceleration command
212 
213  // Other commands
216 
217  // Clear CAN bus errors
218  bool clearFaults;
219 
220  // Booleans validating commands
222  bool brakeValid;
225  bool speedValid;
226  bool gearValid;
230 
231  // AEB signals
232  bool aebRequest;
234 
235  // FCW signals
236  bool fcwRequest;
238 
239  uint64_t heartbeatCounter;
240 
242 
244 {
245 
246  //basic body controls
252 
253  //specifically for mirrors
256  //specifically for center console display brightness
258 
259  bool enable;
269 
274 {
279 
284 
288 typedef struct dwVehicleIOState
289 {
293 
296 
301 
303  float32_t steeringAngle;
306 
311 
318 
320  dwTime_t wheelSpeedTimestamp[DW_VEHICLE_NUM_WHEELS];
322 
323  int16_t wheelPosition[DW_VEHICLE_NUM_WHEELS];
324  dwTime_t wheelPositionTimestamp[DW_VEHICLE_NUM_WHEELS];
328 
330 
331  // Vehicle Miscellanoeus data
345  bool doorHood;
346  bool doorTrunk;
352  bool wiper;
356 
361 
364 
366 
367  bool enabled;
368 
372 
375 
377 
380 
382 
383 #define DW_VEHICLEIO_SPEED_LUT_MAX_ENTRIES 50
384 
391 {
402 
416 dwStatus dwVehicleIO_initialize(dwVehicleIOHandle_t* obj, dwVehicleIOType type, const dwVehicle* properties,
417  dwContextHandle_t ctx);
431 dwStatus dwVehicleIO_initializeFromDBC(dwVehicleIOHandle_t* obj, dwVehicleIOType type, const dwVehicle* properties,
432  const char* dbcFilePath, dwContextHandle_t ctx);
433 
447 dwStatus dwVehicleIO_initializeFromRig(dwVehicleIOHandle_t* obj,
448  dwRigHandle_t rig,
449  dwContextHandle_t ctx);
450 
461 dwStatus dwVehicleIO_reset(dwVehicleIOHandle_t obj);
462 
473 dwStatus dwVehicleIO_release(dwVehicleIOHandle_t obj);
474 
488 dwStatus dwVehicleIO_selectDriverOverrides(bool throttleOverride, bool steeringOverride,
489  bool brakeOverride, bool gearOverride,
490  dwVehicleIOHandle_t obj);
491 
507 dwStatus dwVehicleIO_consumeCANFrame(const dwCANMessage* msg, uint32_t sensorId, dwVehicleIOHandle_t obj);
508 
521  dwVehicleIOHandle_t obj);
522 
535  dwVehicleIOHandle_t obj);
536 
548 dwStatus dwVehicleIO_getVehicleState(dwVehicleIOState* state, dwVehicleIOHandle_t obj);
549 
560 dwStatus dwVehicleIO_getCapabilities(dwVehicleIOCapabilities* caps, dwVehicleIOHandle_t obj);
561 
575 dwStatus dwVehicleIO_setDrivingMode(dwVehicleIODrivingMode mode, dwVehicleIOHandle_t obj);
576 
590 dwStatus dwVehicleIO_addCANSensor(uint32_t vehicleIOId, dwSensorHandle_t sensorHandle, dwVehicleIOHandle_t obj);
591 
592 #ifdef __cplusplus
593 }
594 #endif
595 
596 #endif // DW_VehicleIO_ACTUATORS_H_
bool buttonCruiseControlGapDecrement
Definition: VehicleIO.h:339
uint8_t displayBrightnessValue
Definition: VehicleIO.h:257
dwVehicleIOFCWState
Definition: VehicleIO.h:179
bool buttonCruiseControlOnOff
Definition: VehicleIO.h:332
DW_API_PUBLIC dwStatus dwVehicleIO_setDrivingMode(dwVehicleIODrivingMode mode, dwVehicleIOHandle_t obj)
Setting driving mode allows to control the behaviour of VehicleIO module with regards to the permitte...
dwVehicleIODoorLock doorLock
basic lock or unlock
Definition: VehicleIO.h:247
bool buttonCruiseControlIncrement
Definition: VehicleIO.h:336
NVIDIA DriveWorks API: Core Types
dwVehicleIOGear
Definition: VehicleIO.h:112
float float32_t
Specifies POD types.
Definition: Types.h:70
NVIDIA DriveWorks API: Rig Configuration
bool buttonLaneAssistOnOff
Definition: VehicleIO.h:340
bool gearValid
True if setting gear.
Definition: VehicleIO.h:226
float32_t steeringCmd
Last acknowledged steering value from a command (-10.0 to 10.0 +- 0.01rad)
Definition: VehicleIO.h:299
The state data.
Definition: VehicleIO.h:288
dwVehicleIODrivingMode drivingMode
Definition: VehicleIO.h:365
bool buttonCruiseControlGapIncrement
Definition: VehicleIO.h:338
DW_API_PUBLIC dwStatus dwVehicleIO_initializeFromRig(dwVehicleIOHandle_t *obj, dwRigHandle_t rig, dwContextHandle_t ctx)
Initialize VehicleIO and prepare all internal structures from Rig Configuration.
bool mirrorFoldValid
True if setting mirror un/fold.
Definition: VehicleIO.h:263
DW_API_PUBLIC dwStatus dwVehicleIO_selectDriverOverrides(bool throttleOverride, bool steeringOverride, bool brakeOverride, bool gearOverride, dwVehicleIOHandle_t obj)
Select the overrides that the driver can use to disable vehicle control.
dwVehicleIOMirror mirrors
FOLD, UNFOLD, ADJUST_LEFT, ADJUST_RIGHT.
Definition: VehicleIO.h:249
dwVehicleIOTurnSignal
Definition: VehicleIO.h:135
float32_t throttleValue
Current thottle value as requested by a driver (0..1 +- 0.01 fraction of max pedal depressed...
Definition: VehicleIO.h:307
Defines a two-element single-precision floating-point vector.
Definition: Types.h:291
bool mirrorAdjustValid
True if setting mirror adjustment.
Definition: VehicleIO.h:264
dwVehicleIOHeadlights
Definition: VehicleIO.h:163
bool decelerationValid
True if setting deceleration.
Definition: VehicleIO.h:228
The command data.
Definition: VehicleIO.h:188
DW_API_PUBLIC dwStatus dwVehicleIO_initializeFromDBC(dwVehicleIOHandle_t *obj, dwVehicleIOType type, const dwVehicle *properties, const char *dbcFilePath, dwContextHandle_t ctx)
Initialize VehicleIO and prepare all internal structures from DBC File.
int32_t steeringWheelAngleLUTSize
Size of the corresponding lookup table.
Definition: VehicleIO.h:399
bool accelerationValid
True if setting acceleration.
Definition: VehicleIO.h:229
dwTime_t longVelocityForwardMinTimestamp
Definition: VehicleIO.h:276
dwVehicleIOFaults faults
Faults detected (0 = none)
Definition: VehicleIO.h:363
float32_t brakeCmd
Last acknowledged brake value from a command (0..1 +- 0.01 fraction of max pedal depressed, unitless)
Definition: VehicleIO.h:313
int32_t brakeValueLUTSize
Size of the corresponding lookup table.
Definition: VehicleIO.h:393
float32_t speed
Signed norm of velocity vector.
Definition: VehicleIO.h:291
uint64_t heartbeatCounter
VIO command heartbeat.
Definition: VehicleIO.h:239
float32_t steeringWheelAngle
Steering wheel angle (-10.0 to 10.0 +- 0.01rad)
Definition: VehicleIO.h:298
float32_t brakeTorqueActual
Actual applied brake torque value (Nm)
Definition: VehicleIO.h:316
NVIDIA DriveWorks API: Core Methods
dwVehicleIOMoonroof
Definition: VehicleIO.h:149
float32_t brakeTorqueRequested
Requested value of brake torque (Nm)
Definition: VehicleIO.h:315
DW_API_PUBLIC dwStatus dwVehicleIO_release(dwVehicleIOHandle_t obj)
Release used memory and close all modules.
bool passengerDetect
Definition: VehicleIO.h:347
dwTime_t speedTimestamp
Time at which speed was updated.
Definition: VehicleIO.h:292
int32_t steeringSpeedLUTSize
Size of the corresponding lookup table.
Definition: VehicleIO.h:397
bool moonroofValid
True if setting moonroof movement.
Definition: VehicleIO.h:262
dwVehicleIOOverrides
Definition: VehicleIO.h:104
float32_t rearAxleCurvature
Path curvature [1/m].
Definition: VehicleIO.h:373
float32_t accelerationValue
acceleration m/s^2
Definition: VehicleIO.h:211
dwVehicleIODrivingMode
Definition: VehicleIO.h:67
bool bucklePassenger
Definition: VehicleIO.h:350
bool passengerAirbag
Definition: VehicleIO.h:348
float32_t throttleState
Throttle value in effect (0..1 +- 0.01 fraction of max pedal depressed, unitless) ...
Definition: VehicleIO.h:309
dwVehicleIOGear gear
Desired gear: 0=UNKNOWN, 1=PARK, 2=REVERSE, 3=NEUTRAL, 4=DRIVE.
Definition: VehicleIO.h:214
bool steeringValid
True if setting steering.
Definition: VehicleIO.h:223
bool turnSigValid
True if setting turn signal.
Definition: VehicleIO.h:227
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Definition: Sensors.h:88
dwVehicleIOFaults
Definition: VehicleIO.h:95
bool fcwRequest
Request to activate FCW.
Definition: VehicleIO.h:236
dwStatus
Status definition.
Definition: Status.h:166
NVIDIA DriveWorks API: Sensors
float32_t rearAxleCurvatureMax
The tightest radius (left) that can be guaranteed.
Definition: VehicleIO.h:280
dwTime_t throttleTimestamp
Time at which throttle was updated.
Definition: VehicleIO.h:310
float32_t rearAxleCurvatureMin
The tightest radius (right) that can be guaranteed.
Definition: VehicleIO.h:281
dwVehicleIOFCWState fcwState
FCW system status/state.
Definition: VehicleIO.h:237
Safety checks suitable for collision avoidance logic (right now same as NO_SAFETY below)...
Definition: VehicleIO.h:79
float32_t steeringSpeed
Desired speed of the turning command rad/s.
Definition: VehicleIO.h:195
DW_API_PUBLIC dwStatus dwVehicleIO_reset(dwVehicleIOHandle_t obj)
Reset VehicleIO to default state.
float32_t inverseSteeringR
Inverse turning radius of the vehicle on the road.
Definition: VehicleIO.h:302
bool steeringEnabled
Steering by-wire enablement reported by vehicle.
Definition: VehicleIO.h:371
float32_t longVelocityForwardMin
A minimum positive longitudinal vehicle speed, when driving forward, to avoid burning the clutch...
Definition: VehicleIO.h:275
bool buttonLeftKeypadDown
Definition: VehicleIO.h:355
dwVehicleIOCapabilityState capability
Definition: VehicleIO.h:376
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
dwTime_t rearAxleCurvatureCapabilityTimestamp
Definition: VehicleIO.h:282
DW_API_PUBLIC dwStatus dwVehicleIO_sendCommand(const dwVehicleIOCommand *cmd, dwVehicleIOHandle_t obj)
Send a vehicle command to the VehicleIO.
bool turnSigValid
True if setting turn signal.
Definition: VehicleIO.h:267
bool throttleEnabled
Throttle by-wire enablement reported by vehicle.
Definition: VehicleIO.h:370
dwVehicleIOAEBState
Definition: VehicleIO.h:172
dwVector2f acceleration
Actual acceleration measured in m/s^2.
Definition: VehicleIO.h:294
dwTime_t brakeTimestamp
Time at which brake was updated.
Definition: VehicleIO.h:317
float32_t fuelLevel
(0 to 1 +- 0.01 fraction of tank volume, unitless)
Definition: VehicleIO.h:357
bool rearAxleCurvatureValid
True if setting rear axle curvature.
Definition: VehicleIO.h:224
VehicleIO Capabilities.
Definition: VehicleIO.h:390
float32_t steeringWheelTorque
Steering wheel torque (0 to 10.0 +- 0.01 Nm)
Definition: VehicleIO.h:300
bool highBeamHeadlights
Definition: VehicleIO.h:351
dwVector2f radarVelocity
Reported velocity from radar unit(s)
Definition: VehicleIO.h:378
bool speedValid
True if setting speed.
Definition: VehicleIO.h:225
dwVehicleIOTurnSignal turnSig
Turn signal value.
Definition: VehicleIO.h:215
dwTime_t longVelocityForwardMaxTimestamp
Definition: VehicleIO.h:278
float32_t brakeValue
Current brake value as requested by a driver (0..1 +- 0.01 fraction of max pedal depressed, unitless)
Definition: VehicleIO.h:312
bool throttleValid
True if setting throttle.
Definition: VehicleIO.h:221
float32_t steeringWheelAngle
Desired steering wheel angle (rad)
Definition: VehicleIO.h:194
float32_t brakeState
Brake value in effect (0..1 +- 0.01 fraction of max pedal depressed, unitless)
Definition: VehicleIO.h:314
#define DW_VEHICLEIO_SPEED_LUT_MAX_ENTRIES
Definition: VehicleIO.h:383
dwVehicleIOHeadlights headlights
ON/OFF, LOW_BEAM, HIGH_BEAM, DRL.
Definition: VehicleIO.h:250
bool buttonCruiseControlResetCancel
Definition: VehicleIO.h:335
bool aebRequest
Request to activate AEB.
Definition: VehicleIO.h:232
bool enable
True if we are driving by wire. Has to always be set.
Definition: VehicleIO.h:191
NVIDIA DriveWorks API: CAN
dwVehicleIOTurnSignal turnSignal
Turn signal value.
Definition: VehicleIO.h:360
float32_t throttleValue
range 0.0 to 1.0
Definition: VehicleIO.h:200
float32_t mirrorAdjustX
float value 0-5.0 seconds
Definition: VehicleIO.h:254
Comfortable driving is expected (most conservative).
Definition: VehicleIO.h:71
bool clearFaults
Setting > 0 clears any canbus faults/errors.
Definition: VehicleIO.h:218
dwVehicleIOGear gearCmd
Last acknowledged gear from a command.
Definition: VehicleIO.h:359
Number of wheels describing the vehicle.
Definition: Rig.h:319
float32_t brakeValue
range 0.0 to 1.0
Definition: VehicleIO.h:203
float32_t reverseSpeedLimit
Normally a negative value (m/s)
Definition: VehicleIO.h:392
bool displayBrightnessValid
True if setting display brightness.
Definition: VehicleIO.h:266
bool buttonCruiseControlDecrement
Definition: VehicleIO.h:337
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:80
float32_t throttleCmd
Last acknowledged throttle value from a command (0..1 +- 0.01 fraction of max pedal depressed...
Definition: VehicleIO.h:308
DW_API_PUBLIC dwStatus dwVehicleIO_getCapabilities(dwVehicleIOCapabilities *caps, dwVehicleIOHandle_t obj)
Retrieve current VehicleIO capabilities.
struct dwVehicleIOObject * dwVehicleIOHandle_t
Definition: VehicleIO.h:65
dwTime_t accelerationTimestamp
Time at which acceleration was updated.
Definition: VehicleIO.h:295
dwVehicleIOAEBState aebState
AEB system status/state.
Definition: VehicleIO.h:233
bool buttonLeftKeypadOk
Definition: VehicleIO.h:353
dwVehicleIOOverrides overrides
Overrides in place (0 = none)
Definition: VehicleIO.h:362
int32_t throttleValueLUTSize
Size of the corresponding lookup table.
Definition: VehicleIO.h:395
bool buttonCruiseControlCancel
Definition: VehicleIO.h:334
bool doorLockValid
True if setting door locks.
Definition: VehicleIO.h:261
bool brakeValid
True if setting break.
Definition: VehicleIO.h:222
dwVehicleIODoorLock
Definition: VehicleIO.h:143
dwVehicleIOMirror
Definition: VehicleIO.h:155
float32_t decelerationValue
decleration m/s^2 - represented as a positive number
Definition: VehicleIO.h:208
dwVehicleIOGear gear
Vehicle gear.
Definition: VehicleIO.h:358
NVIDIA DriveWorks API: Core Exports
DW_API_PUBLIC dwStatus dwVehicleIO_sendMiscCommand(const dwVehicleIOMiscCommand *cmd, dwVehicleIOHandle_t obj)
Send a vehicle command to the VehicleIO.
dwVector2f velocity
Vehicle velocity (longitudinal, lateral) measured in m/s at the rear axle.
Definition: VehicleIO.h:290
DW_API_PUBLIC dwStatus dwVehicleIO_consumeCANFrame(const dwCANMessage *msg, uint32_t sensorId, dwVehicleIOHandle_t obj)
Parse a received event.
DW_API_PUBLIC dwStatus dwVehicleIO_addCANSensor(uint32_t vehicleIOId, dwSensorHandle_t sensorHandle, dwVehicleIOHandle_t obj)
Add CAN sensor handle and corresponding VehicleIO configuration ID.
DW_API_PUBLIC dwStatus dwVehicleIO_initialize(dwVehicleIOHandle_t *obj, dwVehicleIOType type, const dwVehicle *properties, dwContextHandle_t ctx)
Initialize VehicleIO and prepare all internal structures.
bool headlightsValid
True if setting headlights.
Definition: VehicleIO.h:265
dwVehicleIOTurnSignal turnSig
Turn signal - misc also wants this.
Definition: VehicleIO.h:251
dwVehicleIOType
Definition: VehicleIO.h:85
float32_t rearAxleCurvatureValue
Path curvature request based on travelled distance (1/m)
Definition: VehicleIO.h:197
VehicleIO will bypass all safety checks.
Definition: VehicleIO.h:82
#define DW_API_PUBLIC
Definition: Exports.h:56
The capability state data.
Definition: VehicleIO.h:273
dwTime_t steeringTimestamp
Time at which steering was updated.
Definition: VehicleIO.h:297
dwVehicleIOMoonroof moonroof
basic open or close
Definition: VehicleIO.h:248
dwTime_t rearAxleCurvatureTimestamp
Timestamp for all motion signals.
Definition: VehicleIO.h:374
Holds a CAN package.
Definition: CAN.h:114
dwTime_t radarVelocityTimestamp
Definition: VehicleIO.h:379
DW_API_PUBLIC dwStatus dwVehicleIO_getVehicleState(dwVehicleIOState *state, dwVehicleIOHandle_t obj)
Retrieve current vehicle state.
float32_t longVelocityForwardMax
A maximum positive longitudinal vehicle speed that the vehicle is designed for.
Definition: VehicleIO.h:277
struct dwRigObject * dwRigHandle_t
Handle representing the Sensor Abstraction Layer interface.
Definition: Rig.h:179
Properties of the vehicle.
Definition: Rig.h:348
float32_t mirrorAdjustY
float value 0-5.0 seconds
Definition: VehicleIO.h:255
bool brakeEnabled
Brake by-wire enablement reported by vehicle.
Definition: VehicleIO.h:369
bool buttonCruiseControlReset
Definition: VehicleIO.h:333
bool buttonLeftKeypadUp
Definition: VehicleIO.h:354
Same as above, but unsafe commands are clamped to safe limits and warnings are isssued.
Definition: VehicleIO.h:75