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 2

The Quanser's Quanser QCar 2 is a scale-model car built and sold by Quanser Inc. The QUARC Target associated with the Quanser QCar 2 is the QUARC Linux QCar 2 Target. The QCar 2 driver provides access to the hardware I/O available on the QCar 2 platform. The QCar 2 includes an NVIDIA Jetson AGX Orin board with an ARM Cortex-A78AE processor (2.2 GHz, eight core, 64 bit) as well as an NVidia GPU (930 MHz, 1792 CPU cores, 56 Tensor cores, Ampere 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. There is also a Pi connector for an additional IMX219, IMX477 or OV9281 camera. The additional I/O includes:

The QUARC driver name for this card is qcar2.

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

Quanser Standard Reference Frame

To select the Quanser QCar 2 board, select the QUARC qcar2 board type from the drop-down list on the Main tab of the HIL Initialize block. Please note that only one QCar 2 card can be connected to a Quanser QCar 2 and is supported in the system. The QUARC controller runs on the NVIDIA Jetson AGX Orin board.

Warning

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

The Quanser QCar 2 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.

The Quanser QCar 2 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. 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-C On-the-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.

Warning

The Quanser QCar 2 implements overcurrent protection to prevent damage to the motor. If an overcurrent condition is detected, the motor will be disabled until the user's application is restarted or the car is rebooted. An overcurrent condition is detected if the motor current exceeds 5A for 2 seconds, or 10A for 0.5 seconds, or 15A for 0.125 seconds.

Configuration

The Quanser QCar 2 is configured for the 3S battery supplied with the vehicle. The car does not support using a 4S battery. The car will shut down if a 4S battery is used.

Display

The LCD display normally displays the battery voltage, disk usage, CPU usage, hostname, WiFi SSID, WiFi IP address, LAN IP address and QUARC version on the QCar. It also shows the current WiFi signal strength. 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 2 and indicates it is booting Ubuntu.

Battery voltage. No IP address has been obtained yet.

Battery voltage and WiFi IP address. No LAN address.

Battery voltage and LAN IP address. No WiFi address.

Battery voltage and both WiFi and LAN IP addresses.

The battery is low. The QCar may soon shut down. Save your work.

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

The red power button has been held for more than four seconds. Releasing it will cause an immediate power-down (not recommended).

An overcurrent condition has been detected. It will not be possible to drive the motors until the condition is cleared. To clear the condition, re-run your application.

The AGX Orin has not been detected. This warning can indicate a severe problem with the board. Power the board off and ensure the AGX Orin is seated properly and securely mounted with the screws. If it is still not detected the car will need to be returned to Quanser for further inspection.

The LCD display on Quanser QCar 2 is a graphical black and white LCD display. QUARC supports writing text or graphics to the display using the LCD Display block. To use the LCD Display block, set the LCD to LS027B7DH01 and the URI to spi://localhost:1?word=8,baud=45000000,polarity=on,phase=on,memsize=8192,frame=0. The display supports normal mode or dark mode, as well as an image or text. It can also rotate the display. To format text for the display, use the String Print block, which supports a superset of standard C format strings. The display currently supports the Basic Latin character set as well as the Latin-1 Supplement. For images, the resolution of the display is 400 x 240 pixels. Greyscale images will be thresholded at mid-luminance to produce the black and white output. For optimal display of images, use the Image transform block with the Dither (1-bit) algorithm to convert grayscale images to black and white.

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 2 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.

The Quanser QCar 2 also supports three different cameras on its Pi connector: the IMX219 (Pi RGB camera), the IMX477 (high-quality Pi RGB camera) and the OV9281 (greyscale global-shutter). To select the camera to use, the jetson-io tool is provided. Run the jetson-io tool by opening a terminal on the Quanser QCar 2 and running the following command:

sudo /opt/nvidia/jetson-io/jetson-io.py

The following page will be presented:

Jetson IO main page

Select the Configure Jetson AGX CSI Connector option using the cursor keys and then press Enter to open the connector page, shown below.

Jetson IO connector page

Then select the Configure for compatible hardware option using the cursor keys and press Enter to open the compatible hardware page, illustrated below.

Jetson IO cameras page

Choose the relevant camera with the cursor keys and press Enter. The camera will be selected and the menu will return to the compatible hardware page. However, this time there will be options to discard the changes or save the changes:

Jetson IO save or discard pin changes

Save the changes by selecting Save pin changes using the cursor keys and pressing Enter. To discard the changes, select Discard pin changes instead. When saving the changes, the following page will appear:

Jetson IO save/reboot

Choose the Save and exit without rebooting option using the cursor keys and then press Enter to complete the operation. The final exit page will be shown:

Jetson IO final exit

Press Enter to exit the Jetson I/O application. Then shut down the Quanser QCar 2 using the user interface or by issuing a shutdown command:

sudo shutdown now

Connect the selected camera to the Pi connector and power-up the car. The camera should now be available for use.

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 or 1).

I2C

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

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

where the address option specifies the I2C slave address. Valid ports are 1 or 7 for I2C1 and IC27 respectively. Note that I2C1 is 3.3V while I2C7 is 1.8V.

Warning

The 1.8V lines are not 3.3V tolerant so be careful not to apply more than 1.8V I2C7!

Serial

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

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

where the port determines whether UART 0 (port 0), UART 1 (port 1) or UART 2 (port 2) is being used. UART 0 is recommended for generic serial devices. It supports baud rates up to 12.5 MBaud. UART2 is more CPU intensive. UART1 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

1

I2C1

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

Baud rate is fixed at 400 kHz, 3.3V pins.

 

7

I2C7

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

Baud rate is fixed at 400 kHz, 1.8V only!

serial

0

UART0

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

Includes hardware flow control signals RTS and CTS

 

1

UART1 (LIDAR)

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

No hardware flow control signals. Only use if LIDAR not present.

 

2

UART2

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

No hardware flow control signals.

spi

0

SPI0

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

Supports two chip selects (0 and 1).

Audio

The Quanser QCar 2 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 5 analog inputs. Hence, analog input channel numbers range from 0 to 4. The analog input range is 0 to +3.3V and is not configurable. Exceeding this range may damage the board. Channels 0-1 are user analog inputs available on the J11 connector.

The battery level in Volts is reported at analog input channel 2. This signal should be monitored to ensure the battery does not degrade below safe levels, particularly for LiPo batteries. For the 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.

The current in Amperes used by the electronics is reported on analog input channel 3. 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 4. This signal indicates how much of the battery current is being used to power the motor.

Analog Outputs

The Quanser QCar 2 card does not support analog outputs.

Digital Inputs

The Quanser QCar 2 supports 11 bidirectional digital I/O lines, as well as three user buttons and an overcurrent condition indicator which act as digital inputs. Hence digital input channel numbers range from 0 to 14. Digital lines 0-4 are available on the J10 connector while lines 5-10 are on the J11 connector. A digital I/O line cannot be used as an input and output at the same time.

Warning

All digital channels are 3.3V.

Hint

Note that channels 0-4 have better performance than channels 5-10. Hence using the lower digital channels is recommended.

The first 11 digital I/O lines may be individually programmed as inputs or outputs on the Quanser QCar 2. All of those 11 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 2 supports 11 bidirectional digital I/O lines and sixteen LEDs for lights and turn signals. Hence digital output channel numbers range from 0 to 26. Digital lines 0-4 are available on the J10 connector while lines 5-10 are on the J11 connector. A digital I/O line cannot be used as an input and output at the same time.

Warning

All the digital channels are 3.3V.

Hint

Note that channels 0-4 have better performance than channels 5-10. Hence using the lower digital channels is recommended.

Since the first 11 digital I/O lines may be individually programmed as inputs or outputs on the Quanser QCar 2, 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 2 supports three quadrature encoder inputs with 24-bit count values. Hence encoder channel numbers range from 0 to 2. Channel 0 is the motor encoder on connector J24. Channels 1-2 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 0:2 to indicate channels 0 through 2 are used as encoder inputs. Specify [0, 2] to indicate that channels 0 and 2 are used as encoder inputs.

The Quanser QCar 2 supports 2x-quadrature and 4X quadrature. Since the Quanser QCar 2 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 2 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 and enc2_dir options for encoder channels 1 through 2, respectively. See the Board-Specific Options section below for more details.

PWM Outputs

The QCar driver supports 2 PWM output channels. Hence, PWM output channels range from 0 to 1. The PWM channels must share the same PWM frequency. However, each channel can have its own duty cycle. PWM channels available on connector J11.

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 0:1 to indicate channels 0 and 1. 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 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). Note that when using the ESC Output block, the PWM mode should be PWM_TIME_MODE (4) for PWM-based 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%)

The PWM outputs are not restricted to these parameter values as they are generic PWM outputs. The maximum output frequency is 180 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 Quanser QCar 2 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)

10000

Temperature of IMU sensor.

(C)

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 32 kHz rate. The gyroscope and accelerometer can produce new values at this rate. 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 Quanser QCar 2 board are described in the table below. SI units are used.

Other Output Channel

Measurement Description

Units

1000

Steering angle

(rad)

11000

LED red intensity

(%)

11001

LED green intensity

(%)

11002

LED blue intensity

(%)

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

Interrupts

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

Watchdog

The Quanser QCar 2 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 digital outputs 5-10, PWM outputs 0 and 1, and other outputs to the user-configured values 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. Note that digital outputs 0-4 cannot be reset on watchdog expiration and the steering analog and motor throttle may only be reset to zero.

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 outputs will remain reset 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 outputs to be used once more. These semantics make the watchdog useful for ensuring product safety.

Board-Specific Options

The Quanser QCar 2 has a number of board-specific options to control specialized functionality of the Quanser QCar 2. 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 15.625 to 2000. The units are degrees per second.

gyro_rate

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

gyro_ord

This option sets the gyroscope sensor's filter order. Valid values range from 1 to 3.

gyro_bw

This option sets the gyroscope sensor's filter bandwidth. Valid values range from 10 to 16000. 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 12.5 to 32000. The units are Hz.

accel_ord

This option sets the accelerometer sensor's filter order. Valid values range from 1 to 3.

accel_bw

This option sets the accelerometer sensor's filter bandwidth. Valid values range from 10 to 16000. The units are Hz.

enc0_dir

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

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

steer_bias

The QCar 2 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.

temp_bw

This option sets the temperature sensor's filter bandwidth. Valid values range from 5 to 4000. The units are Hz.

Properties

The Quanser QCar 2 supports the following integer properties:

Property Name

Property Code

Description

PROPERTY_INTEGER_FIRMWARE_MAJOR_VERSION

10

The major version of the firmware.

PROPERTY_INTEGER_FIRMWARE_MINOR_VERSION

11

The minor version of the firmware.

PROPERTY_INTEGER_FIRMWARE_BUILD

12

The build of the firmware.

PROPERTY_INTEGER_FIRMWARE_REVISION

13

The PCB revision.

PROPERTY_INTEGER_NUMBER_OF_ANALOG_INPUTS

16

The number of analog input channels.

PROPERTY_INTEGER_NUMBER_OF_ENCODER_INPUTS

17

The number of encoder input channels.

PROPERTY_INTEGER_NUMBER_OF_DIGITAL_INPUTS

18

The number of potential digital input channels.

PROPERTY_INTEGER_NUMBER_OF_OTHER_INPUTS

19

The number of other input channels.

PROPERTY_INTEGER_NUMBER_OF_ANALOG_OUTPUTS

20

The number of analog output channels.

PROPERTY_INTEGER_NUMBER_OF_PWM_OUTPUTS

21

The number of PWM output channels.

PROPERTY_INTEGER_NUMBER_OF_DIGITAL_OUTPUTS

23

The number of potential digital output channels.

PROPERTY_INTEGER_NUMBER_OF_OTHER_OUTPUTS

24

The number of other output channels.

PROPERTY_INTEGER_NUMBER_OF_CLOCKS

25

The number of clocks.

PROPERTY_INTEGER_NUMBER_OF_INTERRUPTS

26

The number of interrupt channels.

Connectors

The Quanser QCar 2 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 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

2423

3.3V

UART1 RX

2221

1.8V

UART1 CTS

2019

UART1 RTS

DIO0

1817

UART1 TX

DIO1

1615

SPI0 CS0

DIO2

1413

SPI0 CS1

DIO3

1211

SPI0 MOSI

DIO4

109

SPI0 MISO

I2C1 SDA

87

SPI0 CLK

I2C1 SCL

65

Ground

I2C7 SDA

43

DEBUG RX

I2C7 SCL

21

DEBUT TX

J11 Connector (GPIO, ENCs, PWMs and ADCs)

5V

2019

3.3V

ENC1 A5

1817

ENC2 A5

ENC1 B5

1615

ENC2 B5

PWM1

1413

UART2 RX

PWM2

1211

UART2 TX

DIO5

109

DIO8

DIO6

87

DIO9

DIO7

65

DIO10

ADC0

43

ADC1

Ground

21

Ground

5 5V tolerant input pins

J19 Connector (CAN)

3.3V

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

J24 Connector (Motor Encoder)

ENC Motor B5

5

5V

4

ENC Motor A5

3

NC ―

2

Ground

1

5 5V tolerant input pins

J25 Connector (Steering)

Ground

3

5V

2

RC steering

1

J26 Connector (LIDAR)

5V

5

UART1 RX

4

UART1 TX

3

Ground

2

UART1 RTSn

1

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

No

Not supported.

QUARC Linux QBot Platform Target

No

Not supported.

QUARC Linux QCar 2 Target

Yes

Fully 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

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Supported with no communication to the hardware.

Normal simulation

Yes

Supported with no communication to the hardware.

 

navigation bar