Python#

本指南详细介绍了如何在 VEXcode AIR 中使用 Python 方法。您将学习如何阅读和理解每个方法,并了解其详尽的描述、参数和使用示例。

了解方法条目#

API 参考中的每个方法条目都包含以下组件:

  • 命令名称 – 命令的正式名称。

  • 描述 – 对命令的作用和可能返回的内容的简要说明。

  • 定义 – 命令的语法,显示如何在代码中编写它。

  • 参数表——列出命令接受的所有输入。

  • 示例代码 – 以复制粘贴代码块形式提供的使用示例。

示例方法条目#

起飞#

take_off lifts the VEX AIR Drone into the air. The default takeoff height is around 500 millimeters.

用法:

drone.take_off(distance)

参数

描述

distance

无人机飞行高度为100至850毫米。

# Take off and move.
drone.take_off(climb_to=500)
drone.move_at(direction=0, velocity=50)
wait(2, SECONDS)
drone.land()