QBot Platform

../_images/qbot_platform.png

Description

A QBot Platform is considered an “actor” in Quanser Interactive Labs. The QBot Platform library can be used to acquire sensor data from the virtual environment and control the motion of the robot(s).

Library

class qvl.qbot_platform.QLabsQBotPlatform(qlabs, verbose=False)[source]

This class is for spawning QBotPlatforms.

Constants

QLabsQBotPlatform.ID_QBOT_PLATFORM = 23
QLabsQBotPlatform.VIEWPOINT_RGB = 0
QLabsQBotPlatform.VIEWPOINT_DEPTH = 1
QLabsQBotPlatform.VIEWPOINT_DOWNWARD = 2
QLabsQBotPlatform.VIEWPOINT_TRAILING = 3
QLabsQBotPlatform.CAMERA_RGB = 0
QLabsQBotPlatform.CAMERA_DEPTH = 1
QLabsQBotPlatform.CAMERA_DOWNWARD = 2

Member Variables

QLabsQBotPlatform.actorNumber = None

The current actor number of this class to be addressed. This will be set by spawn methods and cleared by destroy methods. It will not be modified by the destroy all actors. This can be manually altered at any time to use one object to address multiple actors.

Methods

QLabsQBotPlatform.__init__(qlabs, verbose=False)[source]

Constructor Method

Parameters
  • qlabs (object) – A QuanserInteractiveLabs object

  • verbose (boolean) – (Optional) Print error information to the console.

QLabsQBotPlatform.spawn(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)

Spawns a new actor with the next available actor number within this class.

Parameters
  • location (float array[3]) – (Optional) An array of floats for x, y and z coordinates

  • rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians

  • scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.

  • configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.

  • waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred. Note that if this is False, the returned actor number will be invalid.

Returns

  • status - 0 if successful, 1 class not available, 3 unknown error, -1 communications error.

  • actorNumber - An actor number to use for future references.

Return type

int32, int32

QLabsQBotPlatform.spawn_degrees(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)

Spawns a new actor with the next available actor number within this class.

Parameters
  • location (float array[3]) – (Optional) An array of floats for x, y and z coordinates

  • rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in degrees

  • scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.

  • configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.

  • waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred. Note that if this is False, the returned actor number will be invalid.

Returns

  • status - 0 if successful, 1 class not available, 3 unknown error, -1 communications error.

  • actorNumber - An actor number to use for future references.

Return type

int32, int32

QLabsQBotPlatform.spawn_id(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)

Spawns a new actor.

Parameters
  • actorNumber (uint32) – User defined unique identifier for the class actor in QLabs

  • location (float array[3]) – (Optional) An array of floats for x, y and z coordinates

  • rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians

  • scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.

  • configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.

  • waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.

Returns

  • status - 0 if successful, 1 class not available, 2 actor number not available or already in use, 3 unknown error, -1 communications error

Return type

int32

QLabsQBotPlatform.spawn_id_degrees(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)

Spawns a new actor.

Parameters
  • actorNumber (uint32) – User defined unique identifier for the class actor in QLabs

  • location (float array[3]) – (Optional) An array of floats for x, y and z coordinates

  • rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians

  • scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.

  • configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.

  • waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.

Returns

  • status - 0 if successful, 1 class not available, 2 actor number not available or already in use, 3 unknown error, -1 communications error

Return type

int32

QLabsQBotPlatform.set_transform(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], leftLED=[1, 0, 0], rightLED=[1, 0, 0], enableDynamics=True, waitForConfirmation=True)[source]

Sets the transform, LED colors, and enabling/disabling of physics dynamics

Parameters
  • location (float array[3]) – (Optional) An array of floats for x, y and z coordinates

  • rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians

  • scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.

  • leftLED (float array[3]) – (Optional) Red, Green, Blue components of the RGB color on a 0.0 to 1.0 scale.

  • rightLED (float array[3) – (Optional) Red, Green, Blue components of the RGB color on a 0.0 to 1.0 scale.

  • enableDynamics (boolean) – (default True) Enables or disables gravity for set transform requests.

  • waitForConfirmation (boolean) – (Optional) Wait for confirmation before proceeding. This makes the method a blocking operation. NOTE: Return data will only be valid if waitForConfirmation is True.

Returns

  • status - True if successful or False otherwise

  • location - world location in m

  • forward vector - unit scale vector

  • up vector - unit scale vector

Return type

boolean, float array[3], float array[3], float array[3]

QLabsQBotPlatform.set_transform_degrees(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], leftLED=[1, 0, 0], rightLED=[1, 0, 0], enableDynamics=True, waitForConfirmation=True)[source]

Sets the transform, LED colors, and enabling/disabling of physics dynamics

Parameters
  • location (float array[3]) – (Optional) An array of floats for x, y and z coordinates

  • rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in degrees

  • scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.

  • leftLED (float array[3]) – (Optional) Red, Green, Blue components of the RGB color on a 0.0 to 1.0 scale.

  • rightLED (float array[3) – (Optional) Red, Green, Blue components of the RGB color on a 0.0 to 1.0 scale.

  • enableDynamics (boolean) – (default True) Enables or disables gravity for set transform requests.

  • waitForConfirmation (boolean) – (Optional) Wait for confirmation before proceeding. This makes the method a blocking operation. NOTE: Return data will only be valid if waitForConfirmation is True.

Returns

  • status - True if successful or False otherwise

  • location - world location in m

  • forward vector - unit scale vector

  • up vector - unit scale vector

Return type

boolean, float array[3], float array[3], float array[3]

QLabsQBotPlatform.command_and_request_state(rightWheelSpeed, leftWheelSpeed, leftLED=[1, 0, 0], rightLED=[1, 0, 0])[source]

Sets the wheel speeds and LED colors.

Parameters
  • rightWheelSpeed (float) – Speed in m/s

  • leftWheelSpeed (float) – Speed in m/s

  • leftLED (float array[3]) – Red, Green, Blue components of the RGB color on a 0.0 to 1.0 scale.

  • rightLED (float array[3]) – Red, Green, Blue components of the RGB color on a 0.0 to 1.0 scale.

Returns

  • status - True if successful, False otherwise

  • location - world location in m

  • forward vector - unit scale vector

  • up vector - unit scale vector

  • front bumper hit - true if in contact with a collision object, False otherwise

  • left bumper hit - true if in contact with a collision object, False otherwise

  • right bumper hit - true if in contact with a collision object, False otherwise

  • gyro - turn rate in rad/s

  • heading - angle in rad

  • encoder left - in counts

  • encoder right - in counts

Return type

boolean, float array[3], float array[3], float array[3], boolean, boolean, boolean, float, float, uint32, uint32

QLabsQBotPlatform.get_image(camera)[source]

Request a JPG image from the QBot camera.

Parameters

camera (byte) – Camera number to view from.

Returns

  • status - True and image data if successful, False and empty otherwise

  • imageData - Image in a JPG format

Return type

boolean, byte array with jpg data

QLabsQBotPlatform.get_lidar(samplePoints=400)[source]

Request LIDAR data from a QBotPlatform.

Parameters

samplePoints (uint32) – (Optional) Change the number of points per revolution of the LIDAR.

Returns

True, angles in radians, and distances in m if successful, False, none, and none otherwise

Return type

boolean, float array, float array

QLabsQBotPlatform.possess(camera)[source]

Possess (take control of) a QBot in QLabs with the selected camera.

Parameters

camera (uint32) – Pre-defined camera constant. See CAMERA constants for available options. Default is the trailing camera.

Returns

  • status - True if possessing the camera was successful, False otherwise

Return type

boolean

Configurations

There are two configurations (0-1) of the QBot Platform actor. Configuration 1 adds a cover on top to facilitate carrying other dynamic actors.

../_images/configuration_qbot_platform.png

Connection Points

Image (Click for enlarged view)

Reference Frame Number

Parent Frame

Relative Transform to Parent (Location, Rotation)

Description

conn0

0

The base frame is located at ground level, centered between the two rear wheels.

conn1

1

0

[ 0.0450,0.155,0.190] [0,0,0]

Front left magnet

conn2

2

0

[ 0.0450,-0.155,0.190] [0,0,0]

Front right magnet

conn3

3

0

[-0.0450,0.155,0.190] [0,0,0]

Back left magnet

conn4

4

0

[-0.0450,-0.155,0.190] [0,0,0]

Back right magnet

conn5

5

0

[-0.0465,0,0.110] [0,0,0]

Back middle magnet

conn6

6

0

[ 0.0435,0,0.110] [0,0,0]

Front middle magnet

Component Extrinsics

“Extrinsics” refer to the external relationship of an object with respect to a specific frame of reference (in this case the body center of the QBot Platform). Sometimes it’s important to know specific distances and orientation of extrinsic components, for instance, this can be use for obstacle detection and camera calibration.

You will find a list of the important extrinsics below relative to the actor base frame.

Component

x (m)

y (m)

z (m)

Geometric center (body frame)

0.000

0.000

0.112

Left wheel

0.000

0.195

0.044

Right wheel

0.000

-0.195

0.044

RealSense

0.261

0.000

0.132

CSI bottom

0.000

0.000

0.059

IMU

0.000

0.000

0.089

LIDAR

0.221

0.000

0.207

../_images/connection_qbot_platform_base_frame.png

QBot Platform geometric base frame centered on the floor between the two wheels.

../_images/connection_qbot_platform_body_frame.png

QBot Platform geometric center/body frame.

QBot Platform Tutorial