跳转至

base

Base interfaces for LAV2 controllers.

类:

名称 描述
ControllerState

Sparse controller state fields shared by measured state and target dicts.

ControllerBase

Abstract controller base class.

属性:

名称 类型 描述
ControllerTarget

Desired controller target fields; schema matches :class:ControllerState.

ControllerTarget module-attribute

ControllerTarget = ControllerState

Desired controller target fields; schema matches :class:ControllerState.

ControllerState

Bases: TypedDict

Sparse controller state fields shared by measured state and target dicts.

属性:

名称 类型 描述
thrust ArrayLike

Collective thrust in newtons, shape (N, 1).

pos ArrayLike

World-frame position, shape (N, 3).

vel ArrayLike

World-frame linear velocity, shape (N, 3).

vel_b ArrayLike

Body-frame linear velocity, shape (N, 3); used by ground control.

acc ArrayLike

World-frame linear acceleration, shape (N, 3).

att_euler ArrayLike

Roll, pitch, yaw angles in radians, shape (N, 3).

att_quat ArrayLike

Quaternion attitude in xyzw order, shape (N, 4).

att_rotmat ArrayLike

Flattened attitude rotation matrix, shape (N, 9).

att_rotvec ArrayLike

Attitude rotation vector in radians, shape (N, 3).

ang_vel ArrayLike

Body angular velocity in radians per second, shape (N, 3).

thrust instance-attribute

thrust: ArrayLike

Collective thrust in newtons, shape (N, 1).

pos instance-attribute

pos: ArrayLike

World-frame position, shape (N, 3).

vel instance-attribute

vel: ArrayLike

World-frame linear velocity, shape (N, 3).

vel_b instance-attribute

vel_b: ArrayLike

Body-frame linear velocity, shape (N, 3); used by ground control.

acc instance-attribute

acc: ArrayLike

World-frame linear acceleration, shape (N, 3).

att_euler instance-attribute

att_euler: ArrayLike

Roll, pitch, yaw angles in radians, shape (N, 3).

att_quat instance-attribute

att_quat: ArrayLike

Quaternion attitude in xyzw order, shape (N, 4).

att_rotmat instance-attribute

att_rotmat: ArrayLike

Flattened attitude rotation matrix, shape (N, 9).

att_rotvec instance-attribute

att_rotvec: ArrayLike

Attitude rotation vector in radians, shape (N, 3).

ang_vel instance-attribute

ang_vel: ArrayLike

Body angular velocity in radians per second, shape (N, 3).

ControllerBase

ControllerBase(params: VehicleParams, control_mask: dict | None = None, gains: dict | None = None)

Bases: ABC

Abstract controller base class.

Initialize shared controller state.

参数:

名称 类型 描述 默认

params

VehicleParams

Vehicle parameters for the controller.

必需

control_mask

dict | None

Dict mask mapped to state keys. e.g. {"pos": [1, 1, 1], "att_euler": [0, 0, 1]} for position+yaw control. Keys not present are cascade-computed.

None

gains

dict | None

Optional gains configuration for derived controllers.

None

方法:

名称 描述
update

Update the controller and return control outputs.

reset

Reset controller state if necessary.

属性:

名称 类型 描述
params VehicleParams

Vehicle parameters for the controller.

control_mask dict

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

gains dict | None

Optional gains configuration for derived controllers.

target ControllerTarget

Latest target dict input to the controller.

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().

gains instance-attribute

gains: dict | None = gains

Optional gains configuration for derived controllers.

target instance-attribute

target: ControllerTarget = {}

Latest target dict input to the controller.

update abstractmethod

update(target: ControllerTarget, state: ControllerState)

Update the controller and return control outputs.

参数:

名称 类型 描述 默认

target

ControllerTarget

Dict with state keys and desired values.

必需

state

ControllerState

Dict with current state keys.

必需

返回:

类型 描述

Control output array.

reset abstractmethod

reset(*args, **kwargs)

Reset controller state if necessary.