fr_gtm.interface.stick
本页由
fr-docs-dev gen-api从源码 docstring 生成,请勿手工编辑;重新生成执行just api。
把 fly_stick 的设备快照转换为 GTM 四通道操纵命令。
公开成员
| 名称 | 类型 | 定义位置 |
|---|---|---|
StickConfig | 类 | 本页 |
to_command | 函数 | 本页 |
定义
StickConfig
python
class StickConfig(roll_axis: str = 'ABS_X', pitch_axis: str = 'ABS_Y', yaw_axis: str = 'ABS_RZ', throttle_axis: str | None = 'ABS_THROTTLE', invert_roll: bool = False, invert_pitch: bool = False, invert_yaw: bool = False, invert_throttle: bool = False, control_scale: float = 0.6, nominal_throttle: float = 40.0, axis_deadband: float = 0.03)轴别名、方向与操纵幅度;设备标定与连接由 fly_stick 管理。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
roll_axis | str | 'ABS_X' | 滚转轴别名。 |
pitch_axis | str | 'ABS_Y' | 俯仰轴别名。 |
yaw_axis | str | 'ABS_RZ' | 偏航轴别名。 |
throttle_axis | str | None | 'ABS_THROTTLE' | 可选油门轴别名,None 表示不用油门轴。 |
invert_roll | bool | False | 相对默认负向映射反转滚转轴。 |
invert_pitch | bool | False | 相对默认负向映射反转俯仰轴。 |
invert_yaw | bool | False | 相对默认负向映射反转偏航轴。 |
invert_throttle | bool | False | 相对默认负向映射反转油门轴。 |
control_scale | float | 0.6 | 舵面正负行程比例,范围 [0,1]。 |
nominal_throttle | float | 40.0 | 没有油门轴时的油门指令,%。 |
axis_deadband | float | 0.03 | 舵面中心死区,范围 [0,1),其余行程线性重标定。 |
roll_axis
python
roll_axis: str = 'ABS_X'滚转轴别名。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:37
pitch_axis
python
pitch_axis: str = 'ABS_Y'俯仰轴别名。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:39
yaw_axis
python
yaw_axis: str = 'ABS_RZ'偏航轴别名。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:41
throttle_axis
python
throttle_axis: str | None = 'ABS_THROTTLE'可选油门轴别名;None 禁用。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:43
invert_roll
python
invert_roll: bool = False相对默认负向映射反转滚转轴。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:45
invert_pitch
python
invert_pitch: bool = False相对默认负向映射反转俯仰轴。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:47
invert_yaw
python
invert_yaw: bool = False相对默认负向映射反转偏航轴。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:49
invert_throttle
python
invert_throttle: bool = False相对默认负向映射反转油门轴。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:51
control_scale
python
control_scale: float = 0.6舵面行程比例 [0,1]。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:53
nominal_throttle
python
nominal_throttle: float = 40.0无油门轴时的固定油门指令,%。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:55
axis_deadband
python
axis_deadband: float = 0.03舵面死区 [0,1)。
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:57
__init__
python
def __init__(roll_axis: str = 'ABS_X', pitch_axis: str = 'ABS_Y', yaw_axis: str = 'ABS_RZ', throttle_axis: str | None = 'ABS_THROTTLE', invert_roll: bool = False, invert_pitch: bool = False, invert_yaw: bool = False, invert_throttle: bool = False, control_scale: float = 0.6, nominal_throttle: float = 40.0, axis_deadband: float = 0.03) -> None实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:19
to_command
python
def to_command(state: _StickSnapshot, description: DeviceDescription, cfg: GTMConfig, *, config: StickConfig = _DEFAULT_CONFIG) -> NumpyArray读取必需操纵轴并映射为 [升降舵deg,副翼deg,方向舵deg,油门%]。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
state | _StickSnapshot | — | fly_stick 完整设备快照,不是事件差分。 |
description | DeviceDescription | — | 设备 profile,定义硬件轴到别名的映射。 |
cfg | GTMConfig | — | 提供舵面与发动机指令边界的整机配置。 |
config | StickConfig | _DEFAULT_CONFIG | 轴映射与手感设置。 |
返回
| 类型 | 说明 |
|---|---|
NumpyArray | 形状 (4,) 的 float64 命令,按配置限幅;不构造模型 u 向量。 |
异常
| 类型 | 说明 |
|---|---|
KeyError | 必需的俯仰、滚转或偏航轴别名缺失。 |
ValueError | 轴值不是有限值。 |
实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:72