控制器#
介绍#
单摇杆控制器采用 4 键布局,并配备一个摇杆,摇杆既可用作模拟输入,又可用作可按压按钮。这些输入使机器人能够检测按钮按下和摇杆移动,从而实现交互式、灵敏的控制。以下是所有可用模块的列表:
controller button pressed? – Checks if a specific button is currently being pressed.
controller axis position – Returns the position of the joystick along a specified axis.
when controller button – Runs a stack of blocks when a button is pressed or released.
when controller axis is changed – Runs a stack of blocks when the joystick position changes.
控制器轴位置#
控制器轴位置块以 -100 到 100 之间的整数返回操纵杆沿指定轴的位置。
控制器轴位置报告块。#
(控制器轴 [1 v] 位置)
参数 |
描述 |
---|---|
轴 |
The axis to return the position of:
|
例子
当开始 :: hat events
[向上移动操纵杆时向前移动.]
永久循环
如果 <(控制器轴 [1 v] 位置) [math_greater_than v] [0]> 那么
移动 [正 v]
否则
停止移动
当控制器轴改变时#
当轴发生变化时,当控制器轴发生变化时块会激活附加的块堆栈。
当控制器轴改变时帽子块。#
当遥控器 [1 v] 轴改变 :: hat events
参数 |
描述 |
---|---|
轴 |
The axis to check for change:
|
例子
当遥控器 [1 v] 轴改变 :: hat events
[移动操纵杆时向前移动.]
移动 [正 v] [50] [mm v] ▶