磁鐵#

介紹#

VEX VR Magnet 可以讓你的機器人透過拾取和釋放磁性物體來與它們互動。

以下是所有可用方法的清單:

操作 – 啟用或停用磁鐵。

  • energize – 設定磁鐵拾取或放下物體。

行動#

energize#

energize 設定磁鐵的狀態,使其能夠拾取或放下物體。

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)