The dwVehicleIO_initialize() function creates a VehicleIO instance. That functions takes the following parameters:
dwVehicleIOHandle_tdwVehicleIOType (DW_VEHICLEIO_DATASPEED / DW_VEHICLEIO_GENERIC / DW_VEHICLEIO_CUSTOM)dwVehicledwRig_initializeFromFile() and then get the vehicle properties using dwRig_getVehicle(). For more information, see Rig Configuration in this guide.dwContextHandle_tThe dwVehicleIO_setDrivingMode() function sets the driving mode. This function consumes the dwVehicleIODrivingMode() enum as an argument, which is defined as
The dwVehicleIO_consumeCANFrame() function parses received CAN messages. The resulting parsed messages generate certain reports, which can be gathered using the predefined callbacks.
The current vehicle state information can be retrieved with dwVehicleIO_getVehicleSafetyState(), dwVehicleIO_getVehicleNonSafetyState(), and dwVehicleIO_getVehicleActuationFeedback, which return the vehicle state in the dwVehicleIOSafetyState, dwVehicleIONonSafetyState, and dwVehicleIOActuationFeedback formats respectively.
The dwVehicleIO_sendVehicleCommand() function sends a command to the vehicle via VehicleIO. The command is sent in the dwVehicleIOCommand format and is passed as one of the arguments. An additional argument is passed as a handle to the underlying sensor that VehicleIO uses to pass this command.
Signals that the driver uses to override Vehicle control are configurable and can be selected using dwVehicleIO_selectDriverOverrides(). The driver can override vehicle control with any combination of throttle, steering, brake, and/or gear.
In order to enable vehicle actuation (i.e. engage), several conditions must be satisfied:
dwVehicleIOCommand::enable must be set to true.dwVehicleIOCommand::*Valid flags must be set to true, for example dwVehicleIOCommand::brakeValid to actuate vehicle braking.dwVehicleIOState::faults must be clear. Recoverable faults can be cleared by sending a command with dwVehicleIOCommand::clearFaults set to true.dwVehicleIOState::overrides must be clear for all enabled driver overrides. To clear dwVehicleIOState::overrides, one has to send a command with dwVehicleIOCommand::clearFaults set to true (same field is used to clear faults and overrides).Once engaged, both Drive-By-Wire hardware and/or VehicleIO might decide to disable vehicle actuation (i.e. disengage), there are a few cases when this might happen:
dwVehicleIOCommand::enable is set to false.dwVehicleIOState::faults (see corresponding dwVehicleIOFaults enumeration). Exact reason for disengagement can be traced back using CAN logs and Drive-By-Wire vendor documentation.dwVehicleIOState::overrides (see corresponding dwVehicleIOOverrides enumeration).DW_VEHICLEIO_DRIVING_LIMITED mode, some commands (such as braking) that are considered not appropriate for limited actuation will cause VehicleIO to stop sending commands to the vehicle (i.e. VehicleIO will disengage). In this case, DW_VEHICLEIO_FAULT_SAFETY bit will set in dwVehicleIOState::faults.DW_VEHICLEIO_DRIVING_LIMITED mode, then DW_VEHICLEIO_FAULT_SAFETY bit will set in dwVehicleIOState::faults and VehicleIO will disengage.See VehicleIO Sample