Class PoseExtractor
Abstract class for managing the transforms of a hierarchy of objects. This could be GameObjects or Monobehaviours in the scene graph, but this is not a requirement; for example, the objects could be rigid bodies whose hierarchy is defined by Joint configurations.
Poses are either considered in model space, which is relative to a root body, or in local space, which is relative to their parent.
Inherited Members
Namespace: Unity.MLAgents.Sensors
Assembly: Unity.ML-Agents.dll
Syntax
[MovedFrom("Unity.MLAgents.Extensions.Sensors")]
public abstract class PoseExtractor
Properties
NumEnabledPoses
Number of enabled poses in the hierarchy (read-only).
Declaration
public int NumEnabledPoses { get; }
Property Value
Type | Description |
---|---|
int |
NumPoses
Number of total poses in the hierarchy (read-only).
Declaration
public int NumPoses { get; }
Property Value
Type | Description |
---|---|
int |
Methods
GetEnabledLocalSpacePoses()
Read iterator for the enabled local space transforms.
Declaration
public IEnumerable<Pose> GetEnabledLocalSpacePoses()
Returns
Type | Description |
---|---|
IEnumerable<Pose> | An enumerable of enabled local space poses. |
GetEnabledLocalSpaceVelocities()
Read iterator for the enabled local space linear velocities.
Declaration
public IEnumerable<Vector3> GetEnabledLocalSpaceVelocities()
Returns
Type | Description |
---|---|
IEnumerable<Vector3> | An enumerable of enabled local space linear velocities. |
GetEnabledModelSpacePoses()
Read iterator for the enabled model space transforms.
Declaration
public IEnumerable<Pose> GetEnabledModelSpacePoses()
Returns
Type | Description |
---|---|
IEnumerable<Pose> | An enumerable of enabled model space poses. |
GetEnabledModelSpaceVelocities()
Read iterator for the enabled model space linear velocities.
Declaration
public IEnumerable<Vector3> GetEnabledModelSpaceVelocities()
Returns
Type | Description |
---|---|
IEnumerable<Vector3> | An enumerable of enabled model space linear velocities. |
GetLinearVelocityAt(int)
Return the world space linear velocity of the i'th object.
Declaration
protected abstract Vector3 GetLinearVelocityAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the pose for which to get the linear velocity. |
Returns
Type | Description |
---|---|
Vector3 | The world space linear velocity at given index. |
GetNumPoseObservations(PhysicsSensorSettings)
Compute the number of floats needed to represent the poses for the given PhysicsSensorSettings.
Declaration
public int GetNumPoseObservations(PhysicsSensorSettings settings)
Parameters
Type | Name | Description |
---|---|---|
PhysicsSensorSettings | settings | The settings used to configure the physics sensor. |
Returns
Type | Description |
---|---|
int | The number of floats needed to represent the poses for the given |
GetObjectAt(int)
Return the underlying object at the given index. This is only used for display in the inspector.
Declaration
protected virtual Object GetObjectAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the object to retrieve. |
Returns
Type | Description |
---|---|
Object | The |
GetParentIndex(int)
Get the parent index of the body at the specified index.
Declaration
public int GetParentIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the body whose parent index is to be retrieved. |
Returns
Type | Description |
---|---|
int | The parent index of the body at the specified index. |
GetPoseAt(int)
Return the world space Pose of the i'th object.
Declaration
protected abstract Pose GetPoseAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the pose to retrieve. |
Returns
Type | Description |
---|---|
Pose | The world space Pose at given index. |
IsPoseEnabled(int)
Returns whether the pose at the given index is enabled for observations.
Declaration
public bool IsPoseEnabled(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the pose to check. |
Returns
Type | Description |
---|---|
bool | True if the pose is enabled; otherwise, false. |
SetPoseEnabled(int, bool)
Set whether the pose at the given index is enabled or disabled for observations.
Declaration
public void SetPoseEnabled(int index, bool val)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the pose to enable or disable. |
bool | val | Whether the pose is enabled (true) or disabled (false). |
Setup(int[])
Initialize with the mapping of parent indices. The 0th element is assumed to be -1, indicating that it's the root.
Declaration
protected void Setup(int[] parentIndices)
Parameters
Type | Name | Description |
---|---|---|
int[] | parentIndices | An array mapping each pose to its parent index. The root should be -1. |
UpdateLocalSpacePoses()
Update the internal model space transform storage based on the underlying system.
Declaration
public void UpdateLocalSpacePoses()
UpdateModelSpacePoses()
Update the internal model space transform storage based on the underlying system.
Declaration
public void UpdateModelSpacePoses()