Agents¶
For a higher level description of the agents, see Holodeck Agents.
Definitions for different agents that can be controlled from Holodeck
Classes:
|
Represents information needed to initialize agent. |
Creates an agent object |
|
|
An humanoid android agent. |
All allowed control schemes. |
|
|
A floating hand agent. |
|
A learning agent in Holodeck |
|
A humanoid character capable of intelligent navigation. |
|
|
|
A simple turtle bot. |
|
-
class
holodeck.agents.
AgentDefinition
(agent_name, agent_type, sensors=None, starting_loc=(0, 0, 0), starting_rot=(0, 0, 0), existing=False, is_main_agent=False)¶ Represents information needed to initialize agent.
- Parameters
agent_name (
str
) – The name of the agent to control.agent_type (
str
or type) – The type of HolodeckAgent to control, string or class reference.sensors (
SensorDefinition
or class type (if no duplicate sensors)) – A list of HolodeckSensors to read from this agent.starting_loc (
list
offloat
) – Starting[x, y, z]
location for agent (see Coordinate System)starting_rot (
list
offloat
) – Starting[roll, pitch, yaw]
rotation for agent (see Rotations)existing (
bool
) – If the agent exists in the world or not (deprecated)
-
class
holodeck.agents.
AgentFactory
¶ Creates an agent object
Methods:
build_agent
(client, agent_def)Constructs an agent
-
static
build_agent
(client, agent_def)¶ Constructs an agent
- Parameters
client (
holodeck.holodeckclient.HolodeckClient
) – HolodeckClient agent is associated withagent_def (
AgentDefinition
) – Definition of the agent to instantiate
Returns:
-
static
-
class
holodeck.agents.
AndroidAgent
(client, name='DefaultAgent')¶ An humanoid android agent.
Can be controlled via torques supplied to its joints.
See AndroidAgent for more details.
Action Space:
94 dimensional vector of continuous values representing torques to be applied at each joint. The layout of joints can be found here:
There are 18 joints with 3 DOF, 10 with 2 DOF, and 20 with 1 DOF.
Inherits from
HolodeckAgent
.Attributes:
A list of all control schemes for the agent.
Methods:
get_joint_constraints
(joint_name)Returns the corresponding swing1, swing2 and twist limit values for the specified joint.
joint_ind
(joint_name)Gets the joint indices for a given name
-
property
control_schemes
¶ A list of all control schemes for the agent. Each list element is a 2-tuple, with the first element containing a short description of the control scheme, and the second element containing the
ActionSpace
for the control scheme.- Returns
Each tuple contains a short description and the ActionSpace
- Return type
(
str
,ActionSpace
)
-
get_joint_constraints
(joint_name)¶ Returns the corresponding swing1, swing2 and twist limit values for the specified joint. Will return None if the joint does not exist for the agent.
- Returns
obj )
- Return type
(
-
static
joint_ind
(joint_name)¶ Gets the joint indices for a given name
- Parameters
joint_name (
str
) – Name of the joint to look up- Returns
The index into the state array
- Return type
(int)
-
property
-
class
holodeck.agents.
ControlSchemes
¶ All allowed control schemes.
-
ANDROID_TORQUES
¶ Default Android control scheme. Specify a torque for each joint.
- Type
int
-
CONTINUOUS_SPHERE_DEFAULT
¶ Default ContinuousSphere control scheme. Takes two commands, [forward_delta, turn_delta].
- Type
int
-
DISCRETE_SPHERE_DEFAULT
¶ Default DiscreteSphere control scheme. Takes a value, 0-4, which corresponds with forward, backward, right, and left.
- Type
int
-
NAV_TARGET_LOCATION
¶ Default NavAgent control scheme. Takes a target xyz coordinate.
- Type
int
-
UAV_TORQUES
¶ Default UAV control scheme. Takes torques for roll, pitch, and yaw, as well as thrust.
- Type
int
-
UAV_ROLL_PITCH_YAW_RATE_ALT
¶ Control scheme for UAV. Takes roll, pitch, yaw rate, and altitude targets.
- Type
int
-
HAND_AGENT_MAX_TORQUES
¶ Default Android control scheme. Specify a torque for each joint.
- Type
int
-
-
class
holodeck.agents.
HandAgent
(client, name='DefaultAgent')¶ A floating hand agent.
Can be controlled via torques supplied to its joints and moved around in three dimensions.
See HandAgent for more details.
Action Space:
23 or 26 dimensional vector of continuous values representing torques to be applied at each joint. The layout of joints can be found here: HandAgent Joints.
Inherits from
HolodeckAgent
.Attributes:
A list of all control schemes for the agent.
Methods:
get_joint_constraints
(joint_name)Returns the corresponding swing1, swing2 and twist limit values for the specified joint.
joint_ind
(joint_name)Gets the joint indices for a given name
-
property
control_schemes
¶ A list of all control schemes for the agent. Each list element is a 2-tuple, with the first element containing a short description of the control scheme, and the second element containing the
ActionSpace
for the control scheme.- Returns
Each tuple contains a short description and the ActionSpace
- Return type
(
str
,ActionSpace
)
-
get_joint_constraints
(joint_name)¶ Returns the corresponding swing1, swing2 and twist limit values for the specified joint. Will return None if the joint does not exist for the agent.
- Returns
obj )
- Return type
(
-
static
joint_ind
(joint_name)¶ Gets the joint indices for a given name
- Parameters
joint_name (
str
) – Name of the joint to look up- Returns
The index into the state array
- Return type
(int)
-
property
-
class
holodeck.agents.
HolodeckAgent
(client, name='DefaultAgent')¶ A learning agent in Holodeck
Agents can act, receive rewards, and receive observations from their sensors. Examples include the Android, UAV, and SphereRobot.
- Parameters
client (
HolodeckClient
) – The HolodeckClient that this agent belongs with.name (
str
, optional) – The name of the agent. Must be unique from other agents in the same environment.sensors (
dict
of (str
,HolodeckSensor
)) – A list of HolodeckSensors to read from this agent.
-
name
¶ The name of the agent.
- Type
str
-
sensors
¶ List of HolodeckSensors on this agent.
- Type
dict of (string,
HolodeckSensor
)
-
agent_state_dict
¶ A dictionary that maps sensor names to sensor observation data.
- Type
dict
Methods:
act
(action)Sets the command for the agent.
add_sensors
(sensor_defs)Adds a sensor to a particular agent object and attaches an instance of the sensor to the agent in the world.
Sets the action to zeros, effectively removing any previous actions.
get_joint_constraints
(joint_name)Returns the corresponding swing1, swing2 and twist limit values for the specified joint.
Indicatates whether this agent has a camera or not.
remove_sensors
(sensor_defs)Removes a sensor from a particular agent object and detaches it from the agent in the world.
set_control_scheme
(index)Sets the control scheme for the agent.
set_physics_state
(location, rotation, …)Sets the location, rotation, velocity and angular velocity of an agent.
teleport
([location, rotation])Teleports the agent to a specific location, with a specific rotation.
Attributes:
Gets the action space for the current agent and control scheme.
A list of all control schemes for the agent.
-
act
(action)¶ Sets the command for the agent. Action depends on the agent type and current control scheme.
- Parameters
action (
np.ndarray
) – The action to take.
-
property
action_space
¶ Gets the action space for the current agent and control scheme.
- Returns
- The action space for this agent and control
scheme.
- Return type
-
add_sensors
(sensor_defs)¶ Adds a sensor to a particular agent object and attaches an instance of the sensor to the agent in the world.
- :param sensor_defs (
HolodeckSensor
or: list ofHolodeckSensor
): Sensors to add to the agent.
- :param sensor_defs (
-
clear_action
()¶ Sets the action to zeros, effectively removing any previous actions.
-
property
control_schemes
¶ A list of all control schemes for the agent. Each list element is a 2-tuple, with the first element containing a short description of the control scheme, and the second element containing the
ActionSpace
for the control scheme.- Returns
Each tuple contains a short description and the ActionSpace
- Return type
(
str
,ActionSpace
)
-
get_joint_constraints
(joint_name)¶ Returns the corresponding swing1, swing2 and twist limit values for the specified joint. Will return None if the joint does not exist for the agent.
- Returns
obj )
- Return type
(
-
has_camera
()¶ Indicatates whether this agent has a camera or not.
- Returns
If the agent has a sensor or not
- Return type
bool
-
remove_sensors
(sensor_defs)¶ Removes a sensor from a particular agent object and detaches it from the agent in the world.
- :param sensor_defs (
HolodeckSensor
or: list ofHolodeckSensor
): Sensors to remove from the agent.
- :param sensor_defs (
-
set_control_scheme
(index)¶ Sets the control scheme for the agent. See
ControlSchemes
.- Parameters
index (
int
) – The control scheme to use. Should be set with an enum fromControlSchemes
.
-
set_physics_state
(location, rotation, velocity, angular_velocity)¶ Sets the location, rotation, velocity and angular velocity of an agent.
- Parameters
location (np.ndarray) – New location (
[x, y, z]
(see Coordinate System))rotation (np.ndarray) – New rotation (
[roll, pitch, yaw]
, see (see Rotations))velocity (np.ndarray) – New velocity (
[x, y, z]
(see Coordinate System))angular_velocity (np.ndarray) – New angular velocity (
[x, y, z]
in degrees (see Coordinate System))
-
teleport
(location=None, rotation=None)¶ Teleports the agent to a specific location, with a specific rotation.
- Parameters
location (np.ndarray, optional) –
An array with three elements specifying the target world coordinates
[x, y, z]
in meters (see Coordinate System).If
None
(default), keeps the current location.rotation (np.ndarray, optional) –
An array with three elements specifying roll, pitch, and yaw in degrees of the agent.
If
None
(default), keeps the current rotation.
A humanoid character capable of intelligent navigation.
See NavAgent for more details.
Action Space:
Continuous control scheme of the form
[x_target, y_target, z_target]
. (see Coordinate System)Inherits from
HolodeckAgent
.Attributes:
A list of all control schemes for the agent.
Methods:
get_joint_constraints
(joint_name)Returns the corresponding swing1, swing2 and twist limit values for the specified joint.
A list of all control schemes for the agent. Each list element is a 2-tuple, with the first element containing a short description of the control scheme, and the second element containing the
ActionSpace
for the control scheme.- Returns
Each tuple contains a short description and the ActionSpace
- Return type
(
str
,ActionSpace
)
Returns the corresponding swing1, swing2 and twist limit values for the specified joint. Will return None if the joint does not exist for the agent.
- Returns
obj )
- Return type
(
-
class
holodeck.agents.
SphereAgent
(client, name='DefaultAgent')¶ Attributes:
A list of all control schemes for the agent.
Methods:
get_joint_constraints
(joint_name)Returns the corresponding swing1, swing2 and twist limit values for the specified joint.
-
property
control_schemes
¶ A list of all control schemes for the agent. Each list element is a 2-tuple, with the first element containing a short description of the control scheme, and the second element containing the
ActionSpace
for the control scheme.- Returns
Each tuple contains a short description and the ActionSpace
- Return type
(
str
,ActionSpace
)
-
get_joint_constraints
(joint_name)¶ Returns the corresponding swing1, swing2 and twist limit values for the specified joint. Will return None if the joint does not exist for the agent.
- Returns
obj )
- Return type
(
-
property
-
class
holodeck.agents.
TurtleAgent
(client, name='DefaultAgent')¶ A simple turtle bot.
See TurtleAgent for more details.
Action Space:
[forward_force, rot_force]
forward_force
is capped at 160 in either directionrot_force
is capped at 35 either direction
Inherits from
HolodeckAgent
.Attributes:
A list of all control schemes for the agent.
Methods:
get_joint_constraints
(joint_name)Returns the corresponding swing1, swing2 and twist limit values for the specified joint.
-
property
control_schemes
¶ A list of all control schemes for the agent. Each list element is a 2-tuple, with the first element containing a short description of the control scheme, and the second element containing the
ActionSpace
for the control scheme.- Returns
Each tuple contains a short description and the ActionSpace
- Return type
(
str
,ActionSpace
)
-
get_joint_constraints
(joint_name)¶ Returns the corresponding swing1, swing2 and twist limit values for the specified joint. Will return None if the joint does not exist for the agent.
- Returns
obj )
- Return type
(
-
class
holodeck.agents.
UavAgent
(client, name='DefaultAgent')¶ Attributes:
A list of all control schemes for the agent.
Methods:
get_joint_constraints
(joint_name)Returns the corresponding swing1, swing2 and twist limit values for the specified joint.
-
property
control_schemes
¶ A list of all control schemes for the agent. Each list element is a 2-tuple, with the first element containing a short description of the control scheme, and the second element containing the
ActionSpace
for the control scheme.- Returns
Each tuple contains a short description and the ActionSpace
- Return type
(
str
,ActionSpace
)
-
get_joint_constraints
(joint_name)¶ Returns the corresponding swing1, swing2 and twist limit values for the specified joint. Will return None if the joint does not exist for the agent.
- Returns
obj )
- Return type
(
-
property