Clocks Analog Inputs Analog Outputs Digital Inputs Digital Outputs Encoder Inputs PWM Outputs Other Inputs Other Outputs Interrupts Watchdog Board-Specific Options Properties Targets See Also navigation bar

Quanser QCar

The Quanser's Quanser QCar is a scale-model car built and sold by Quanser Inc. The QUARC Target associated with the Quanser QCar is the QUARC Linux NVIDIA Target. The QCar driver provides access to the hardware I/O available on the QCar platform. The QCar includes an NVIDIA Jetson TX2 board with an ARM Cortex-A57 processor (2.0 GHz, quad core, 64 bit) and an NVIDIA Denver 2 processor (2.0 GHz, dual core, 64 bit), as well as an NVidia GPU (1.3 GHz, 256 core, Pascal architecture) with CUDA support, 360 degree camera view via four wide-angle 8MP cameras, an Intel D435 RGBD camera and additional I/O supplied by Quanser. The additional I/O includes:

The QUARC driver name for this card is qcar.

The Quanser QCar uses the Quanser standard reference frame for unmanned vehicles, as shown below:

Quanser Standard Reference Frame

To select the Quanser QCar board, select the QUARC qcar board type from the drop-down list on the Main tab of the HIL Initialize block. Please note that only one QCar card can be connected to a Quanser QCar and is supported in the system. The QUARC controller runs on the NVIDIA Jetson TX2 board and communicates with the QCar hardware I/O via a 12.5 MHz serial link.

Warning

Note that the Linux NVIDIA target must be selected to use the QCar board, as it is connected to the NVIDIA Jetson TX2 board.

The Quanser QCar supports three different means of communicating with it as a target. It supports wireless (WiFi) communications, which are most readily configured initially by connecting a monitor, mouse and keyboard and using the Ubuntu desktop to connect to the WiFi router. If a wireless connection is used then its IP address will show up on the LCD display with a WiFi symbol beside it. Once configured, it should reconnect automatically whenever the WiFi signal is available.

Warning The WiFi on the QCar does not support the full range of 5 GHz WiFi channels. To use 5 GHz WiFi with the QCar, use channels 36, 40, 44, 48, 52, 60 or 64. The WiFi router will likely have to be configured to use these lower channel numbers. The 5GHz band has more than double the bandwidth of the 2.4 GHz band so it is recommended for the best performance. Be aware, however, that 5 GHz WiFi signals do not penetrate walls and other obstacles as well as the 2.4 GHz WiFi signals.

The QCar also supports a 10/100/1000 Mbps wired LAN connection. If the LAN connection is used, its IP address will show up on the LCD display with a LAN symbol beside it. If both WiFi and LAN are connected then the LAN IP address will be displayed on the LCD display, as it is the fastest connection. In the case of WiFi or LAN the IP address is determined by the adapter settings. Typically, the IP address is assigned dynamically by a DHCP server on the network.

Finally, the USB-to-Go port acts as an Ethernet connection when it is connected to a PC. In this case, the IP address will not be shown on the LCD display but the address is always the same and will be 192.168.55.1. The PC to which it is connected will also be assigned an IP address on this "network", such as 192.168.55.100.

Configuration

The QCar is configured for the 3S battery supplied with the vehicle. The car is capable of supporting a 4S battery, but use of a 4S battery requires that the QUARC Power Monitor settings be configured for a 4S battery. Otherwise, the battery protection mechanisms built into QUARC will not protect the battery from damage and the LCD messages with regards to low battery voltage will be incorrect.

To configure the car for a 4S battery, edit the /etc/systemd/system/quarc_power_monitor.service file using the command:

sudo gedit /etc/systemd/system/quarc_power_monitor.service

Change the line:

ExecStart=/opt/quanser/quarc/bin/quarc_power_monitor

to the following:

ExecStart=/opt/quanser/quarc/bin/quarc_power_monitor --voltage 13.3 --warning 14.0

which will cause a low-voltage warning to be issued when the battery voltage reaches 14V, and the system will be safely powered down when the battery voltage reaches 13.3V.

Save the changes by pressing the Save button and close the text editor.

Display

The LCD display normally displays the battery voltage and IP address of the QCar. It also shows an icon beside the IP address indicating whether the current network connection is over the wired LAN via the Ethernet connector, or over wireless via the onboard WiFi. The following table shows some of the different status messages that may be displayed by the QUARC Power Monitor daemon on the LCD display. The power monitor only updates the display every ten seconds by default.

Display

Description

Initial message indicating the LCD is powered and working.

Shows the hostname for the Quanser QCar and indicates it is booting Ubuntu.

Battery voltage. No IP address has been obtained yet.

Battery voltage and IP address. Icon indicates the network connection is via WiFi (as opposed to LAN).

The red power button has been pressed and the Quanser QCar is shutting down.

However, custom text can be written to the display QUARC using the LCD Display block. The LCD display accepts the following characters:

Character

Code

Description

U+0020 (32)

latin character ' '

!

U+0021 (33)

latin character '!'

"

U+0022 (34)

latin character '"'

#

U+0023 (35)

latin character '#'

$

U+0024 (36)

latin character '$'

%

U+0025 (37)

latin character '%'

&

U+0026 (38)

latin character '&'

'

U+0027 (39)

latin character '''

(

U+0028 (40)

latin character '('

)

U+0029 (41)

latin character ')'

*

U+002A (42)

latin character '*'

+

U+002B (43)

latin character '+'

,

U+002C (44)

latin character ','

-

U+002D (45)

latin character '-'

.

U+002E (46)

latin character '.'

/

U+002F (47)

latin character '/'

0

U+0030 (48)

latin character '0'

1

U+0031 (49)

latin character '1'

2

U+0032 (50)

latin character '2'

3

U+0033 (51)

latin character '3'

4

U+0034 (52)

latin character '4'

5

U+0035 (53)

latin character '5'

6

U+0036 (54)

latin character '6'

7

U+0037 (55)

latin character '7'

8

U+0038 (56)

latin character '8'

9

U+0039 (57)

latin character '9'

:

U+003A (58)

latin character ':'

;

U+003B (59)

latin character ';'

<

U+003C (60)

latin character '<'

=

U+003D (61)

latin character '='

>

U+003E (62)

latin character '>'

?

U+003F (63)

latin character '?'

@

U+0040 (64)

latin character '@'

A

U+0041 (65)

latin character 'A'

B

U+0042 (66)

latin character 'B'

C

U+0043 (67)

latin character 'C'

D

U+0044 (68)

latin character 'D'

E

U+0045 (69)

latin character 'E'

F

U+0046 (70)

latin character 'F'

G

U+0047 (71)

latin character 'G'

H

U+0048 (72)

latin character 'H'

I

U+0049 (73)

latin character 'I'

J

U+004A (74)

latin character 'J'

K

U+004B (75)

latin character 'K'

L

U+004C (76)

latin character 'L'

M

U+004D (77)

latin character 'M'

N

U+004E (78)

latin character 'N'

O

U+004F (79)

latin character 'O'

P

U+0050 (80)

latin character 'P'

Q

U+0051 (81)

latin character 'Q'

R

U+0052 (82)

latin character 'R'

S

U+0053 (83)

latin character 'S'

T

U+0054 (84)

latin character 'T'

U

U+0055 (85)

latin character 'U'

V

U+0056 (86)

latin character 'V'

W

U+0057 (87)

latin character 'W'

X

U+0058 (88)

latin character 'X'

Y

U+0059 (89)

latin character 'Y'

Z

U+005A (90)

latin character 'Z'

[

U+005B (91)

latin character '['

]

U+005D (93)

latin character ']'

^

U+005E (94)

latin character '^'

_

U+005F (95)

latin character '_'

`

U+0060 (96)

grave accent

a

U+0061 (97)

latin character 'a'

b

U+0062 (98)

latin character 'b'

c

U+0063 (99)

latin character 'c'

d

U+0064 (100)

latin character 'd'

e

U+0065 (101)

latin character 'e'

f

U+0066 (102)

latin character 'f'

g

U+0067 (103)

latin character 'g'

h

U+0068 (104)

latin character 'h'

i

U+0069 (105)

latin character 'i'

j

U+006A (106)

latin character 'j'

k

U+006B (107)

latin character 'k'

l

U+006C (108)

latin character 'l'

m

U+006D (109)

latin character 'm'

n

U+006E (110)

latin character 'n'

o

U+006F (111)

latin character 'o'

p

U+0070 (112)

latin character 'p'

q

U+0071 (113)

latin character 'q'

r

U+0072 (114)

latin character 'r'

s

U+0073 (115)

latin character 's'

t

U+0074 (116)

latin character 't'

u

U+0075 (117)

latin character 'u'

v

U+0076 (118)

latin character 'v'

w

U+0077 (119)

latin character 'w'

x

U+0078 (120)

latin character 'x'

y

U+0079 (121)

latin character 'y'

z

U+007A (122)

latin character 'z'

{

U+007B (123)

latin character '{'

|

U+007C (124)

latin character '|'

}

U+007D (125)

latin character '}'

 

U+00A0 (160)

no-break space

¡

U+00A1 (161)

latin small letter I

¢

U+00A2 (162)

cent sign

£

U+00A3 (163)

pound sign

¥

U+00A5 (165)

yen

§

U+00A7 (167)

section

¨

U+00A8 (168)

diaeresis

«

U+00AB (171)

left-pointing double angle quotation mark

°

U+00B0 (176)

degree sign

´

U+00B4 (180)

accute accent

U+00B6 (182)

pilcrow

»

U+00BB (187)

right-pointing double angle quotation mark

¼

U+00BC (188)

vulgar fraction one quarter

½

U+00BD (189)

vulgar fraction one half

¿

U+00BF (191)

inverted question mark

Ã

U+00C3 (195)

latin capital letter A with tilde

Ä

U+00C4 (196)

latin capital A with diaeresis

Å

U+00C5 (197)

latin capital A with ring above

Æ

U+00C6 (198)

latin capital letter AE

Ç

U+00C7 (199)

latin capital letter C with cedilla

É

U+00C9 (201)

latin capital letter E with acute

Î

U+00CE (206)

latin small letter I with circumflex

Ñ

U+00D1 (209)

latin capital letter N with tilde

Õ

U+00D5 (213)

latin capital letter O with tilde

Ö

U+00D6 (214)

latin capital letter O with diaeresis

×

U+00D7 (215)

multiplication sign

Ø

U+00D8 (216)

latin capital letter O with stroke

Ü

U+00DC (220)

latin capital letter U with diaeresis

à

U+00E0 (224)

latin small letter A with grave

á

U+00E1 (225)

latin small letter A with acute

â

U+00E2 (226)

latin small letter A with circumflex

ã

U+00E3 (227)

latin small letter A with tilde

ä

U+00E4 (228)

latin small letter A with diaeresis

æ

U+00E6 (230)

latin small letter AE

ç

U+00E7 (231)

latin small letter C with cedilla

è

U+00E8 (232)

latin small letter E with grave

é

U+00E9 (233)

latin small letter E with acute

ê

U+00EA (234)

latin small letter E with circumflex

ë

U+00EB (235)

latin small letter E with diaeresis

ì

U+00EC (236)

latin small letter I with grave

í

U+00ED (237)

latin small letter I with acute

ï

U+00EF (239)

latin small letter I with diaeresis

ñ

U+00F1 (241)

latin small letter N with tilde

ò

U+00F2 (242)

latin small letter O with grave

ó

U+00F3 (243)

latin small letter O with acute

ô

U+00F4 (244)

latin small letter O with circumflex

õ

U+00F5 (245)

latin small letter O with tilde

ö

U+00F6 (246)

latin small letter O with diaeresis

÷

U+00F7 (247)

division sign

ø

U+00F8 (248)

latin small letter O with stroke

ù

U+00F9 (249)

latin small letter U with grave

ú

U+00FA (250)

latin small letter U with acute

û

U+00FB (251)

latin small letter U with circumflex

ü

U+00FC (252)

latin small letter U with diaeresis

ÿ

U+00FF (255)

latin small letter Y with diaeresis

ƒ

U+0192 (402)

latin small letter F with hook

ȧ

U+0227 (551)

latin small letter A with dot above

ˋ

U+02CB (715)

modifier letter grave accent

˙

U+02D9 (729)

dot above

˚

U+02DA (730)

ring above

Γ

U+0393 (915)

capital gamma

Δ

U+0394 (916)

capital delta

Θ

U+0398 (920)

capital theta

Λ

U+039B (923)

capital lambda

Ξ

U+039E (926)

capital xi

Π

U+03A0 (928)

capital pi

Σ

U+03A3 (931)

capital sigma

Τ

U+03A4 (932)

capital tau

Φ

U+03A6 (934)

capital phi

Ψ

U+03A8 (936)

capital psi

Ω

U+03A9 (937)

capital omega

α

U+03B1 (945)

small alpha

U+1E01 (7681)

latin small letter A with ring below (actually shows a line below)

U+1ECD (7885)

latin small letter O with dot below (actually shows a line below)

U+2020 (8224)

dagger

U+2036 (8246)

double prime

U+203E (8254)

overline

U+20A7 (8359)

peseta

U+2122 (8482)

trademark

U+2190 (8592)

leftwards arrow

U+2192 (8594)

rightwards arrow

U+221A (8730)

square root

U+2260 (8800)

not equal to

U+2264 (8804)

less than or equal to

U+2265 (8805)

greater than or equal to

U+2E1C (11804)

left low paraphrase bracket

U+2E22 (11810)

top left half bracket

U+2E25 (11813)

bottom right half bracket

U+2E30 (11824)

ring point

U+2E31 (11825)

word separator middle dot

U+30A1 (12449)

katakana letter small A

U+30A2 (12450)

katakana letter A

U+30A3 (12451)

katakana letter small I

U+30A4 (12452)

katakana letter I

U+30A5 (12453)

katakana letter small U

U+30A6 (12454)

katakana letter U

U+30A7 (12455)

katakana letter small E

U+30A8 (12456)

katakana letter E

U+30A9 (12457)

katakana letter small O

U+30AA (12458)

katakana letter O

U+30AB (12459)

katakana letter ka

U+30AD (12461)

katakana letter ki

U+30B1 (12465)

katakana letter ke

U+30B3 (12467)

katakana letter ko

U+30B5 (12469)

katakana letter sa

U+30B7 (12471)

katakana letter si

U+30B9 (12473)

katakana letter su

U+30BB (12475)

katakana letter se

U+30BD (12477)

katakana letter so

U+30BF (12479)

katakana letter ta

U+30C0 (12480)

katakana letter da

U+30C3 (12483)

katakana letter small tu

U+30C4 (12484)

katakana letter tu

U+30C6 (12486)

katakana letter te

U+30C8 (12488)

katakana letter to

U+30CA (12490)

katakana letter na

U+30CB (12491)

katakana letter ni

U+30CC (12492)

katakana letter nu

U+30CD (12493)

katakana letter ne

U+30CE (12494)

katakana letter no

U+30CF (12495)

katakana letter ha

U+30D2 (12498)

katakana letter hi

U+30D5 (12501)

katakana letter hu

U+30D8 (12504)

katakana letter he

U+30DB (12507)

katakana letter ho

U+30DE (12510)

katakana letter ma

U+30DF (12511)

katakana letter mi

U+30E0 (12512)

katakana letter mu

U+30E1 (12513)

katakana letter me

U+30E2 (12514)

katakana letter mo

U+30E3 (12515)

katakana letter small ya

U+30E4 (12516)

katakana letter ya

U+30E5 (12517)

katakana letter small yu

U+30E6 (12518)

katakana letter yu

U+30E7 (12519)

katakana letter small yo

U+30E8 (12520)

katakana letter yo

U+30E9 (12521)

katakana letter ra

U+30EA (12522)

katakana letter ri

U+30EB (12523)

katakana letter ru

U+30EC (12524)

katakana letter re

U+30ED (12525)

katakana letter ro

U+30EE (12526)

katakana letter small wa

U+30EF (12527)

katakana letter wa

U+30F2 (12530)

katakana letter wo

U+30F3 (12531)

katakana letter N

U+30FC (12540)

katakana-hiragana prolonged sound mark

U+FFE5 (65509)

full width yen sign

Cameras

The QCar supports four onboard 8MP wide-angle cameras and one Intel RealSense D435 camera. While these are accessed using the Video3D Capture and Video Capture blocks, they are listed here for convenience:

Camera

Block

Device Identifier

Description

D435

Video3D Capture

0

The RealSense D435 RGDB camera which faces toward the front of the QCar. This camera supports four video streams: RGB (0), infrared left (1), infrared right (2) and depth (0).

8MP CSI

Video Capture

0

The CSI camera is an 8MP RGB camera with up to 3280x2464 resolution and 160 degree horizontal field of view. It faces the right side of the QCar. It supports frame rates up to 120 Hz (resolution-dependent).

8MP CSI

Video Capture

1

The CSI camera is an 8MP RGB camera with up to 3280x2464 resolution and 160 degree horizontal field of view. It faces the rear of the QCar. It supports frame rates up to 120 Hz (resolution-dependent).

8MP CSI

Video Capture

2

The CSI camera is an 8MP RGB camera with up to 3280x2464 resolution and 160 degree horizontal field of view. It faces the left side of the QCar. It supports frame rates up to 120 Hz (resolution-dependent).

8MP CSI

Video Capture

3

The CSI camera is an 8MP RGB camera with up to 3280x2464 resolution and 160 degree horizontal field of view. It faces the front of the QCar. It supports frame rates up to 120 Hz (resolution-dependent).

The CSI cameras are 8MP cameras with up to 3280x2464 resolution. The frame rates achievable at each resolution are listed for convenience in the table below:

Resolution

Maximum Frame Rate (FPS)

Horizontal Field of View

Vertical Field of View

3280x2464

21

100%

100%

1640x1232

80

100%

100%

820x616

80

100%

100%

1640x820

120

100%

67%

820x410

120

100%

67%

Other resolutions are achievable but will be scaled versions of the resolutions in the above table. Hence, resolutions with a different aspect ratio may appear distorted. Camera resolutions were designed to always provide the full horizontal field of view of the camera rather than provide common video resolutions.

The Intel RealSense D435 camera is a 2MP camera with up to 1920x1080 resolution for the RGB camera and up to 1280x720 resolution on the depth and infrared cameras. The frame rates achievable at each resolution are listed for convenience in the table below. The maximum frame rate of the RGB camera is 60 FPS and of the depth and infrared cameras is 100 FPS, if the appropriate resolution is selected.

Warning

Note that the achievable frame rate is affected by the exposure setting, so poor lighting will likely result in lower frame rates than those listed in the table below.

The maximum frame rates at each resolution are:

Camera

Resolution

Maximum Frame Rate (FPS)

Depth

1280x720

30

848x480

90

848x100

100

640x480

90

640x360

90

480x270

90

424x240

90

256x144

90

Infrared

1280x800

30

1280x720

30

848x480

90

848x100

100

640x480

90

640x360

90

480x270

90

424x240

90

256x144

90

RGB

1920x1080

30

1280x720

30

960x540

60

848x480

60

640x480

60

640x360

60

424x240

60

320x240

60

320x180

60

The Intel RealSense Viewer application is provided on the Quanser QCar for testing the RGBD camera. It may also be used for calibration and firmware updates of the RealSense camera. To run the Intel RealSense Viewer, run the realsense-viewer from a Terminal on the QCar. Turn on the Stereo Module and RGB Camera to see the depth and RGB output from the camera. To update the firmware or calibrate the camera, see the options under the More hamburger menu. Note that the images can be viewed in 2D or 3D mode using the "2D | 3D" options in the top, right. Options for the Stereo Module and RGB Camera may be adjusted by expanding the respective item.

Communications

The communications ports provided on the QCar board can be utilized through the QUARC Communications blockset and the Quanser Stream API (see QUARC Communications Protocols).

SPI

For SPI communications, a sample URI for communications would be:

spi://localhost:0?baud='1000000',polarity='off',phase='off',lsb='off',frame='0'

where the frame option selects the SPI SS line to frame the SPI bus transaction (0, 1 or 2).

I2C

For I2C communications, a sample URI for communications would be:

i2c://localhost:0?baud='400000',address=0x69

where the address option specifies the I2C slave address.

Serial

For serial communications, a sample URI for communications would be:

serial://localhost:1?baud='115200',word='8',parity='none',stop='1'

where the port determines whether UART 0 (port 0), UART 1 (port 1), UART 2 (port 2) or UART4 (port 4) is being used. UART 0 is recommended for generic serial devices. It supports baud rates up to 12.5 MBaud. Use UART4 for devices which require polarity inversion of the TX and RX lines, such as S.BUS receivers, as UART4 supports a polarity option to invert its signal polarity. UART4 is more CPU intensive however, but does support baud rates up to 6.25 MBaud (or even up to 25 Mbaud if baud rates are well matched). UART2 is used for the LIDAR, but if the LIDAR is unplugged then its UART may be used as a general-purpose serial port (for GPS or sonar, for example).

The Ranging Sensor block is typically used to talk to the LIDAR rather than using the serial port directly.

CAN Bus

Warning

The CAN bus signals provided on the QCar are not designed to connect directly to a differential CAN bus. To connect to a CAN bus, a transceiver such as the SN65HVD230DR must be used.

For CAN bus communications, a sample URI for communications would be:

can://localhost:0?flexible='1'

where the port determines whether CAN 0 (port 0) or CAN 1 (port 1) is being used. However, before using CAN bus, the CAN bus network interfaces must be configured. To configure CAN bus, first load the necessary kernel drivers using the commands:

sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
        

Then to bring up CAN 0 for CAN FD with a 500 kHz standard rate and 2 MHz data rate, use the commands:

sudo ip link set can0 type can bitrate 500000 sjw 4 dbitrate 2000000 dsjw 4 fd on berr-reporting on restart-ms 100
sudo ip link set up can0
        

Likewise for CAN 1:

sudo ip link set can1 type can bitrate 500000 sjw 4 dbitrate 2000000 dsjw 4 fd on berr-reporting on restart-ms 100
sudo ip link set up can1
        

The CAN interfaces will now be visible when using the ifconfig command, just like other network interfaces.

Summary

The communications channels are summarized in the table below:

Protocol

Port

Label

Sample URI

Comments

can

0

CAN0

can://localhost:0?flexible=1

Baud rates are determined when CAN bus network interfaces configured

 

1

CAN1

can://localhost:1?flexible=1

Baud rates are determined when CAN bus network interfaces configured

i2c

0

I2C0

i2c://localhost:0?baud=400e3,address=0x6B

Baud rate is fixed at 400 kHz

 

6

I2C6

i2c://localhost:6?baud=400e3,address=0x6B

Baud rate is fixed at 400 kHz

 

8

I2C8

i2c://localhost:8?baud=400e3,address=0x6B

Baud rate is fixed at 400 kHz

 

9

I2C9

i2c://localhost:9?baud=100e3,address=0x6B

Baud rate is programmable

serial

0

UART0

serial://localhost:0?baud=115200,parity=none,stop=1,flow=none

Includes hardware flow control signals RTS and CTS

 

1

UART1

serial://localhost:1?baud=115200,parity=none,stop=1,flow=none

No hardware flow control signals

 

2

UART2 (LIDAR)

serial://localhost:2?baud=115200,parity=none,stop=1,flow=none

Includes hardware flow control signals but RTS is inverted

 

4

UART4

serial://localhost:4?baud=115200,parity=none,stop=1,flow=none,polarity=0

No hardware flow control signals but supports polarity

spi

1

SPI1

spi://localhost:1?baud=10000000,polarity=off,phase=off,lsb=off,frame=0

1.8V signals

 

3

SPI3

spi://localhost:3?baud=10000000,polarity=off,phase=off,lsb=off,frame=0

3.3V signals

Audio

The Quanser QCar provides one speaker and four microphones. The microphones are located at the four corners of the car and marked with a microphone symbol for easy identification. The microphones are intended for applications such as user interaction or sound localization, such as detecting the direction from which a honk is heard. If the microphone samples are streamed to a stereo headset on the host PC, the stereo effect is readily apparent.

The two rear microphones are configured as left and right channels of a rear stereo microphone. The device identifier for this rear stereo microphone is "plughw:1,0". Note that only one block or model may open the rear stereo microphone at one time.

The two front microphones are configured as left and right channels of a front stereo microphone. The device identifier for this front stereo microphone is "plughw:1,1". Note that only one block or model may open the front stereo microphone at one time.

To read all four microphones as a single quadraphonic microphone, use the device identifier "plughw:1,2". The purpose of this quadraphonic microphone configuration is to open up the potential for 3D sound localization, such as tracking an overhead drone. Note that only one block or model may open the quadraphonic microphone at one time.

The recommended device identifier for the speaker is "demixer". The demixer device is dynamically assigned based on whether an HDMI monitor with audio support is connected to the car. When an HDMI monitor with audio support is connected, the demixer output will go to the monitor. If the monitor has stereo speakers then stereo sound can be produced. If no HDMI monitor is connected, then the demixer device will output to the car speaker. In this case, the two channels will be mixed as the speaker is monophonic. The demixer device has the additional advantage that it allows the output device to be shared by multiple blocks or models.

Warning

To force the output to the car speaker, use the device identifier "plughw:1,0". Note, however, that in this case access to the speaker will be exclusive. Other blocks or models will not be able to share the speaker. Hence, the "demixer" device is recommended.

The speaker may be used for honking, engine noises or even user interaction.

Clocks

There are currently no QCar clocks.

Analog Inputs

The QCar driver supports 7 analog inputs. Hence, analog input channel numbers range from 0 to 6. The analog input range is 0 to +3.3V and is not configurable. Exceeding this range may damage the board. Channels 0-3 are user analog inputs available on the J11 connector.

The current in Amperes used by the electronics is reported on analog input channel 4. This signal indicates how much of the battery current is being used to power the electronics.

The current in Amperes used by the motor is reported on analog input channel 5. This signal indicates how much of the battery current is being used to power the motor.

The battery level in Volts is reported at analog input channel 6. This signal should be monitored to ensure the battery does not degrade below safe levels, particularly for LiPo batteries. For instance, for a 3S battery, the voltage should not go below 10.5V. Note that the QCar contains emergency shutdown logic that will attempt to shut down the operating system and turn off the car if the battery voltage falls below 10V.

Analog Outputs

The Quanser QCar card does not support analog outputs.

Digital Inputs

The Quanser QCar supports 40 bidirectional digital I/O lines, as well as three user buttons which act as digital inputs. Hence digital input channel numbers range from 0 to 42. Digital lines 0-31 are available on the J15 connector while lines 32-39 are on the J11 connector. A digital I/O line cannot be used as an input and output at the same time.

Warning

Digital channels 0-15 are 3.3V, but digital channels 16-31 are 1.8V. The 1.8V digital I/O are not 3.3V tolerant so be careful not to apply more than 1.8V to channels 16-31!

Hint

Note that channels 24-39 have better performance than channels 0-23. Hence using the higher digital channels is recommended.

The first 40 digital I/O lines may be individually programmed as inputs or outputs on the Quanser QCar. All of those 40 channels which will be used for digital inputs should be configured on the HIL Initialize block's Digital Inputs tab. Set the Digital input channels field to all the digital I/O channels that will be used as digital inputs on the board for the current diagram. For example, enter 0:3 to designate channels 0 through 3 as digital inputs. Specify [0, 4, 5] to indicate that channels 0, 4 and 5 are to be configured as digital inputs.

Digital Outputs

The Quanser QCar supports 40 bidirectional digital I/O lines and one motor neutral control. Hence digital output channel numbers range from 0 to 40. Digital lines 0-31 are available on the J15 connector while lines 32-39 are on the J11 connector. A digital I/O line cannot be used as an input and output at the same time.

Warning

Digital channels 0-15 are 3.3V, but digital channels 16-31 are 1.8V. The 1.8V digital I/O are not 3.3V tolerant so be careful not to apply more than 1.8V to channels 16-31!

Hint

Note that channels 24-39 have better performance than channels 0-23. Hence using the higher digital channels is recommended.

The motor neutral control (channel 40) puts the car in "neutral" so that the car can coast. It is different from driving the motor PWM with zero, which would normally brake. As long as the motor neutral line is asserted the motor will not be driven by the motor PWM.

Since the first 40 digital I/O lines may be individually programmed as inputs or outputs on the Quanser QCar, all the channels which will be used for digital outputs should be configured on the HIL Initialize block's Digital Outputs tab. Set the Digital output channels field to all the bidirectional digital I/O channels that will be used as digital outputs on the board for the current diagram. For example, enter 0:3 to designate channels 0 through 3 as digital outputs. Specify [0, 4, 5] to indicate that channels 0, 4 and 5 are to be configured as digital outputs.

To set the digital output values when the model is loaded or unloaded, set the Initial digital outputs and Final digital outputs to the desired values respectively. If the vectors specified in these fields are shorter than the channel vector, the value of the last element in the vector will be used for the rest of the channels. Hence, a scalar value will apply to all channels specified in the Digital output channels field.

Encoder Inputs

The Quanser QCar supports five quadrature encoder inputs with 24-bit count values. Hence encoder channel numbers range from 0 to 4. Channel 0 is the motor encoder on connector J16. Channels 1-4 are user encoder channels available on connector J11.

In order to set the encoder counters to a particular count or to change the default quadrature when the model is loaded, the encoder inputs must be configured on the HIL Initialize block's Encoder Inputs tab. Set the Encoder input channels field to all the encoder channels that will be used on the board for the current diagram. For example, enter 1:3 to indicate channels 1 through 3 are used as encoder inputs. Specify [1, 3] to indicate that channels 1 and 3 are used as encoder inputs.

The Quanser QCar supports non-quadrature (count and direction) and 4X quadrature for all but the motor encoder. The motor encoder is always 4X quadrature. Since the Quanser QCar has 24-bit counters, valid initial count values range from -8,388,608 to +8,388,607. If the vectors specified in these fields are shorter than the channel vector, the value of the last element in the vector will be used for the rest of the channels. Hence, a scalar value will apply to all channels specified in the Encoder input channels field.

The Quanser QCar default sign convention in quadrature (4X) mode increments the encoder counter value when the B channel signal leads the A channel signal. Conversely, the encoder counter value is decreased when A leads B. This sign convention can be changed in the Board-Specific Options, with the enc0_dir option, for encoder channel 0, and with the enc1_dir, enc2_dir, enc3_dir and enc4_dir options for encoder channels 1 through 4, respectively. See the Board-Specific Options section below for more details.

PWM Outputs

The QCar driver supports 8 PWM output channels. Hence, PWM output channels range from 0 to 7. Each PWM channel is completely independent and can have its own duty cycle and frequency. PWM channel 0 drives the motor. Channels 1 through 7 are user PWM channels available on connector J11.

Warning

The first channel (0) on the QCar drives the motor and should be configured for standard duty cycle mode. The last seven channels (1-7) are available to the user for whatever purpose is required.

In order to configure the PWM mode or frequency, or to set the value of the PWM outputs when the model is loaded or unloaded, the PWM outputs must be configured on the HIL Initialize block's PWM Outputs tab. Set the PWM output channels field to all the PWM output channels that will be used on the board for the current diagram. For example, enter 2:4 to indicate channels 2 and 4. Specify 1 to indicate channel 1 alone.

The PWM outputs are generic PWM outputs that are capable of producing conventional PWM, as well as the standard analog ESC protocols, namely standard PWM (1000us to 2000us), Oneshot125 (125us to 250us), Oneshot42 (42us to 84us) and Multishot (5us to 25us). The digital DSHOT protocol may also be used for any of the PWM outputs by setting the appropriate board-specific option. See the pwm0_dshot help for details. DShot150, DShot300, DShot600 and DShot1200 are all supported.

The ESC Output block is recommended for constructing the input to the PWM output channel since it allows a 0% to 100% throttle value to be used, and it will output the appropriate pulse time (for PWM-based protocols) or raw value (in the case of DSHOT). Note that when using the ESC Output block, the PWM mode should be PWM_TIME_MODE (4) for PWM-based protocols and PWM_RAW_MODE (6) for DSHOT protocols.

The PWM parameters for each of these ESC protocols are tabulated below:

Protocol

PWM Frequency

Pulse Time Range

Duty Cycle Range

Standard PWM

50 Hz (20ms)

0.001 to 0.002 seconds (1ms to 2ms)

0.05 to 0.1 (5% to 10%)

Oneshot125

2000 Hz (500us)

125e-6 to 250e-6 seconds (125us to 250us)

0.25 to 0.5 (25% to 50%)

Oneshot42

5952 Hz (168us)

42e-6 to 84e-6 seconds (42us to 84us)

0.25 to 0.5 (25% to 50%)

Multishot

20000 Hz (50us)

5e-6 to 25e-6 seconds (5us to 25us)

0.1 to 0.5 (10% to 50%)

DShot150

150000 Hz

N/A

N/A

DShot300

300000 Hz

N/A

N/A

DShot600

600000 Hz

N/A

N/A

DShot1200

1200000 Hz

N/A

N/A

The PWM outputs are not restricted to these parameter values as they are generic PWM outputs. The maximum output frequency is 75 MHz. The number of bits of resolution decreases with increasing PWM output frequency.

Set the PWM output frequency (a.k.a., pulse rate) in the "Frequencies in Hz or duty cycle" field. The PWM output mode is typically set to duty cycle mode (0) or time mode (4) when driving ESCs or R/C servos. Set the Initial PWM outputs and Final PWM outputs fields to the desired initial and final output values respectively. The interpretation of these output values depends on the PWM mode selected. If the vectors specified in these fields are shorter than the channel vector, the value of the last element in the vector will be used for the rest of the channels. Hence, a scalar value will apply to all channels specified in the PWM output channels field. Likewise, for the PWM output mode for example, the default value is [0 0] so that the first '0' applies to the motor PWM, which must be duty cycle mode (0), and the second '0' applies to the rest of the PWM channels.

Other Inputs

The specific Other Input channels of the QCar board are described in the table below. SI units are used.

Other Input Channel

Measurement Description

Units

3000, 3001, 3002

Angular velocity around the x-, y-, and z-axis, respectively (from gyroscope)

(rad/s)

4000, 4001, 4002

Linear acceleration along the x-, y-, and z-axis, respectively (from accelerometer)

(m/s2)

8000, 8001, 8002

Magnetic field along the x-, y-, and z-axis, respectively (from magnetometer)

(T)

10000

Temperature of accelerometer sensor.

(C)

14000, 14001, 14002, 14003, 14004

Encoder velocities for the motor encoder (14000) and encoder channels 1-4 (14001-14004). The time between encoder pulses is measured by hardware with 10ns resolution. Velocities between 12 counts/s and 100 million counts/s may be measured.

(counts/s)

As a reference, the generic table for the Other Inputs channels for any HIL Data Acquisition Card is reproduced below. SI units are used.

Other Input Channel

Measurement Description

Units

0 - 999

Linear Position Along The X-, Y-, and Z-axis

(m)

1000 - 1999

Angular Position Around The X-, Y-, and Z-axis

(rad)

2000 - 2999

Linear Velocity Along The X-, Y-, and Z-axis

(m/s)

3000 - 3999

Angular Velocity Around The X-, Y-, and Z-axis

(rad/s)

4000 - 4999

Linear Acceleration Along The X-, Y-, and Z-axis

(m/s2)

5000 - 5999

Angular Acceleration Around The X-, Y-, and Z-axis

(rad/s2)

6000 - 6999

Force Along The X-, Y-, and Z-axis

(N)

7000 - 7999

Torque Around The X-, Y-, and Z-axis

(N.m)

8000 - 8999

Magnetic Field Along The X-, Y-, and Z-axis

(T)

9000 - 9999

Pressure Along The X-, Y-, and Z-axis

(Pa)

10000 - 10999

Temperature Along The X-, Y-, and Z-axis

(°C)

11000 - 11999

Operating capacity as a percentage (0.0 to 1.0 represending 0% to 100%)

(%)

12000 - 12999

Time

(s)

Note that the IMU may be read at any time, but measurements are updated internally at a fixed 2 kHz rate. The gyroscope and accelerometer can produce new values at this rate, but the magnetometer is much slower (e.g. 20 Hz). The output data rate for the different IMU components may be set in the board-specific options (see below).

Other Outputs

The specific Other Output channels of the QCar board are described in the table below. SI units are used.

Other Output Channel

Measurement Description

Units

1000

Steering angle

(rad)

11000

Brake lights LED intensity

(%)

11001

Reverse lights LED intensity

(%)

11002

Left headlight LED intensity

(%)

11003

Right headlight LED intensity

(%)

11004, 11005, 11006, 11007

User LED0-LED3 intensities

(%)

11008

Left rear signal LED intensity

(%)

11009

Right rear signal LED intensity

(%)

11010

Left front signal LED intensity

(%)

11011

Right front signal LED intensity

(%)

The steering angle is tranlated into an RC servo command that is sent to the steering servomotor connected to J23.

Interrupts

The Quanser QCar card, or its driver, does not support any interrupt sources.

Watchdog

The Quanser QCar contains a programmable 16-bit watchdog timer. The timer may be programmed with any interval between 81.88 microseconds and 2.684 seconds. The board will reset the PWM outputs to zero when the watchdog expires. Resetting of the outputs occurs without software intervention, and therefore may be used as a safety mechanism in the event of software failure. The PWM output values when the watchdog timer expires are not configurable.

Place a HIL Watchdog block in the diagram to program the 16-bit watchdog timer. This block also reloads the watchdog each time it is executed.

Once the watchdog has expired, further I/O is disabled until the watchdog state is cleared.

Hence, in Simulink models, the PWM outputs will remain zero after watchdog expiration even after the model is stopped, unless a HIL Watchdog Clear block is used to clear the watchdog state. Restarting the model also causes the watchdog state to be cleared, allowing the PWM outputs to be used once more. These semantics make the watchdog useful for ensuring product safety.

Board-Specific Options

The Quanser QCar has a number of board-specific options to control specialized functionality of the QCar. These options configure the IMU and set the encoder directions.

gyro_fs

This option sets the full-scale range of the gyroscope sensor. Valid values range from 125 to 2000. The units are degrees per second.

gyro_rate

This option sets the gyroscope sensor's sampling rate. Valid values range from 12 to 523. The units are Hz.

accel_fs

This option configures the full-scale range of the accelerometer. Valid values are 2 to 16. The units are g's.

accel_rate

This option sets the accelerometer's sampling rate. Valid values range from 7.8125 to 2000. The units are Hz.

mag_rate

This option sets the magnetometer's sampling rate. Valid values range from 2 to 30. The units are Hz.

mag_xy

This option sets the number of repetitions the magnetometer performs for the X and Y axes. Valid values range from 1 to 511.

mag_z

This option sets the number of repetitions the magnetometer performs for the Z axis. Valid values range from 1 to 256.

enc1_dir

Set this option to "yes", "y" or "1" to reverse the direction of encoder 1. This feature makes it easier to migrate to the Quanser QCar hardware from another data acquisition card. It also allows models to be more portable to other cards. The direction of the motor encoder cannot be changed.

Similar options exist for the other encoder channels i.e., enc2_dir, enc3_dir and enc4_dir.

pwm1_dshot

Set this option to "yes", "y" or "1" to enable DSHOT on PWM output 1. When DSHOT is enabled, the only PWM mode supported is raw mode (6), and the input to the PWM output channel be a 16-bit value representing the bits of the DSHOT packet (where the most-significant bit is sent first). The motor PWM output does not support DSHOT.

This 16-bit value should be constructed using the ESC Output block with the DSHOT protocol selected. This block allows the throttle, telemetry request and command to be used to construct the 16-bit packet.

Similar options exist for the other PWM channels i.e., pwm2_dshot ... pwm7_dshot.

steer_bias

The QCar chassis sometimes has a bias in the steering so that driving the steering output with zero does not produce a zero angle on the wheels i.e., the car may not drive in a straight line when the steering output is set to zero. To adjust for this bias, the steer_bias option may be used to add a small offset to the steering output to eliminate this bias. The value specified should be in radians and may be positive or negative as appropriate. Suitable values are typically between 0.03 and 0.09.

Properties

The Quanser QCar card does not support any properties.

Connectors

The QCar board has a number of connectors for expansion I/O. These connectors and their pinouts are listed below.

Warning

Note that all pins are 3.3V and are not 5V tolerant unless marked otherwise. Be aware that some of the digital I/O are 1.8V and are not 3.3V tolerant. The analog inputs only support 0 to +3.3V. Exceeding these voltages may damage the board!

J10 Connector (I2C)

Ground

1615

1.8V

Ground

1413

5V

Ground

1211

3.3V

I2C 0 SDA

109

I2C 0 SCL

I2C 6 SDA

87

I2C 6 SCL

I2C 8 SDA

65

I2C 8 SCL

Ground

43

3.3V

I2C 9 SDA

21

I2C 9 SCL

J11 Connector (GPIO, ENCs, PWMs and ADCs)

GPIO 24

4039

GPIO 32

GPIO 25

3837

GPIO 33

GPIO 26

3635

GPIO 34

GPIO 27

3433

GPIO 35

GPIO 28

3231

GPIO 36

GPIO 29

3029

GPIO 37

GPIO 30

2827

GPIO 38

GPIO 31

2625

GPIO 39

ENC4 B / DIR5

2423

ENC4 A / CNT5

ENC1 B / DIR5

2221

ENC1 A / CNT5

ENC2 B / DIR5

2019

Ground

ENC2 A / CNT5

1817

3.3V

ENC3 B / DIR5

1615

Ground

ENC3 A / CNT5

1413

5V

PWM1

1211

Ground

PWM2

109

PWM5

PWM3

87

PWM6

PWM4

65

PWM7

ADC0

43

ADC2

ADC1

21

ADC3

5 5V tolerant input pins

J12 Connector (User LED)

User LED3 (sink)

5

User LED2 (sink)

4

User LED1 (sink)

3

User LED0 (sink)

2

3.3V

1

J15 Connector (CPU GPIO)

GPIO 23 (1.8V)

2625

GPIO 22 (1.8V)

GPIO 21 (1.8V)

2423

GPIO 20 (1.8V)

GPIO 19 (1.8V)

2221

GPIO 18 (1.8V)

GPIO 17 (1.8V)

2019

GPIO 16 (1.8V)

GPIO 15 (1.8V)

1817

GPIO 14 (1.8V)

GPIO 13 (1.8V)

1615

GPIO 12 (1.8V)

Ground

1413

Ground

GPIO 11

1211

GPIO 10

GPIO 9

109

GPIO 8

GPIO 7

87

GPIO 6

GPIO 5

65

GPIO 4

GPIO 3

43

GPIO 2

GPIO 1

21

GPIO 0

J16 Connector (Motor Encoder)

ENC Motor B5

5

5V

4

ENC Motor A5

3

NC ―

2

Ground

1

5 5V tolerant input pins

J17 Connector (LIDAR1)

UART2 RTSn

5

Ground

4

UART2 TX

3

UART2 RX

2

5V

1

1 This connector cannot be used at the same time as J24.

J19 Connector (CAN)

Ground

1211

3.3V

CAN0 TX

109

CAN wake

CAN0 error

87

CAN1 error

Ground

65

CAN1 TX

CAN0 RX

43

CAN1 RX

3.3V

21

CAN1 standby

J20 Connector (SPI and UART)

Ground

2019

SPI3 SS

SPI3 SCLK

1817

SPI3 MISO

3.3V

1615

SPI3 MOSI

UART0 CTS

1413

UART0 RX

UART0 TX

1211

UART0 RTS

UART1 CTS

109

UART1 RX

UART1 TX

87

UART1 RTS

UART4 TX

65

UART4 RX

Ground

43

3.3V

Ground

21

5V

J21 Connector (SPI)

Ground

5

SPI1 MISO (1.8V)

4

SPI1 SCLK (1.8V)

3

SPI1 MOSI (1.8V)

2

SPI1 SS (1.8V)

1

J23 Connector (Steering)

Ground

3

5V

2

RC steering

1

J24 Connector (LIDAR1)

Ground

7

UART2 TX

6

UART2 RX

5

5V

4

Ground

3

UART2 RTSn

2

5V

1

1 This connector cannot be used at the same time as J17.

Legend

→▯←

=

input

←▯→

=

output

↔▯↔

=

bidirectional I/O

=

1.8V signal

=

3.3V signal

=

power

=

ground

Targets

Target

Supported

Comments

QUARC Win32 Target

No

Not supported.

QUARC Win64 Target

No

Not supported.

QUARC Linux Nvidia Target

Yes

Fully supported.

QUARC Linux QBot Platform Target

No

Not supported.

QUARC Linux QCar 2 Target

No

Not supported.

QUARC Linux QDrone 2 Target

No

Not supported.

QUARC Linux Raspberry Pi 3 Target

No

Not supported.

QUARC Linux Raspberry Pi 4 Target

No

Not supported.

QUARC Linux Raspberry Pi ARM64 Target

No

Not supported.

QUARC Linux RT ARMv7 Target

No

Not supported.

QUARC Linux x64 Target

No

Not supported.

QUARC Linux DuoVero Target

No

Not supported.

QUARC Linux DuoVero 2016 Target

No

Not supported.

QUARC Linux Verdex Target

No

Not supported.

QUARC QNX x86 Target

No

Not supported.

Rapid Simulation (RSIM) Target

Yes

Supported with no communication to the hardware.

Normal simulation

Yes

Supported with no communication to the hardware.

 

navigation bar