DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

/dvs/git/dirty/gitlab-master_av/dw/sdk/samples/vehicleio/README.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
2 
3 @page dwx_vehicleio_sample VehicleIO Sample
4 @tableofcontents
5 
6 @note SW Release Applicability: This sample is available in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 
8 @section dwx_vehicleio_description Description
9 
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.
16 
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).
21 
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
25 driver.
26 
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.
30 
31 @section dwx_vehicleio_running Running the Sample
32 
33 The command line for the sample is:
34 
35  ./sample_vehicleio [--rig=path/to/rig/file]
36 
37 where
38 
39  --rig=[path/to/rig/file]
40  Points to the rig file.
41  Default value: path/to/data/samples/samples/vehicleio/rig.json
42 
43 While the sample is running, the following commands are available:
44 
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
51 
52 @note The vehicle control system is only available when using real CAN or linux VCAN.
53 
54 @subsection dwx_vehicleio_examples Examples
55 
56 #### Run VehicleIO sample with the Dataspeed driver
57 
58 To use with the pre-recorded CAN data, which is provided with the sample,
59 run the sample without any arguments:
60 
61  ./sample_vehicleio
62 
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:
65 
66  ./sample_vehicleio --rig=rig.json
67 
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`.)
70 
71 #### Run VehicleIO sample with the generic DbW Driver
72 
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
75 vice-versa.
76 
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.
80 
81 The following steps assume your DbW system is connected to CAN0.
82 
83 After running the dataspeedBridge, run the vehicleio sample with a Rig
84 Configuration that has only generic VehicleIO node:
85 
86 ```
87 {
88  "rig": {
89  "vehicleio": [
90  {
91  "type": "generic",
92  "parent-sensor": "can:vehicle:generic",
93  "dbc-file": "AutonomousVehicleCANSignals.dbc"
94  }
95  ],
96  "sensors": [
97  {
98  "name": "can:vehicle:generic",
99  "parameter": "device=can0",
100  "protocol": "can.socket",
101  "properties": null,
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 ] }
104  }
105  ],
106 ...
107 }
108 ```
109 
110 Then run the sample with this new rig.json file:
111 
112  ./sample_vehicleio --rig=rig.json
113 
114 #### Using Generic VehicleIO via VCAN0 interface on Bench
115 
116 If you want to use the generic vehicleio driver in a bench setup, you can use
117 the VCAN interface.
118 
119 1. Enable the VCAN interface.
120 
121  sudo modprobe vcan
122  sudo ip link add dev vcan0 type vcan
123  sudo ip link set up vcan0
124 
125 2. Start transmitting Dataspeed can messages over the VCAN interface.
126 
127  while true; do cat candump_dataspeed.log | canplayer -l i vcan0=can0; done
128 
129 3. Run `sample_dataspeedBridge` to convert Dataspeed messages to generic
130  vehicleio messages (refer to @ref dwx_dataspeedBridge_sample for details).
131 
132 4. Prepare a rig file that has vcan0 sensor and Generic VehicleIO node (as
133  described above), then run the sample:
134 
135  ./sample_vehicleio --rig=rig.json
136 
137 @section dwx_vehicleio_output Output
138 
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.
143 
144 The sample prints the basic vehicle state information to the terminal.
145 
146 ![VehicleIO sample](sample_vehicleio.png)
147 
148 @section dwx_vehicleio_more Additional information
149 
150 For more information, see @ref vehicleio_mainsection .