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 QBot 3

The Quanser QBot 3 is an Unmanned Ground Vehicle (UGV) built and sold by Quanser Inc. The Quanser QBot 3 is based around a Raspberry Pi 4, which has a quad-core 1.5 GHz ARM Cortex-A72 processor with 4 GB RAM running Raspbian. The QUARC Target associated with the Quanser QBot 3 is the QUARC Raspberry Linux Pi 4 Target. The Quanser QBot 3 HIL card may only be used with QUARC when this target is selected. The following characteristics are of particular interest when using the Quanser QBot 3 with QUARC:

* Communications channels are accessed through the Stream API blocks, see Serial protocol, SPI protocol and I2C protocol.

The Quanser QBot 3 also supports specialized quantities such as the following:

The QUARC driver name for this card is qbot3.

To select the Quanser QBot 3 HIL board, select the QUARC qbot3 board type from the drop-down list on the Main tab of the HIL Initialize block.

Warning

Note that the QUARC Raspberry Linux Pi 4 Target must be selected to use the Quanser QBot 3 board.

The Quanser QBot 3 supports 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 Raspbian Pi OS 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 QBot 3 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.

Display

The LCD display on the Quanser QBot 3 typically displays the battery voltage and IP address of the card, as well as status messages.

The LCD display on the Quanser QBot 3 may also be driven from QUARC using the LCD Display block. Select the ST7066U display.

The URI to use for this display is serial://qbot3:0?baud=921600,device='/dev/qbot3_lcd'.

Warning

The LCD has a refresh rate of 84.7 Hz, thus it would not show the display characters if the LCD is being written faster than that. In certain conditions, if the LCD is not able to keep up, a message Writing to LCD too fast will be shown on the LCD. Please power cycle the Quanser QBot 3 in order resolve this.

Communications

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

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

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

where the frame option selects the SPI CE line to frame the SPI bus transaction (0 or 1). Note that the SPI port must be enabled using the raspi-config utility for SPI communications to be used. Once the SPI port is enabled, the corresponding digital I/O (pins 19, 21, 23, 24 and 26) will no longer be available as digital I/O.

SPI can also be enabled via the file by setting spi=on in the Device Tree Overlay parameters. For example:

dtparam=spi=on

After changing , reboot the Raspberry Pi for the changes to take effect.

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. Note that the I2C port must be enabled using the raspi-config utility for I2C communications to be used. Once the I2C port is enabled, the corresponding digital I/O (pins 3 and 5) will no longer be available as digital I/O.

To set the baud rate for the I2C, the file must be edited and the Raspbery Pi rebooted. For example, to enable I2C and set the I2C baud rate to 400000 baud, change the Device Tree Overlay parameters to:

dtparam=i2c_arm=on,i2c_arm_baudrate=400000

After changing , reboot the Raspberry Pi for the changes to take effect.

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

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

Configuring the Quanser QBot 3 to support serial communications is a bit more involved. Edit the to add the line:

dtoverlay=uart5,ctsrts=on

After changing , reboot the Raspberry Pi for the changes to take effect. Use the raspi-gpio get command to confirm that the TxD (GPIO 12), RxD (GPIO 13) CTS (GPIO 14), and RTS (GPIO 15) pins for the UART are in alt=4 mode. The serial port is /dev/ttyAMA1.

Clocks

There are currently no configuration options for the Quanser QBot 3 clocks.

Analog Inputs

The Quanser QBot 3 supports 6 analog inputs. Hence, analog input channel numbers range from 0 to 5. The full suite of analog inputs are enumerated in the table below:

Channel

Description

0

Battery voltage (typically 16.7V when fully charged)

1

Raw voltage from right cliff sensor1

2

Raw voltage from central cliff sensor1

3

Raw voltage from left cliff sensor1

4

Right motor current in Amps.

5

Left motor current in Amps.

1 For the non-linear relationship between the raw voltage from a cliff sensor to actual distance, refer to the Sharp Analog Output Type Distance Measuring Sensor Data Sheet.

Analog Outputs

The Quanser QBot 3 card does not support analog outputs.

Digital Inputs

The Quanser QBot 3 supports 59 digital inputs. The first 28 channels are user-accessible reconfigurable digital I/O lines that may be used as digital inputs. Channels 0 and 1, however, are reserved for a HAT EEPROM I2C interface. A digital I/O line cannot be used as an input and output at the same time. Nor can it be used for communications (SPI, I2C or UART) or PWM at the same time. The full suite of digital inputs are enumerated in the following table:

Since the digital I/O lines may be individually programmed as inputs or outputs on the Quanser QBot 3, all 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 2:4 to designate channels 2 through 4 as digital inputs. Specify [2, 4, 5] to indicate that channels 2, 4 and 5 are to be configured as digital inputs.

Channel

Description

0-27

User-accessible bidirectional digital I/O lines. Note that channels 0 and 1 are reserved by the O/S for identifying custom Pi 4 daughterboards and cannot be used.

28

Right bumper (0 = not pressed, 1 = pressed)

29

Central bumper (0 = not pressed, 1 = pressed)

30

Left bumper (0 = not pressed, 1 = pressed)

31

Right wheel drop (0 = wheel up, 1 = wheel down)

32

Left wheel drop (0 = wheel up, 1 = wheel down)

33

Right cliff (0 = no cliff, 1 = cliff detected)

34

Central cliff (0 = no cliff, 1 = cliff detected)

35

Left cliff (0 = no cliff, 1 = cliff detected)

36

Button B0 (0 = not pressed, 1 = pressed)

37

Button B1 (0 = not pressed, 1 = pressed)

38

Button B2 (0 = not pressed, 1 = pressed)

39

Right motor overcurrent (0 = normal operation, 1 = overcurrent detected)

40

Left motor overcurrent (0 = normal operation, 1 = overcurrent detected)

41

Right dock IR near right sensor (0 = not detected, 1 = detected)

42

Right dock IR near center sensor (0 = not detected, 1 = detected)

43

Right dock IR near left sensor (0 = not detected, 1 = detected)

44

Right dock IR far right sensor (0 = not detected, 1 = detected)

45

Right dock IR far center sensor (0 = not detected, 1 = detected)

46

Right dock IR far left sensor (0 = not detected, 1 = detected)

47

Central dock IR near right sensor (0 = not detected, 1 = detected)

48

Central dock IR near center sensor (0 = not detected, 1 = detected)

49

Central dock IR near left sensor (0 = not detected, 1 = detected)

50

Central dock IR far right sensor (0 = not detected, 1 = detected)

51

Central dock IR far center sensor (0 = not detected, 1 = detected)

52

Central dock IR far left sensor (0 = not detected, 1 = detected)

53

Left dock IR near right sensor (0 = not detected, 1 = detected)

54

Left dock IR near center sensor (0 = not detected, 1 = detected)

55

Left dock IR near left sensor (0 = not detected, 1 = detected)

56

Left dock IR far right sensor (0 = not detected, 1 = detected)

57

Left dock IR far center sensor (0 = not detected, 1 = detected)

58

Left dock IR far left sensor (0 = not detected, 1 = detected)

Note that the dock IR signals may oscillate when the IR signal is detected. This oscillation is a function of the way the docking IR signals work.

Digital Outputs

The Quanser QBot 3 supports 36 digital outputs. The first 28 channels are user-accessible reconfigurable digital I/O lines that may be used as digital outputs. Channels 0 and 1, however, are reserved for a HAT EEPROM I2C interface. A digital I/O line cannot be used as an input and output at the same time. Nor can it be used for communications (SPI, I2C or UART) or PWM at the same time.

Since the digital I/O lines may be individually programmed as inputs or outputs on the Quanser QBot 3, 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 2:4 to designate channels 2 through 4 as digital outputs. Specify [2, 4, 5] to indicate that channels 2, 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.

The full suite of digital outputs are enumerated in the following table:

Channel

Description

0-27

User-accessible bidirectional digital I/O lines. Note that channels 0 and 1 are reserved by the O/S for identifying custom Pi 4 daughterboards and cannot be used.

28

Chassis LED1 red

29

Chassis LED1 green

30

Chassis LED2 red

31

Chassis LED2 green

32

Enable 3.3V power

33

Enable 5V power

34

Enable 12V/5A power1

35

Enable 12V/1.5A power

1 Disabling the 12V/5A power will power down the Raspbery Pi 3 processor. The chassis will have to be turned off and back on in order to restore power and wireless communications with the Pi 4 target.

Encoder Inputs

The Quanser QBot 3 supports two encoder inputs. The encoder channels are enumerated in the table below:

Channel

Description

0

Right wheel

1

Left wheel

In order to set the encoder counters to a particular count, 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:1 to indicate channels 0 through 1 are used as encoder inputs.

PWM Outputs

The Quanser QBot 3 driver supports up to 2 PWM output channels. Hence, PWM output channels range from 0 to 1. Each PWM channel is completely independent and can have its own duty cycle and frequency.

Before the PWM channels may be used, they must be configured in the file and in the board-specific options. The file must be edited with root privileges. For example, to use the vi editor, enter the command:

sudo vi /boot/config.txt

in a terminal window.

The lines which must be added to the file depend on the number of PWM channels desired, and the pins to which they are assigned. The following table documents the lines that must be added to the file for each combination of options:

PWM 0

PWM 1

Line to Add

disabled

disabled

Do not add any lines

GPIO 18

disabled

dtoverlay=pwm,pin=18,func=2

disabled

GPIO 19

dtoverlay=pwm,pin=19,func=2

GPIO 18

GPIO 19

dtoverlay=pwm-2chan,pin=18,func=2,pin2=19,func2=2

Warning

Note that once a GPIO is configured as a PWM channel then it will no longer be recognized as a digital I/O line.

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 the standard analog ESC protocols, namely standard PWM (1000us to 2000us), Oneshot125 (125us to 250us), Oneshot42 (42us to 84us) and Multishot (5us to 25us). They may also be used to drive R/C servos.

The PWM parameters for each of these 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

11905 Hz (84us)

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

Other Inputs

The Quanser QBot 3 supports eight other input channels. The other input channels are defined as follows:

Other Input Channel

Description

Units

1002

Angle in Z-axis

(rad)

3000

Gyroscope in X

(rad/s)

3001

Gyroscope in Y

(rad/s)

3002

Gyroscope in Z

(rad/s)

11000

Right wheel PWM

(%)

11001

Left wheel PWM

(%)

12000

Timestamp

(s)

16000

Charger state

1

1 The charger state takes on discrete values depending on whether the docking station is being used and whether the battery is fully charged. The following table shows the charger state values:

State

Description

0

Discharging battery

2

Battery charged at docking station

6

Battery charging at docking station

18

Battery charged using adapter

22

Battery charging using adapter

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

Other Channel

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)

13000 - 13999

Counts

(counts)

14000 - 14999

Counts per second

(counts/s)

15000 - 15999

Counts per second2

(counts/s2)

16000 - 16999

Enumerated quantity

Other Outputs

The Quanser QBot 3 supports four other output channels, allowing the wheel velocities to be controlled and sounds to be generated. Refer to the table below for a list of the channels:

Channel

Description

Units

2000

Right wheel velocity

(m/s)

2001

Left wheel velocity

(m/s)

14000

Pitch of custom sound

(Hz)

16000

Predefined sound

(0-6)

Interrupts

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

Watchdog

The Quanser QBot 3 card does not support a watchdog timer.

Board-Specific Options

The Quanser QBot 3 has a number of board-specific options to control specialized functionality of the board. These options configure the PWM.

pwm0_en

This option is a boolean value that enable or disables PWM 0. If PWM 0 is disabled then the PWM pin may be used as a regular digital I/O. Valid values are 0, 1, false, true, off, on, no or yes.

pwm1_en

This option is a boolean value that enable or disables PWM 1. If PWM 1 is disabled then the PWM pin may be used as a regular digital I/O. Valid values are 0, 1, false, true, off, on, no or yes.

pwm0_pin

This option determines which pin will be used for PWM 0. Valid value is 18 corresponding to GPIO 18.

Warning

Note that once a GPIO is configured as a PWM channel then it will no longer be recognized as a digital I/O line.

pwm1_pin

This option determines which pin will be used for PWM 1. Valid value is 19 corresponding to GPIO 19.

Warning

Note that once a GPIO is configured as a PWM channel then it will no longer be recognized as a digital I/O line.

Properties

The Quanser QBot 3 driver currently supports the following read-only properties:

Property

Type

Description

PROPERTY_INTEGER_MAJOR_VERSION

Integer

Major version number of the hardware

PROPERTY_INTEGER_MINOR_VERSION

Integer

Minor version number of the hardware

PROPERTY_INTEGER_BUILD

Integer

Build number of the hardware (currently always zero)

PROPERTY_INTEGER_REVISION

Integer

Revision or patch number of the hardware

PROPERTY_INTEGER_FIRMWARE_MAJOR_VERSION

Integer

Major version number of the firmware

PROPERTY_INTEGER_FIRMWARE_MINOR_VERSION

Integer

Minor version number of the firmware

PROPERTY_INTEGER_FIRMWARE_BUILD

Integer

Build number of the firmware (currently always zero)

PROPERTY_INTEGER_HARDWARE_VERSION

Integer

Revision or patch number of the firmware

PROPERTY_INTEGER_KOBUKI_UDID0

Integer

Unique identifier 0

PROPERTY_INTEGER_KOBUKI_UDID1

Integer

Unique identifier 1

PROPERTY_INTEGER_KOBUKI_UDID2

Integer

Unique identifier 2

The following properties may be both read and written:

Property

Type

Description

PROPERTY_DOUBLE_KOBUKI_P_GAIN

Double

Proportional gain for the onboard controller. The factory value is 100.

PROPERTY_DOUBLE_KOBUKI_I_GAIN

Double

Integral gain for the onboard controller. The factory value is 0.1.

PROPERTY_DOUBLE_KOBUKI_D_GAIN

Double

Derivative gain for the onboard controller. The factory value is 2.

Connectors

The Quanser QBot 3 board has one connector for expansion I/O. The pinouts for this connector are listed below. Note that all pins are 3.3V and are not 5V tolerant unless marked otherwise. Exceeding these voltages may damage the board!

Raspberry Pi GPIO Connector

GPIO 21

4039

Ground

GPIO 20

3837

GPIO 26

GPIO 16

3635

GPIO 19 / → PWM 1

Ground

3433

GPIO 13 / ← UART RXD

UART TXD ← / GPIO 12

3231

GPIO 6

Ground

3029

GPIO 5

ID SC / GPIO 1

2827

GPIO 0 / ID SD

SPI CE1 ← / GPIO 7

2625

Ground

SPI CE0 ← / GPIO 8

2423

GPIO 11 / → SPI SCLK

GPIO 25

2221

GPIO 9 / ← SPI MISO

Ground

2019

GPIO 10 / → SPI MOSI

GPIO 24

1817

3.3V

GPIO 23

1615

GPIO 22

Ground

1413

GPIO 27

PWM 0 ← / GPIO 18

1211

GPIO 17

UART RTS → / GPIO 15

109

Ground

UART CTS ← / GPIO 14

87

GPIO 4

Ground

65

GPIO 3 / I2C SCL

5V

43

GPIO 2 / I2C SDA

5V

21

3.3V

Legend

→▯←

=

input

←▯→

=

output

↔▯↔

=

bidirectional I/O

=

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

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

Yes

Only supported with a QBot 3 device.

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.

See Also

 

navigation bar