DriveWorks SDK Reference

| 0.6.67 Release

VehicleIO Actuators

Detailed Description

API of to access VehicleIO car controller box.

Data Structures

struct  dwVehicleIOCommand
 The command data. More...
 
struct  dwVehicleIOState
 The state data. More...
 

Typedefs

typedef struct dwVehicleIOObject * dwVehicleIOHandle_t
 

Enumerations

enum  dwVehicleIODrivingMode {
  DW_VEHICLEIO_DRIVING_LIMITED = 0x000,
  DW_VEHICLEIO_DRIVING_LIMITED_ND = 0x100,
  DW_VEHICLEIO_DRIVING_COLLISION_AVOIDANCE = 0x200,
  DW_VEHICLEIO_DRIVING_NO_SAFETY = 0x300
}
 
enum  dwVehicleIOFaults {
  DW_VEHICLEIO_FAULT_NONE = 0,
  DW_VEHICLEIO_FAULT_BRAKE = 1 << 0,
  DW_VEHICLEIO_FAULT_STEERING = 1 << 1,
  DW_VEHICLEIO_FAULT_THROTTLE = 1 << 2,
  DW_VEHICLEIO_FAULT_GEAR = 1 << 3,
  DW_VEHICLEIO_FAULT_SAFETY = 1 << 4
}
 
enum  dwVehicleIOGear {
  DW_VEHICLEIO_GEAR_UNKNOWN = 0,
  DW_VEHICLEIO_GEAR_PARK = 1,
  DW_VEHICLEIO_GEAR_REVERSE = 2,
  DW_VEHICLEIO_GEAR_NEUTRAL = 3,
  DW_VEHICLEIO_GEAR_DRIVE = 4,
  DW_VEHICLEIO_GEAR_LOW = 5,
  DW_VEHICLEIO_GEAR_MANUAL_REVERSE = 100,
  DW_VEHICLEIO_GEAR_1 = 101,
  DW_VEHICLEIO_GEAR_2 = 102,
  DW_VEHICLEIO_GEAR_3 = 103,
  DW_VEHICLEIO_GEAR_4 = 104,
  DW_VEHICLEIO_GEAR_5 = 105,
  DW_VEHICLEIO_GEAR_6 = 106,
  DW_VEHICLEIO_GEAR_7 = 107,
  DW_VEHICLEIO_GEAR_8 = 108,
  DW_VEHICLEIO_GEAR_9 = 109
}
 
enum  dwVehicleIOOverrides {
  DW_VEHICLEIO_OVERRIDE_NONE = 0,
  DW_VEHICLEIO_OVERRIDE_BRAKE = 1 << 0,
  DW_VEHICLEIO_OVERRIDE_STEERING = 1 << 1,
  DW_VEHICLEIO_OVERRIDE_THROTTLE = 1 << 2,
  DW_VEHICLEIO_OVERRIDE_GEAR = 1 << 3
}
 
enum  dwVehicleIOTurnSignal {
  DW_VEHICLEIO_TURNSIGNAL_UNKNOWN = 0,
  DW_VEHICLEIO_TURNSIGNAL_OFF = 1,
  DW_VEHICLEIO_TURNSIGNAL_LEFT = 2,
  DW_VEHICLEIO_TURNSIGNAL_RIGHT = 3,
  DW_VEHICLEIO_TURNSIGNAL_EMERGENCY = 4
}
 
enum  dwVehicleIOType {
  DW_VEHICLEIO_DATASPEED = 0,
  DW_VEHICLEIO_GENERIC = 1
}
 
enum  dwVehicleIOWheels {
  DW_VEHICLEIO_WHEELS_FRONT_LEFT = 0,
  DW_VEHICLEIO_WHEELS_FRONT_RIGHT = 1,
  DW_VEHICLEIO_WHEELS_REAR_LEFT = 2,
  DW_VEHICLEIO_WHEELS_REAR_RIGHT = 3,
  DW_VEHICLE_NUM_WHEELS = 4
}
 Define index for each of the wheels on a 4 wheel vehicle. More...
 

Functions

DW_API_PUBLIC dwStatus dwVehicleIO_consume (const dwCANMessage *msg, dwVehicleIOHandle_t obj)
 Parse a received CAN message. More...
 
DW_API_PUBLIC dwStatus dwVehicleIO_getVehicleState (dwVehicleIOState *state, dwVehicleIOHandle_t obj)
 Retrieve current vehicle state. More...
 
DW_API_PUBLIC dwStatus dwVehicleIO_initialize (dwVehicleIOHandle_t *obj, dwVehicleIOType type, const dwVehicle *properties, dwContextHandle_t ctx)
 Initialize VehicleIO and prepare all internal structures. More...
 
DW_API_PUBLIC dwStatus dwVehicleIO_release (dwVehicleIOHandle_t *obj)
 Release used memory and close all modules. More...
 
DW_API_PUBLIC dwStatus dwVehicleIO_reset (dwVehicleIOHandle_t obj)
 Reset VehicleIO to default state. More...
 
DW_API_PUBLIC dwStatus dwVehicleIO_selectDriverOverrides (dwBool throttleOverride, dwBool steeringOverride, dwBool brakeOverride, dwBool gearOverride, dwVehicleIOHandle_t obj)
 Select the overrides that the driver can use to disable vehicle control. More...
 
DW_API_PUBLIC dwStatus dwVehicleIO_sendVehicleCommand (const dwVehicleIOCommand *cmd, dwSensorHandle_t hsensor, dwVehicleIOHandle_t obj)
 Send a vehicle command to the VehicleIO. More...
 
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 permitted commands and number of safety checks performed. More...
 

Data Structure Documentation

◆ dwVehicleIOCommand

struct dwVehicleIOCommand
Data Fields
dwBool brakePercent if true, value is in percent, otherwise direct pedal position
float32_t brakeTorque torque value in Nm
dwBool brakeValid True if setting break.
float32_t brakeValue range 0.0 to 1.0
dwBool clearFaults Setting > 0 clears any canbus faults/errors.
dwBool enable True if we are driving by wire. Has to always be set.
dwVehicleIOGear gear Desired gear: 0=UNKNOWN, 1=PARK, 2=REVERSE, 3=NEUTRAL, 4=DRIVE.
dwBool gearValid True if setting gear.
dwBool speedValid True if setting speed.
float32_t steering Desired steering wheel angle (rad)
float32_t steeringSpeed Desired speed of the turning command rad/s.
dwBool steeringValid True if setting steering.
dwBool throttlePercent if true, value is in percent, otherwise direct pedal position
dwBool throttleValid True if setting throttle.
float32_t throttleValue range 0.0 to 1.0
dwVehicleIOTurnSignal turnSig Turn signal value.
dwBool turnSigValid True if setting turn signal.

◆ dwVehicleIOState

struct dwVehicleIOState
Data Fields
float32_t brakeCmd Last acknowledged brake value from a command (0..1 ± 0.01 fraction of max pedal depressed, unitless)
float32_t brakeTorqueActual Actual applied brake torque value (Nm)
float32_t brakeTorqueRequested Requested value of brake torque (Nm)
float32_t brakeValue Current brake value (0..1 ± 0.01 fraction of max pedal depressed, unitless)
dwBool buckleDriver
dwBool bucklePassenger
dwBool buttonCruiseControlCancel
dwBool buttonCruiseControlDecrement
dwBool buttonCruiseControlGapDecrement
dwBool buttonCruiseControlGapIncrement
dwBool buttonCruiseControlIncrement
dwBool buttonCruiseControlOnOff
dwBool buttonCruiseControlReset
dwBool buttonCruiseControlResetCancel
dwBool buttonLaneAssistOnOff
dwBool doorDriver
dwBool doorHood
dwBool doorPassenger
dwBool doorRearLeft
dwBool doorRearRight
dwBool doorTrunk
dwVehicleIODrivingMode drivingMode
dwBool enabled
dwVehicleIOFaults faults Faults detected (0 = none)
float32_t fuelLevel (0 to 1 ± 0.01 fraction of tank volume, unitless)
dwVehicleIOGear gear Vehicle gear.
dwVehicleIOGear gearCmd Last acknowledged gear from a command.
dwBool highBeamHeadlights
float32_t inverseSteeringR Inverse turning radius of the vehicle on the road.

The radius depends on the vehicle wheel base, steering wheel angle, drivetrain properties and current speed.

dwVehicleIOOverrides overrides Overrides in place (0 = none)
dwBool passengerAirbag
dwBool passengerDetect
float32_t speed Vehicle speed (-100 to 100 m/s ± 0.02m/s)
dwTime_t speedTimestamp Time at which speed was updated.
float32_t steeringAngle Same as inverseSteeringR described as an angle instead of radius [rad].
float32_t steeringWheelAngle Steering wheel angle (-10.0 to 10.0 ± 0.01rad)
float32_t steeringWheelTorque Steering wheel torque (0 to 10.0 ± 0.01 Nm)
float32_t suspension[DW_VEHICLE_NUM_WHEELS] Vehicle Suspension data.
float32_t throttleCmd Last acknowledged throttle value from a command (0..1 ± 0.01 fraction of max pedal depressed, unitless)
float32_t throttleValue Current thottle value (0..1 ± 0.01 fraction of max pedal depressed, unitless)
float32_t tirePressure[DW_VEHICLE_NUM_WHEELS] Vehicle tire pressure data.
dwVehicleIOTurnSignal turnSignal Turn signal value.
float32_t wheelSpeed[DW_VEHICLE_NUM_WHEELS] vehicle individual wheel speeds (m/s)
dwBool wiper

Typedef Documentation

◆ dwVehicleIOHandle_t

typedef struct dwVehicleIOObject* dwVehicleIOHandle_t

Definition at line 62 of file VehicleIO.h.

Enumeration Type Documentation

◆ dwVehicleIODrivingMode

Enumerator
DW_VEHICLEIO_DRIVING_LIMITED 

Comfortable driving is expected (most conservative).

Commands that leave the comfort zone are treated as unsafe, which immediatley leads to VehicleIO being disabled.

DW_VEHICLEIO_DRIVING_LIMITED_ND 

Same as above, but unsafe commands are clamped to safe limits and warnings are isssued.

VehicleIO stays enabled.

DW_VEHICLEIO_DRIVING_COLLISION_AVOIDANCE 

Safety checks suitable for collision avoidance logic (right now same as NO_SAFETY below).

DW_VEHICLEIO_DRIVING_NO_SAFETY 

VehicleIO will bypass all safety checks.

Definition at line 64 of file VehicleIO.h.

◆ dwVehicleIOFaults

Enumerator
DW_VEHICLEIO_FAULT_NONE 
DW_VEHICLEIO_FAULT_BRAKE 
DW_VEHICLEIO_FAULT_STEERING 
DW_VEHICLEIO_FAULT_THROTTLE 
DW_VEHICLEIO_FAULT_GEAR 
DW_VEHICLEIO_FAULT_SAFETY 

Definition at line 87 of file VehicleIO.h.

◆ dwVehicleIOGear

Enumerator
DW_VEHICLEIO_GEAR_UNKNOWN 
DW_VEHICLEIO_GEAR_PARK 
DW_VEHICLEIO_GEAR_REVERSE 
DW_VEHICLEIO_GEAR_NEUTRAL 
DW_VEHICLEIO_GEAR_DRIVE 
DW_VEHICLEIO_GEAR_LOW 
DW_VEHICLEIO_GEAR_MANUAL_REVERSE 
DW_VEHICLEIO_GEAR_1 
DW_VEHICLEIO_GEAR_2 
DW_VEHICLEIO_GEAR_3 
DW_VEHICLEIO_GEAR_4 
DW_VEHICLEIO_GEAR_5 
DW_VEHICLEIO_GEAR_6 
DW_VEHICLEIO_GEAR_7 
DW_VEHICLEIO_GEAR_8 
DW_VEHICLEIO_GEAR_9 

Definition at line 104 of file VehicleIO.h.

◆ dwVehicleIOOverrides

Enumerator
DW_VEHICLEIO_OVERRIDE_NONE 
DW_VEHICLEIO_OVERRIDE_BRAKE 
DW_VEHICLEIO_OVERRIDE_STEERING 
DW_VEHICLEIO_OVERRIDE_THROTTLE 
DW_VEHICLEIO_OVERRIDE_GEAR 

Definition at line 96 of file VehicleIO.h.

◆ dwVehicleIOTurnSignal

Enumerator
DW_VEHICLEIO_TURNSIGNAL_UNKNOWN 
DW_VEHICLEIO_TURNSIGNAL_OFF 
DW_VEHICLEIO_TURNSIGNAL_LEFT 
DW_VEHICLEIO_TURNSIGNAL_RIGHT 
DW_VEHICLEIO_TURNSIGNAL_EMERGENCY 

Definition at line 127 of file VehicleIO.h.

◆ dwVehicleIOType

Enumerator
DW_VEHICLEIO_DATASPEED 
DW_VEHICLEIO_GENERIC 

Definition at line 82 of file VehicleIO.h.

◆ dwVehicleIOWheels

Define index for each of the wheels on a 4 wheel vehicle.

These indices are to be used to point into dwVehicleIOState.

Enumerator
DW_VEHICLEIO_WHEELS_FRONT_LEFT 
DW_VEHICLEIO_WHEELS_FRONT_RIGHT 
DW_VEHICLEIO_WHEELS_REAR_LEFT 
DW_VEHICLEIO_WHEELS_REAR_RIGHT 
DW_VEHICLE_NUM_WHEELS 

Definition at line 179 of file VehicleIO.h.

Function Documentation

◆ dwVehicleIO_consume()

DW_API_PUBLIC dwStatus dwVehicleIO_consume ( const dwCANMessage msg,
dwVehicleIOHandle_t  obj 
)

Parse a received CAN message.

A parsed messages will generate certain reports, which can be gathered using the according callbacks.

Parameters
[in]msgCAN message to be parsed by the controller.
[in]objSpecifies the car controler module handle.
Returns
DW_INVALID_HANDLE - if given obj handle is invalid
DW_INVALID_ARGUMENT - if given msg is null
DW_SUCCESS - if the initialization is successfull

◆ dwVehicleIO_getVehicleState()

DW_API_PUBLIC dwStatus dwVehicleIO_getVehicleState ( dwVehicleIOState state,
dwVehicleIOHandle_t  obj 
)

Retrieve current vehicle state.

Note that if called immediately after sending a new command it might not be reflected in the status, as the command needs to be executed and reported back by the vehicle.

Parameters
[out]statereturned vehicle state.
[in]objSpecifies the car controller module handle.
Returns
DW_INVALID_HANDLE - if given obj handle is invalid
DW_SUCCESS - if the initialization is successfull

◆ dwVehicleIO_initialize()

DW_API_PUBLIC dwStatus dwVehicleIO_initialize ( dwVehicleIOHandle_t obj,
dwVehicleIOType  type,
const dwVehicle properties,
dwContextHandle_t  ctx 
)

Initialize VehicleIO and prepare all internal structures.

Parameters
[out]objA pointer to the car controller handle for the created module.
[in]typeSpecifies the VehicleIO controller type.
[in]propertiesVehicle properties as described by dwRigConfiguration module.
[in]ctxSpecifies the handler to the DriveWorks context.
Returns
DW_INVALID_ARGUMENT - if any of the given arguments are not valid
DW_NOT_IMPLEMENTED - if given type is not implemented
DW_SUCCESS - if the initialization is successfull

◆ dwVehicleIO_release()

DW_API_PUBLIC dwStatus dwVehicleIO_release ( dwVehicleIOHandle_t obj)

Release used memory and close all modules.

Connection to VehicleIO will be closed. No more car commands can be accepted when module is released.

Parameters
[in]objA pointer to the car controller module handle.
Returns
DW_INVALID_HANDLE - if given obj handle is invalid
DW_SUCCESS - if the initialization is successfull

◆ dwVehicleIO_reset()

DW_API_PUBLIC dwStatus dwVehicleIO_reset ( dwVehicleIOHandle_t  obj)

Reset VehicleIO to default state.

Parameters
[in]objSpecifies the car controller module handle.
Returns
DW_INVALID_HANDLE - if given obj handle is invalid
DW_SUCCESS - if the initialization is successfull
Note
This would not perform any changes regarding current vehicle state.

◆ dwVehicleIO_selectDriverOverrides()

DW_API_PUBLIC dwStatus dwVehicleIO_selectDriverOverrides ( dwBool  throttleOverride,
dwBool  steeringOverride,
dwBool  brakeOverride,
dwBool  gearOverride,
dwVehicleIOHandle_t  obj 
)

Select the overrides that the driver can use to disable vehicle control.

Parameters
[in]throttleOverrideEnables driver override by throttle application
[in]steeringOverrideEnables driver override by steering application
[in]brakeOverrideEnables driver override by brake application
[in]gearOverrideEnables driver override by brake application
[in]objA pointer to the car controller module handle.
Returns
DW_INVALID_HANDLE - if given obj handle is invalid
DW_SUCCESS - if the initialization is successfull

◆ dwVehicleIO_sendVehicleCommand()

DW_API_PUBLIC dwStatus dwVehicleIO_sendVehicleCommand ( const dwVehicleIOCommand cmd,
dwSensorHandle_t  hsensor,
dwVehicleIOHandle_t  obj 
)

Send a vehicle command to the VehicleIO.

Parameters
[in]cmdCommand to be sent to the controller.
[in]hsensorSpecifies the underlying VehicleIO sensor (e.g. CAN).
[in]objSpecifies the car controller module handle.
Returns
DW_INVALID_HANDLE - if given obj or sensor handle are invalid
DW_SUCCESS - if the initialization is successfull

◆ dwVehicleIO_setDrivingMode()

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 permitted commands and number of safety checks performed.

Parameters
[in]modespecifies the mode of driving.
[in]objSpecifies the car controller module handle.
Returns
DW_INVALID_HANDLE - if given obj handle is invalid DW_SUCCESS - if the call was successful
See also
dwVehicleIODrivingMode