跳转至

geo

Torch-based Geometric Controller for batched simulation.

Based on Lee, Leok, McClamroch (CDC 2010). Uses scipy.spatial.transform.Rotation (SCIPY_ARRAY_API=1) for SO(3) operations on torch tensors. hat/vee remain pure torch (not in scipy).

类:

名称 描述
GeoControl

Batched geometric controller tracking position/velocity/attitude/body-rate.

GeoControl

GeoControl(params: VehicleParams = VehicleParams(), control_mask: dict | None = None, gains: dict | None = None, limits: dict | None = None, *, num_envs: int = 1, device: str | device = 'cpu')

Bases: ControllerBase

Batched geometric controller tracking position/velocity/attitude/body-rate.

Target/state are dicts mapping semantic keys to batched tensors (N, *). Rotation is resolved from the state dict in order of preference: att_rotmatatt_quatatt_rotvecatt_euler.

control_mask is a dict mapping state keys to per-channel bool lists, e.g. {"pos": [1,1,1], "vel": [1,1,1], "att_euler": [1,1,1], "ang_vel": [1,1,1]}.

Initialize gains, mass, inertia as batched tensors.

参数:

名称 类型 描述 默认

params

VehicleParams

Vehicle parameters.

VehicleParams()

control_mask

dict | None

Dict mask mapped to state keys. Channels not listed or masked as 0 are cascade-computed from state.

None

gains

dict | None

Dict with keys x / v / R / W, each a 3-element list of gains.

None

limits

dict | None

Optional controller limits dict (reserved, no-op for GeoControl).

None

num_envs

int

Number of parallel environments.

1

device

str | device

Torch device.

'cpu'

方法:

名称 描述
reset

Reset controller state (stateless — no-op).

gains_to_randomization_ranges

Build min/max gain ranges from defaults, scaled by ± scale.

randomize

Randomize controller gains and physical parameters.

update

Compute batched (N, 4) [thrust, Mx, My, Mz] from target and state.

属性:

名称 类型 描述
params VehicleParams

Vehicle parameters for the controller.

control_mask dict

Control mask dict mapped to state keys, used in update().

params instance-attribute

params: VehicleParams = params

Vehicle parameters for the controller.

control_mask instance-attribute

control_mask: dict = control_mask if control_mask is not None else {}

Control mask dict mapped to state keys, used in update().

reset

reset(env_ids=None) -> None

Reset controller state (stateless — no-op).

gains_to_randomization_ranges classmethod

gains_to_randomization_ranges(gains=None, scale=0.2)

Build min/max gain ranges from defaults, scaled by ± scale.

randomize

randomize(env_ids=None, gains=None, limits=None, params=None) -> None

Randomize controller gains and physical parameters.

update

update(target: dict, state: dict) -> torch.Tensor

Compute batched (N, 4) [thrust, Mx, My, Mz] from target and state.

参数:

名称 类型 描述 默认

target

dict

Dict with batched tensors for desired state channels.

必需

state

dict

Dict: pos(N,3), vel(N,3), att_euler(N,3), ang_vel(N,3) (plus optional att_rotmat/att_quat /att_rotvec).

必需

返回:

类型 描述
Tensor

(N, 4) [thrust, Mx, My, Mz]