1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page dwx_vehicleio_sample VehicleIO Sample
6 @note SW Release Applicability: This sample is available in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
8 @section dwx_vehicleio_description Description
10 The VehicleIO sample demonstrates how to read and write the state of
11 the vehicle actuators (i.e. throttle, brake, steering, etc.) It can talk to
12 different vehicle control systems, one of which is Dataspeed. The
13 @ref vehicleio_mainsection module abstracts the underlying physical protocols and
14 connections. The internal "driver layer" handles the protocol interface and
15 the VehicleIO module handles the state.
17 The VehicleIO sample has been tested with CAN-based Dataspeed vehicle control system and
18 validated with Ford MKZ and Ford Fusion vehicles. To send the
19 steering, brake or throttle commands, use a keyboard or a USB joystick
20 (tested with Logitech Gamepad F310).
22 The VehicleIO sample can run with the Dataspeed drive-by-wire (DbW) systems.
23 It can also run with a generic NVIDIA DbW driver. The
24 `AutonomousVehicleCANSignals.dbc` DBC file describes the CAN commands for that
27 If you run the vehicleIO sample with the generic driver, you must also run the
28 DataspeedBridge utility. That utility converts the CAN messages and commands
29 to/from DbW systems to a generic type.
31 @section dwx_vehicleio_running Running the Sample
33 The command line for the sample is:
35 ./sample_vehicleio [--rig=path/to/rig/file]
39 --rig=[path/to/rig/file]
40 Points to the rig file.
41 Default value: path/to/data/samples/samples/vehicleio/rig.json
43 While the sample is running, the following commands are available:
45 - E - enable the vehicle control system
46 - D - disable the vehicle control system
47 - Arrow key UP - incrementel throttle with every arrow key UP press
48 - Arrow key DOWN - incremental braking with every arrow key DOWN press
49 - Arrow key LEFT - incremental steering rotation (counter-clockwise) with every key press
50 - Arrow key RIGHT - incremental steering rotation (clockwise) with every key press
52 @note The vehicle control system is only available when using real CAN or linux VCAN.
54 @subsection dwx_vehicleio_examples Examples
56 #### Run VehicleIO sample with the Dataspeed driver
58 To use with the pre-recorded CAN data, which is provided with the sample,
59 run the sample without any arguments:
63 To use a custom pre-recorded CAN data or to run live, one should provide a
64 custom rig file and use `--rig` argument:
66 ./sample_vehicleio --rig=rig.json
68 One can use the provided (default) rig.json file as a template (exact location
69 of that file can be found using `./sample_vehicleio --help`.)
71 #### Run VehicleIO sample with the generic DbW Driver
73 Before you can run the sample with a generic driver, you must run the utility
74 DataspeedBridge. This sample converts the messages from Dataspeed to a generic type and
77 You can use the CAN0 interface in a vehicle equipped with the Dataspeed DbW
78 system. With that setup, you can use the generic vehicleIO driver directly in a
79 CAR, where the Dataspeed system is connected to CAN0.
81 The following steps assume your DbW system is connected to CAN0.
83 After running the dataspeedBridge, run the vehicleio sample with a Rig
84 Configuration that has only generic VehicleIO node:
92 "parent-sensor": "can:vehicle:generic",
93 "dbc-file": "AutonomousVehicleCANSignals.dbc"
98 "name": "can:vehicle:generic",
99 "parameter": "device=can0",
100 "protocol": "can.socket",
102 "nominalSensor2Rig": { "quaternion": [ 0.0, 0.0, 0.0, 1.0 ], "t": [ 0.0, 0.0, 0.0 ] },
103 "sensor2Rig": { "quaternion": [ 0.0, 0.0, 0.0, 1.0 ], "t": [ 0.0, 0.0, 0.0 ] }
110 Then run the sample with this new rig.json file:
112 ./sample_vehicleio --rig=rig.json
114 #### Using Generic VehicleIO via VCAN0 interface on Bench
116 If you want to use the generic vehicleio driver in a bench setup, you can use
119 1. Enable the VCAN interface.
122 sudo ip link add dev vcan0 type vcan
123 sudo ip link set up vcan0
125 2. Start transmitting Dataspeed can messages over the VCAN interface.
127 while true; do cat candump_dataspeed.log | canplayer -l i vcan0=can0; done
129 3. Run `sample_dataspeedBridge` to convert Dataspeed messages to generic
130 vehicleio messages (refer to @ref dwx_dataspeedBridge_sample for details).
132 4. Prepare a rig file that has vcan0 sensor and Generic VehicleIO node (as
133 described above), then run the sample:
135 ./sample_vehicleio --rig=rig.json
137 @section dwx_vehicleio_output Output
139 The sample opens a window to display the various vehicle control parameters,
140 such as throttle, braking, and steering. Once the window is in the focus, the
141 throttle, brakes, steering of the vehicle can be controlled via a keyboard or a
142 USB joystick, as described above.
144 The sample prints the basic vehicle state information to the terminal.
146 
148 @section dwx_vehicleio_more Additional information
150 For more information, see @ref vehicleio_mainsection .