Multi Agent Class

Note

This class is for advanced users wanting to control multiple robots through QUARC or Quanser SDK. Make sure you have installed the academic resources from the Quanser website. It will only work with Quanser robots that you have a valid Quanser Interactive Labs license for.

This class is still under development.

For any questions, please contact Quanser Support at tech@quanser.com

Description

This class can be utilized for spawning multiple robot agents in Quanser Interactive Labs for user control directly via QUARC or Quanser SDK. This library requires a complete installation of Quanser’s academic resources (available through www.quanser.com) for associated real-time application modules and other supporting libraries.

The class copies and creates all necessary files to run multiple robots at the same time. It will also create a JSON file called RobotAgents.json that will store the information of the agents that were spawned as well as its port and URI numbers.

See the MultiAgent Tutorial to get a better understanding of using the MultiAgent class to spawn multiple agents.

Library

class qvl.multi_agent.MultiAgent(agentList)[source]

This class is for spawning multiple agents in Quanser Interactive Labs that will then be controlled through QUARC/Quanser SKD.

When initializing the class, it will delete all QArms, QCar 2s, QBot Platforms and QDrone 2s in the space.

Member Variables

MultiAgent.robotActors = None

List of qlabs actor objects of the robots that were spawned. Use when using functions from qlabs library.

MultiAgent.robotsDict = {}

Dictionary of dictionaries of all spawned robots. Includes the information that is saved into the JSON file. Including robotType, actorNumber, classID as well as all ports used for the RT file.

Methods

MultiAgent.__init__(agentList)[source]

Constructor Method

Parameters

agentList (list of dictionaries) – A list of dictionaries of the spawned robots.

Tip

The dictionaries can have the following keys (one per robot that will be spawned):
  • “RobotType”: string - can be “QC2”/”QCar2” for QCar 2, “QBP” for QBot Platform, “QDrone2”/”QD2” for QDrone 2

  • “Location”: float array[3] - for spawning in x, y, z of the QLabs environment

  • “Rotation”: (Optional) float array[3] - for spawning in x, y, z. Can be in Degrees or Radians. If it is radians, set the “Radians” key to True. If not defined, will spawn with [0, 0, 0] rotation

  • “Radians”: (Optional) boolean - defaults to False. Only needed if rotation is in Radians

  • “Scale”: (Optional) float - if you want to change the scaling of the spawned object. If not defined, will spawn with scaling of 1. The scaling will apply in x, y, and z

  • “actorNumber”: (Optional) int - set only if you want a predefined actor number for your robot. If not, it will use the next available number for the type of robot. If the number is already in use, it will overwrite it. We do not recommend using it unless tracking of actors is done manually by the user.

If using a QCar 2, the file it will start will be different depending on the scale of 1 (QCar 2 real world car size) or .1 (QCar 2 actual size), to return measurements properly scaled.

multi_agent.readRobots()

Function to read the JSON file created after spawning the robots. The file contains all necessary port/URI numbers to initialize the robots. The function will return the dictionary that was created when spawning the robots it contains the the robots and their properties. The function makes sure that the file is not being used by another process before reading it.

Important

This function is not part of the MultiAgent class. Do not initialize a MultiAgent object only to use this function. It can be called directly from the library.


MultiAgent Tutorial