跳转至

attitude

Shared model with rotation-manifold projection layers.

Control modes and their action dimensions::

cmd_ctatt_euler → 4D [thrust, roll, pitch, yaw] cmd_ctatt_rotvec → 4D [thrust, rx, ry, rz] cmd_ctatt_quat → 5D [thrust, qx, qy, qz, qw] cmd_ctatt_rotmat → 10D [thrust, r00..r22]

Projection layers ensure the rotation component of the policy output lies on a valid SO(3) manifold. Available variants per rotation type:

============== ============================================================ Euler / rotvec EulerProjection (tanh clamp) Quaternion QuatProjection (tanh + L2-normalize) QuatPlusProjection (tanh + sigmoid w + L2-normalize) QuatOffsetProjection (offset by identity quat) Rotation RotmatProjection (tanh + SVD-orthogonalize) matrix RotmatOffsetProjection (offset by identity matrix) ============== ============================================================

Select a non-default projection by passing projection_cls when constructing :class:SharedAttitude. The config module re-exports the projection classes for compatibility with existing experiments.

类:

名称 描述
SharedAttitude

Shared actor-critic with rotation-manifold policy projection.

SharedAttitude

SharedAttitude(observation_space, state_space, action_space, device, clip_actions=False, clip_log_std=True, min_log_std=-20, max_log_std=2, reduction='sum', projection_cls: type[Module] | None = None)

Bases: GaussianMixin, DeterministicMixin, Model

Shared actor-critic with rotation-manifold policy projection.

The trunk is a 2-hidden-layer MLP (128 units, ELU activation) shared between policy and value heads. The policy mean passes through an optional :class:nn.Module projection layer that enforces the rotation component to lie on the correct manifold (e.g. unit quaternion, orthogonal matrix).

The projection is selected by action_dim via :data:_PROJECTION_MAP unless an explicit projection_cls is provided.

Initialize shared trunk, heads, and optional projection layer.

参数:

名称 类型 描述 默认

observation_space

Environment observation space.

必需

state_space

Environment state space.

必需

action_space

Environment action space.

必需

device

Torch device for parameters and computation.

必需

clip_actions

Whether to clip actions to the action space bounds (passed to :class:GaussianMixin).

False

clip_log_std

Whether to clip the log-standard-deviation (passed to :class:GaussianMixin).

True

min_log_std

Minimum log-std value.

-20

max_log_std

Maximum log-std value.

2

reduction

Reduction mode for the log-probability.

'sum'

projection_cls

type[Module] | None

Optional override for the rotation-manifold projection layer. When None (default), the projection is auto-detected from action_space via :data:_PROJECTION_MAP.

None

方法:

名称 描述
act

Dispatch to the appropriate mixin based on role.

compute

Compute policy mean or state value.

act

act(inputs: Any, role: str) -> Any

Dispatch to the appropriate mixin based on role.

参数:

名称 类型 描述 默认

inputs

Any

Model inputs dict (must contain "observations").

必需

role

str

"policy" or "value".

必需

返回:

类型 描述
Any

Action outputs for the given role, or None if unknown.

compute

compute(inputs: Any, role: str) -> Any

Compute policy mean or state value.

For the "policy" role the mean passes through the rotation-manifold projection (if configured) and the trunk features are cached for reuse by the value head.

参数:

名称 类型 描述 默认

inputs

Any

Model inputs dict (must contain "observations").

必需

role

str

"policy" or "value".

必需

返回:

类型 描述
Any

(output_tensor, extras_dict) for the given role,

Any

or None if role is unknown.