Traffic Cone

../_images/traffic_cone_banner.png

Description

Traffic cones are considered an “actor” in Quanser Interactive Labs Open Worlds. Traffic cones can be spawned anywhere in the Open Worlds and they only exist as dynamic actors.

See the Traffic Cone Tutorial to get a better understanding of using traffic cones in Quanser Interactive Labs.

Library

class qvl.traffic_cone.QLabsTrafficCone(qlabs, verbose=False)[source]

This class is for spawning traffic cones.

Constants

QLabsTrafficCone.ID_TRAFFIC_CONE = 10000

Class ID

Member Variables

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

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

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

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

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

QLabsTrafficCone.spawn_id_and_parent_with_relative_transform(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)

Spawns a new actor relative to an existing actor and creates a kinematic relationship.

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.

  • parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier

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

  • parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame 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 cannot find the parent actor, 4 unknown error, -1 communications error

Return type

int32

QLabsTrafficCone.spawn_id_and_parent_with_relative_transform_degrees(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)

Spawns a new actor relative to an existing actor and creates a kinematic relationship.

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

  • parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier

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

  • parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame 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 cannot find the parent actor, 4 unknown error, -1 communications error

Return type

int32

QLabsTrafficCone.destroy()

Find and destroy a specific actor. This is a blocking operation.

Returns

  • numActorsDestroyed - The number of actors destroyed. -1 if failed.

Return type

int32

QLabsTrafficCone.destroy_all_actors_of_class()

Find and destroy all actors of this class. This is a blocking operation.

Returns

  • numActorsDestroyed - The number of actors destroyed. -1 if failed.

Return type

int32

QLabsTrafficCone.ping()

Checks if the actor is still present in the environment. Note that if you did not spawn the actor with one of the spawn functions, you may need to manually set the actorNumber member variable.

Returns

  • status - True if successful, False otherwise

Return type

boolean

QLabsTrafficCone.get_world_transform()

Get the location, rotation, and scale in world coordinates of the actor.

Returns

  • status - True if successful, False otherwise

  • location

  • rotation

  • scale

Return type

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

QLabsTrafficCone.get_world_transform_degrees()

Get the location, rotation, and scale in world coordinates of the actor.

Returns

  • status - True if successful, False otherwise

  • location

  • rotation

  • scale

Return type

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

QLabsTrafficCone.parent_with_relative_transform(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)

Parents one existing actor to another to create a kinematic relationship.

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.

  • parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier

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

  • parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame options

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

Returns

  • status - 0 if successful, 1 cannot find this actor, 2 cannot find the parent actor, 3 unknown error, -1 communications error

Return type

int32

QLabsTrafficCone.parent_with_relative_transform_degrees(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)

Parents one existing actor to another to create a kinematic relationship.

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.

  • parentClassID (uint32) – (Optional) See the ID variables in the respective library classes for the class identifier

  • parentActorNumber (uint32) – (Optional) User defined unique identifier for the class actor in QLabs

  • parentComponent (uint32) – (Optional) 0 for the origin of the parent actor, see the parent class for additional reference frame options

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

Returns

  • status - 0 if successful, 1 cannot find this actor, 2 cannot find the parent actor, 3 unknown error, -1 communications error

Return type

int32

QLabsTrafficCone.parent_with_current_world_transform(parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)

Parents one existing actor to another to create a kinematic relationship while preserving the current world transform of the child actor.

Parameters
  • parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier

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

  • parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame options

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

Returns

  • status - 0 if successful, 1 cannot find this actor, 2 cannot find the parent actor, 3 unknown error, -1 communications error

Return type

int32

QLabsTrafficCone.parent_break(waitForConfirmation=True)

Breaks any relationship with a parent actor (if it exists) and preserves the current world transform

Parameters

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

Returns

  • status - 0 if successful, 1 cannot find this actor, -1 communications error

Return type

int32

QLabsTrafficCone.set_material_properties(materialSlot=0, color=[0, 0, 0], roughness=0.4, metallic=False, waitForConfirmation=True)[source]

Sets the visual surface properties of the cone. The default colors are orange for material slot 0, and black for slot 1.

Parameters
  • materialSlot – Material index to be modified. Setting an index for an unsupported slot will be ignored.

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

  • roughness (float) – A value between 0.0 (completely smooth and reflective) to 1.0 (completely rough and diffuse). Note that reflections are rendered using screen space reflections. Only objects visible in the camera view will be rendered in the reflection of the object.

  • metallic (boolean) – Metallic (True) or non-metallic (False)

  • waitForConfirmation (boolean) – (Optional) Wait for confirmation of the operation before proceeding. This makes the method a blocking operation.

Returns

True if successful, False otherwise

Return type

boolean

Configurations

There are four configurations (0-3) for the traffic cone actor class generated in QLabs. For the purpose of the set_material_properties method, configuration 0 has a single material slot (0), and configurations 1-3 have two material slots (0, 1).

../_images/configuration_trafficCones.png

Connection Points

There are no connection points for this actor class.

Traffic Cone Tutorial