磁铁#

介绍#

VEX VR Magnet 可以让你的机器人通过拾取和释放磁性物体来与它们进行交互。

以下是所有可用方法的列表:

操作 – 启用或禁用磁铁。

  • energize – Sets the magnet to pick up or drop objects.

行动#

energize#

energize sets the state of the magnet so it can pick up or drop objects.

Usage:
magnet.energize(action)

参数

描述

action

The state of the magnet to set:

  • BOOST – Enables the magnet to pick up objects.
  • DROP – Disables picking up objects and drops any held objects.
def main():
    # Pick up and drop off a disk
    drivetrain.drive_for(FORWARD, 800, MM)
    magnet.energize(BOOST)
    drivetrain.drive_for(REVERSE, 800, MM)
    magnet.energize(DROP)

# VR threads — Do not delete
vr_thread(main)