mapping
Control-mode mapping utilities for NumPy-based controller pipelines.
类:
| 名称 | 描述 |
|---|---|
FlightMappingConfig |
Mapping-range configuration for normalized action scaling. |
FlightMappingResult |
Mapped result for a normalized flight action or action batch. |
FlightActionMapper |
Map normalized actions into controller targets, wrench commands, or RPM. |
函数:
| 名称 | 描述 |
|---|---|
target_to_command |
Convert a full 12D target into a compact command vector. |
FlightMappingConfig
dataclass
FlightMappingConfig(velocity_range: tuple[float, float, float] | None = None, attitude_range: tuple[float, float, float] | None = None, body_rate_range: tuple[float, float, float] | None = (2.0, 2.0, 2.0))
Mapping-range configuration for normalized action scaling.
方法:
| 名称 | 描述 |
|---|---|
from_params |
Build mapping ranges from vehicle parameters. |
resolve |
Resolve config overrides into concrete mapping ranges. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
velocity_range |
tuple[float, float, float] | None
|
Velocity scaling in m/s for x, y, z axes. |
attitude_range |
tuple[float, float, float] | None
|
Attitude scaling in radians. |
body_rate_range |
tuple[float, float, float] | None
|
Body-rate scaling in rad/s. |
velocity_range
class-attribute
instance-attribute
velocity_range: tuple[float, float, float] | None = None
Velocity scaling in m/s for x, y, z axes.
attitude_range
class-attribute
instance-attribute
attitude_range: tuple[float, float, float] | None = None
Attitude scaling in radians.
body_rate_range
class-attribute
instance-attribute
body_rate_range: tuple[float, float, float] | None = (2.0, 2.0, 2.0)
Body-rate scaling in rad/s.
from_params
classmethod
from_params(params: VehicleParams) -> FlightMappingConfig
Build mapping ranges from vehicle parameters.
The returned ranges are chosen to broadly cover the controller range
exposed by VehicleParams without requiring exact one-to-one
alignment with the internal PX4-style controller limits.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
VehicleParams
|
Vehicle parameters providing the reference control bounds. |
必需 |
返回:
| 名称 | 类型 | 描述 |
|---|---|---|
FlightMappingConfig |
FlightMappingConfig
|
Mapping ranges derived from |
resolve
resolve(params: VehicleParams) -> FlightMappingConfig
Resolve config overrides into concrete mapping ranges.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
VehicleParams
|
Vehicle parameters providing fallback control bounds. |
必需 |
返回:
| 名称 | 类型 | 描述 |
|---|---|---|
FlightMappingConfig |
FlightMappingConfig
|
Concrete mapping ranges for runtime use. |
FlightMappingResult
dataclass
FlightMappingResult(rpm_command: ndarray | Tensor, control: ndarray | Tensor | None = None, target: ndarray | Tensor | None = None)
Mapped result for a normalized flight action or action batch.
FlightActionMapper
FlightActionMapper(control_mode: str, params: VehicleParams = VehicleParams(), mapping: FlightMappingConfig | None = None)
Map normalized actions into controller targets, wrench commands, or RPM.
Initialize a NumPy flight action mapper for the selected control mode.
方法:
| 名称 | 描述 |
|---|---|
action_to_collective_acc |
Map a normalized policy collective action to total collective acceleration. |
collective_acc_to_thrust |
Convert total collective acceleration into total thrust in Newtons. |
action_to_collective_thrust |
Convert a normalized policy collective action into total thrust. |
map_action |
Map a normalized action into an RPM command and optional intermediates. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
requires_controller |
bool
|
Whether this mode needs a controller target expansion step. |
requires_controller
property
requires_controller: bool
Whether this mode needs a controller target expansion step.
action_to_collective_acc
action_to_collective_acc(action: float | ndarray, mixer: Mixer) -> np.ndarray
Map a normalized policy collective action to total collective acceleration.
collective_acc_to_thrust
collective_acc_to_thrust(collective_acc: float | ndarray) -> np.ndarray
Convert total collective acceleration into total thrust in Newtons.
action_to_collective_thrust
action_to_collective_thrust(action: float | ndarray, mixer: Mixer) -> np.ndarray
Convert a normalized policy collective action into total thrust.
map_action
map_action(action: ndarray, mixer: Mixer, *, state: ndarray | None = None, flight_controller: ControllerBase | None = None) -> FlightMappingResult
Map a normalized action into an RPM command and optional intermediates.
target_to_command
target_to_command(target: ndarray, command_mode: str, state: ndarray | None = None) -> np.ndarray
Convert a full 12D target into a compact command vector.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
ndarray
|
Full target state ordered as
|
必需 |
|
str
|
Supported target command mode. Valid values are
|
必需 |
|
ndarray | None
|
Current 12D vehicle state. Required only for |
None
|
返回:
| 名称 | 类型 | 描述 |
|---|---|---|
ndarray
|
np.ndarray: A compact command vector matching the requested command |
|
mode |
ndarray
|
|
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
If |