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.
Classes:
| Name | Description |
|---|---|
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Environment observation space. |
required | |
|
Environment state space. |
required | |
|
Environment action space. |
required | |
|
Torch device for parameters and computation. |
required | |
|
Whether to clip actions to the action space
bounds (passed to :class: |
False
|
|
|
Whether to clip the log-standard-deviation
(passed to :class: |
True
|
|
|
Minimum log-std value. |
-20
|
|
|
Maximum log-std value. |
2
|
|
|
Reduction mode for the log-probability. |
'sum'
|
|
|
type[Module] | None
|
Optional override for the rotation-manifold
projection layer. When |
None
|
Methods:
| Name | Description |
|---|---|
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Any
|
Model inputs dict (must contain |
required |
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
Any
|
Action outputs for the given role, or |
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Any
|
Model inputs dict (must contain |
required |
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
Any
|
|
Any
|
or |