Python#

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

了解命令条目#

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

  • 命令名称和签名:这是命令及其参数的名称。

  • 描述:对该命令功能的简要说明。

  • 阻塞/非阻塞:表示命令是否等待完成后再转到下一个命令。

  • 参数表:列出并描述该命令接受的参数。

  • 返回:描述命令返回的内容(如果适用)。

  • 示例:提供示例代码片段,演示如何使用该命令。

命令输入示例#

移动_inc()#

The move_inc(x, y, z, wait) method moves the End Effector by the requested X, Y, and Z distances.

This can be a waiting or non-waiting method depending on if the wait parameter is used.

参数

描述

x

x 轴上移动的距离(以毫米为单位)。

y

y 轴上移动的距离(以毫米为单位)。

z

z 轴上移动的距离(以毫米为单位)。

wait

Optional. The wait parameter determines whether the method will block subsequent method (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait==True.

Returns: True if the 6-Axis Arm has moved to the requested position when wait is True. False if it did not.

# Move the Arm +100 millimeters on the y axis.
arm.move_inc(0, 100, 0)