DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

samples/sensors/imu/README.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page dwx_imu_loc_sample IMU Logger Sample
4 @tableofcontents
5 
6 @section dwx_imu_loc_sample_description Description
7 
8 The IMU Logger sample works with any serial port (UART) based IMU
9 sensor or with the Xsens IMU device connected over USB. The logger requires
10 the IMU sensor connected over serial port to deliver messages in NMEA format,
11 while the Xsens device can run in proprietary mode.
12 
13 @subsection dwx_imu_loc_sample_description_interfacing Interfacing with sensors
14 
15 #### Serial
16 
17 Consumer grade off-the-shelve IMU sensors are usually connected over USB
18 and implement a serial-to-USB connection with the help of FTDI devices.
19 The Xsens IMU device can be connected through a serial-to-USB connection.
20 
21 On Linux, these sensors can then be reached over the `/dev/ttyUSB` or
22 `/dev/ttyACM` devices. Before trying out the sample, ensure the user has
23 access to the serial device. You can do so by trying to read from the device
24 e.g. with `cat /dev/ttyACMx`, and if permission is denied, add the current user
25 to the `dialout` group and then log out/in again:
26 
27  sudo usermod -a -G dialout $USER
28 
29 
30 On QNX, prior to accessing the device, launch the `dev-serusb` driver as
31 follows:
32 
33  devc-serusb -b <baudrate> -F -S -d path=/dev/usb/io-usb-otg
34 
35 The serial devices can the be reached over the `/dev/serusb` devices.
36 
37 #### Xsens USB
38 
39 The Xsens IMU device can also be connected directly over USB, but is only
40 supported on Linux.
41 
42 @section dwx_imu_loc_sample_running Running the Sample
43 
44 The sample requires the driver and name of the device of the IMU sensor.
45 
46 The IMU Logger sample, sample_imu_logger, accepts the following parameters:
47 
48  ./sample_imu_logger --driver=[imu.virtual|imu.uart|imu.xsens|imu.novatel|imu.dataspeed|imu.xsensCan|imu.bosch|imu.continental|imu.custom]
49  --params=[comma/separated/key/value/pairs]
50  --timestamp-trace=[true|false]
51 
52 Where:
53 
54  --driver=[imu.virtual|imu.uart|imu.xsens|imu.novatel|imu.dataspeed|imu.xsensCan|imu.bosch|imu.continental|imu.custom]
55  Allows to specify which IMU driver to use.
56  Default value: imu.virtual
57 
58  --params=[comma/separated/key/value/pairs]
59  Different parameters are available for each IMU driver.
60  Default value: file=path/to/data/samples/sensors/imu/imu.txt
61 
62  --timestamp-trace=[true|false]
63  Allows to output only the timestamp deltas between consecutive frames.
64  Default value: false
65 
66 @note For a full list of key/value pairs that can be passed to --params see @ref dwx_sensor_enum_sample.
67 
68 @subsection dwx_imu_loc_sample_examples Examples
69 
70 #### NMEA format
71 
72 For serial devices transmitting messages in NMEA format, use the `imu.uart`
73 driver. For example:
74 
75  ./sample_imu_logger --driver=imu.uart --params=device=/dev/ttyUSB0,baud=115200
76 
77 Per default, if no `baud` parameter has been provided `imu.uart` driver assumes
78 a baudrate of 9600. In order to change the baudrate provide `baud` argument as:
79 
80  ./sample_imu_logger --driver=imu.uart --params=device=/dev/ttyUSB0,baud=115200
81 
82 On QNX, the baudrate is set when starting `devc-serusb`. The `baud`
83 parameter will be ignored.
84 
85 #### Xsens proprietary format
86 
87 The sample supports reading IMU packets from a Xsens device through the
88 `imu.xsens` driver. To run the sample using Xsens over USB device use:
89 
90  ./sample_imu_logger --driver=imu.xsens --params=device=0,frequency=100
91 
92 Where `device=0` parameter sets the index of the Xsens device (usually 0
93 if only one device is installed) and `frequency=100` sets the frequency
94 in `[Hz]` this device should operate with.
95 
96 To run the sample using Xsens over serial use:
97 
98  ./sample_imu_logger --driver=imu.xsens --params=device=/dev/ttyUSB0,frequency=100
99 
100 Please note that even if the Xsens device is a shared device, like Xsens
101 MTi-G-700, capable of delivering GPS and IMU packets, only the IMU packets
102 will be parsed by the `imu.xsens` driver.
103 
104 @note If the device is connected to Xavier UART you need also specify --stop-bits=1
105 
106 @section dwx_imu_loc_sample_output Output
107 
108 For every valid IMU message that the sample receives, it prints to the console
109 data such as:
110 
111  [7156364888] Heading(True:112.07)
112  [7156364959] Gyro(Z:0.0756667 )
113  [7156369081] Orientation(R:-1.3 P:-0.9 ) Gyro(X:-0.01 Y:-0.05 ) Heading(True:112.1)
114  [7156389724] Heading(Magnetic:112.07)
115  [1475788068778749] Heading(Magnetic:112.1)
116  [7156389797] Orientation(R:-1.31 P:-0.89 )
117  [1475788068778919] Orientation(R:-1.30529 P:-0.893047 Y:112.078 ) Gyro(X:0.0229183 Y:-0.0687549 Z:0.120321 ) Acceleration(X:-0.1398 Y:-0.2612 Z:9.7838 ) Magnetometer(X:7.18 Y:3.056 Z:-16.16 )
118 
119 Where the first number indicates the timestamp of the received IMU
120 message in microseconds and the rest of the line indicates the IMU information
121 of the sensor.
122 
123 @section dwx_imu_loc_sample_more Additional Information
124 
125 For more details see @ref imu_mainsection.