移动手臂#
Moving the Arm
This tutorial covers how to move the arm on your VEX IQ Clawbot in VEXcode IQ (2nd gen). By the end, you’ll have a project that raises the arm.
要使用 VEX IQ Clawbot 上的机械臂,首先需要在 VEXcode 中配置 Clawbot。最简单的方法是打开一个 Clawbot 模板。
Go to the Devices tab, then select Select a build. If the Devices tab is not visible, see Navigating VEXcode.
向下滚动并选择Clawbot版本。
本教程中使用的模型是 Clawbot 的 驱动系统、爪子 + 机械臂 版本。
选择完成将此版本添加到您的项目中。
在工具箱中选择“运动”类别,找到“旋转”模块。
将 旋转电机模块 连接到 启动时 模块。
用于积木的旋转电机,默认情况下由 ClawMotor 驱动旋转。#
spin [ClawMotor v] [close v] for (90) [degrees v] ▶
默认情况下,该模块的电机参数设置为ClawMotor。请选择下拉菜单并选择ArmMotor,以便该模块控制机械臂。
模块的旋转电机现在正在旋转 ArmMotor。#
spin [ArmMotor v] [up v] for (90) [degrees v] ▶
将方向参数更改为向上或向下,并将距离参数更改为您希望机械臂移动的距离。这将使机械臂从当前位置移动相应的角度。
启动时,将机械臂从当前位置抬升 90 度。#
当开始
spin [ArmMotor v] [up v] for (90) [degrees v] ▶
您还可以将单位参数更改为“圈数”而不是“度数”。一圈等于 360 度。
用于积木的旋转电机,使用圈数而不是角度。#
spin [ArmMotor v] [up v] for (1) [turns v] ▶
一个技巧是,在使用 spin motor for 模块之前,先使用 set motor timeout 模块。
设置电机超时模块。#
设定 [ArmMotor v] 超时为 (1) 秒
如果您不小心将 旋转电机时间 模块的距离设置得太大,设置电机超时 模块将强制其结束,项目继续进行,即使电机尚未到达其想要的位置。
启动时,设置 1 秒超时后再抬起机械臂,这样即使机械臂没有到达目标位置,项目也会继续进行。#
当开始
设定 [ArmMotor v] 超时为 (1) 秒
spin [ArmMotor v] [up v] for (600) [degrees v] ▶