Skip to content

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_axisstr'ABS_X'滚转轴别名。
pitch_axisstr'ABS_Y'俯仰轴别名。
yaw_axisstr'ABS_RZ'偏航轴别名。
throttle_axisstr | None'ABS_THROTTLE'可选油门轴别名,None 表示不用油门轴。
invert_rollboolFalse相对默认负向映射反转滚转轴。
invert_pitchboolFalse相对默认负向映射反转俯仰轴。
invert_yawboolFalse相对默认负向映射反转偏航轴。
invert_throttleboolFalse相对默认负向映射反转油门轴。
control_scalefloat0.6舵面正负行程比例,范围 [0,1]。
nominal_throttlefloat40.0没有油门轴时的油门指令,%。
axis_deadbandfloat0.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 完整设备快照,不是事件差分。
descriptionDeviceDescription—设备 profile,定义硬件轴到别名的映射。
cfgGTMConfig—提供舵面与发动机指令边界的整机配置。
configStickConfig_DEFAULT_CONFIG轴映射与手感设置。

返回

类型说明
NumpyArray形状 (4,) 的 float64 命令,按配置限幅;不构造模型 u 向量。

异常

类型说明
KeyError必需的俯仰、滚转或偏航轴别名缺失。
ValueError轴值不是有限值。

实现位置:models/fr_gtm/src/fr_gtm/interface/stick.py:72