Commands

This module contains the classes used for formatting and sending commands to the Holodeck backend. Most of these commands are just used internally by Holodeck, regular users do not need to worry about these.

Classes

AddSensorCommand(sensor_definition) Add a sensor to an agent
Command() Base class for Command objects.
CommandCenter(client) Manages pending commands to send to the client (the engine).
CommandsGroup() Represents a list of commands
CustomCommand(name[, num_params, string_params]) Send a custom command to the currently loaded world.
DebugDrawCommand(draw_type, start, end, …) Draw debug geometry in the world.
RGBCameraRateCommand(agent_name, …) Set the number of ticks between captures of the RGB camera.
RemoveSensorCommand(agent, sensor) Remove a sensor from an agent
RenderQualityCommand(render_quality) Adjust the rendering quality of Holodeck
RenderViewportCommand(render_viewport) Enable or disable the viewport.
RotateSensorCommand(agent, sensor, rotation) Rotate a sensor on the agent
SpawnAgentCommand(location, rotation, name, …) Spawn an agent in the world.
TeleportCameraCommand(location, rotation) Move the viewport camera (agent follower)
class holodeck.command.AddSensorCommand(sensor_definition)

Add a sensor to an agent

Parameters:sensor_definition (SensorDefinition) – Sensor to add
class holodeck.command.Command

Base class for Command objects.

Commands are used for IPC between the holodeck python bindings and holodeck binaries.

Derived classes must set the _command_type.

The order in which add_number_parameters() and add_number_parameters() are called is significant, they are added to an ordered list. Ensure that you are adding parameters in the order the client expects them.

Methods

add_number_parameters(number) Add given number parameters to the internal list.
add_string_parameters(string) Add given string parameters to the internal list.
set_command_type(command_type) Set the type of the command.
to_json() Converts to json.
add_number_parameters(number)

Add given number parameters to the internal list.

Parameters:number (list of int/float, or singular int/float) – A number or list of numbers to add to the parameters.
add_string_parameters(string)

Add given string parameters to the internal list.

Parameters:string (list of str or str) – A string or list of strings to add to the parameters.
set_command_type(command_type)

Set the type of the command.

Parameters:command_type (str) – This is the name of the command that it will be set to.
to_json()

Converts to json.

Returns:This object as a json string.
Return type:str
class holodeck.command.CommandCenter(client)

Manages pending commands to send to the client (the engine).

Parameters:client (HolodeckClient) – Client to send commands to

Methods

clear() Clears pending commands
enqueue_command(command_to_send) Adds command to outgoing queue.
handle_buffer() Writes the list of commands into the command buffer, if needed.

Attributes

queue_size Size of commands queue
clear()

Clears pending commands

enqueue_command(command_to_send)

Adds command to outgoing queue.

Parameters:command_to_send (Command) – Command to add to queue
handle_buffer()

Writes the list of commands into the command buffer, if needed.

Checks if we should write to the command buffer, writes all of the queued commands to the buffer, and then clears the contents of the self._commands list

queue_size

Size of commands queue

Type:Returns
Type:int
class holodeck.command.CommandsGroup

Represents a list of commands

Can convert list of commands to json.

Methods

add_command(command) Adds a command to the list
clear() Clear the list of commands.
to_json()
returns:Json for commands array object and all of the commands inside the array.

Attributes

size Size of commands group
add_command(command)

Adds a command to the list

Parameters:command (Command) – A command to add.
clear()

Clear the list of commands.

size

Size of commands group

Type:Returns
Type:int
to_json()
Returns:Json for commands array object and all of the commands inside the array.
Return type:str
class holodeck.command.CustomCommand(name, num_params=None, string_params=None)

Send a custom command to the currently loaded world.

Parameters:
  • name (str) – The name of the command, ex “OpenDoor”
  • (obj (string_params) – list of int): List of arbitrary number parameters
  • (objlist of int): List of arbitrary string parameters
class holodeck.command.DebugDrawCommand(draw_type, start, end, color, thickness)

Draw debug geometry in the world.

Parameters:
  • draw_type (int) –

    The type of object to draw

    • 0: line
    • 1: arrow
    • 2: box
    • 3: point
  • start (list of float) – The start [x, y, z] location of the object. (see Coordinate System)
  • end (list of float) – The end [x, y, z] location of the object (not used for point, and extent for box)
  • color (list of float) – [r, g, b] values for the color
  • thickness (float) – thickness of the line/object
class holodeck.command.RGBCameraRateCommand(agent_name, sensor_name, ticks_per_capture)

Set the number of ticks between captures of the RGB camera.

Parameters:
  • agent_name (str) – name of the agent to modify
  • sensor_name (str) – name of the sensor to modify
  • ticks_per_capture (int) – number of ticks between captures
class holodeck.command.RemoveSensorCommand(agent, sensor)

Remove a sensor from an agent

Parameters:
  • agent (str) – Name of agent to modify
  • sensor (str) – Name of the sensor to remove
class holodeck.command.RenderQualityCommand(render_quality)

Adjust the rendering quality of Holodeck

Parameters:render_quality (int) – 0 = low, 1 = medium, 3 = high, 3 = epic
class holodeck.command.RenderViewportCommand(render_viewport)

Enable or disable the viewport. Note that this does not prevent the viewport from being shown, it just prevents it from being updated.

Parameters:render_viewport (bool) – If viewport should be rendered
class holodeck.command.RotateSensorCommand(agent, sensor, rotation)

Rotate a sensor on the agent

Parameters:
  • agent (str) – Name of agent
  • sensor (str) – Name of the sensor to rotate
  • rotation (list of float) – [roll, pitch, yaw] rotation for sensor.
class holodeck.command.SpawnAgentCommand(location, rotation, name, agent_type, is_main_agent=False)

Spawn an agent in the world.

Parameters:
  • location (list of float) – [x, y, z] location to spawn agent (see Coordinate System)
  • name (str) – The name of the agent.
  • agent_type (str or type) – The type of agent to spawn (UAVAgent, NavAgent, …)

Methods

set_location(location) Set where agent will be spawned.
set_name(name) Set agents name
set_rotation(rotation) Set where agent will be spawned.
set_type(agent_type) Set the type of agent.
set_location(location)

Set where agent will be spawned.

Parameters:location (list of float) – [x, y, z] location to spawn agent (see Coordinate System)
set_name(name)

Set agents name

Parameters:name (str) – The name to set the agent to.
set_rotation(rotation)

Set where agent will be spawned.

Parameters:rotation (list of float) – [roll, pitch, yaw] rotation for agent. (see Rotations)
set_type(agent_type)

Set the type of agent.

Parameters:agent_type (str or type) – The type of agent to spawn.
class holodeck.command.TeleportCameraCommand(location, rotation)

Move the viewport camera (agent follower)

Parameters:
  • location (list of float) – The [x, y, z] location to give the camera (see Coordinate System)
  • rotation (list of float) – The [roll, pitch, yaw] rotation to give the camera (see Rotations)