pid
Array API PID controllers for batched simulation.
类:
| 名称 | 描述 |
|---|---|
PID |
Vectorized PID controller with optional derivative filtering. |
FlightController |
PID-based flight controller for batched Array API arrays. |
PID
PID(xp: ModuleType, device, Kp: ArrayLike, Ki: ArrayLike | None = None, Kd: ArrayLike | None = None, dt: float = 0.01, N: float = 100.0, integral_limit: ArrayLike | None = None)
Vectorized PID controller with optional derivative filtering.
Initialize PID gains and internal state arrays.
方法:
| 名称 | 描述 |
|---|---|
reset |
Reset integrator and derivative state for selected environments. |
update |
Compute the PID output for the current batched error. |
reset
reset(env_ids=None)
Reset integrator and derivative state for selected environments.
update
update(error: ArrayLike) -> ArrayLike
Compute the PID output for the current batched error.
FlightController
FlightController(params: VehicleParams = VehicleParams(), control_mask: dict | None = None, gains: dict | None = None, limits: dict | None = None, num_envs: int = 1, device=None, *, backend: BackendName | None = None, xp: ModuleType | None = None)
Bases: ControllerBase
PID-based flight controller for batched Array API arrays.
Initialize the batched flight PID controller.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
VehicleParams
|
Vehicle parameters used by the controller. |
VehicleParams()
|
|
dict | None
|
Dict mask mapped to state keys. Channels not in the mask are filled by the cascade. |
None
|
|
dict | None
|
Optional PID gain dictionary. |
None
|
|
dict | None
|
Optional controller-side target limits. |
None
|
|
int
|
Number of parallel environments represented by the batch. |
1
|
|
Optional backend device, mainly used by Torch. |
None
|
|
|
BackendName | None
|
Explicit Array API backend name. |
None
|
|
ModuleType | None
|
Pre-resolved Array API namespace. Overrides |
None
|
方法:
| 名称 | 描述 |
|---|---|
randomize |
Randomize gains, limits, and selected physical parameters. |
reset |
Reset all inner PID loops for selected environments. |
update |
Compute batched thrust and moments for the current target/state. |
gains_to_randomization_ranges |
Gains to randomization ranges. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
params |
VehicleParams
|
Vehicle parameters for the controller. |
params
instance-attribute
params: VehicleParams = params
Vehicle parameters for the controller.
randomize
randomize(env_ids=None, gains: dict[str, Any] | None = None, limits: dict[str, Any] | None = None, params: dict[str, Any] | None = None)
Randomize gains, limits, and selected physical parameters.
reset
reset(env_ids=None)
Reset all inner PID loops for selected environments.
update
update(target: ControllerTarget, state: ControllerState) -> ArrayLike
Compute batched thrust and moments for the current target/state.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
ControllerTarget
|
Desired state dict with batched Array API arrays. |
必需 |
|
ControllerState
|
Current state dict with |
必需 |
返回:
| 类型 | 描述 |
|---|---|
ArrayLike
|
Control output |
ArrayLike
|
with shape |
gains_to_randomization_ranges
classmethod
gains_to_randomization_ranges(gains: dict | None = None, scale: float = 0.2) -> dict
Gains to randomization ranges.