机器人专用 Python#
所有标准 VEXcode VR 命令均可用于 V5RC 虚拟技能 - 高风险 游乐场。
运动#
motor.spin()#
The motor.spin(direction)
command is used to spin a motor indefinitely.
这是一个非等待命令,允许任何后续命令无延迟地执行。
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.spin(direction)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
方向 |
The direction for the motor to move in: |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin(FORWARD)
wait(1, SECONDS)
arm_motor.stop()
motor.spin_for()#
The motor.spin_for(direction, distance, units, wait)
command is used to spin a motor for a given amount of degrees or turns.
This is can be a non-waiting or waiting command depending on if the wait
parameter is used.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.spin_for(direction, distance, units, wait)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
方向 |
The direction for the motor to move in: |
距离 |
电机移动的距离,为整数。 |
单位 |
The units that the motor will use: |
等待 |
Optional. The wait parameter determines whether the command will block subsequent commands ( |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin_for(FORWARD, 400, DEGREES)
motor.spin_to_position()#
The motor.spin_to(angle, units, wait)
command is used to spin a motor to a given position.
This is can be a non-waiting or waiting command depending on if the wait
parameter is used.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.spin_for(angle, units, wait)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
角度 |
电机旋转的特定角度或圈数。 |
单位 |
The units that the motor will use: |
等待 |
Optional. The wait parameter determines whether the command will block subsequent commands ( |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin_to_position(400, DEGREES)
motor.stop()#
The motor.stop()
command is used to stop a motor.
这是一个非等待命令,允许任何后续命令无延迟地执行。
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.stop()
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin(FORWARD)
wait(1, SECONDS)
arm_motor.stop()
motor.set_position()#
The motor.set_position(position, units)
command is used to set a motor’s encoder position to the given position value.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.set_position(position, units)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
位置 |
要设置的电机编码器的具体整数。 |
单位 |
The units for the motor to use: |
**返回:**无。
# Make the raised Arm as the new 0 degrees position.
arm_motor.spin_to_position(400, DEGREES)
arm_motor.set_position(0, DEGREES)
motor.set_velocity()#
The motor.set_velocity(velocity, units)
command is used to set the speed of a motor.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.set_velocity(velocity, units)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
速度 |
电机旋转的速度,范围从 -100 到 100。 |
单位 |
The unit for the Motor’s velocity, |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.set_velocity(100, PERCENT)
arm_motor.spin_to_position(400, DEGREES)
motor.set_timeout()#
The motor.set_timeout(value, units)
command is used to set a time limit for a motor’s movement commands.
这可以防止未到达预定位置的运动命令阻止后续命令运行。
这是一个非等待命令,允许任何后续命令无延迟地执行。
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.set_timeout(value, units)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
价值 |
电机停止前等待的时间。 |
单位 |
The unit for the Motor’s timer, |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.set_timeout(1, SECONDS)
arm_motor.spin_for(FORWARD, 3, TURNS)
活动#
front_optical.object_detected()#
front_optical.object_detected(callback)
is the same command as eye.object_detected(callback)
.
The command only uses Axel’s Optical Sensor front_optical
to replace eye
in the standard command.
front_optical.object_lost()#
front_optical.object_lost(callback)
is the same command as eye.object_lost(callback)
.
The command only uses Axel’s Optical Sensor front_optical
to replace eye
in the standard command.
传感#
motor.is_done()#
The motor.is_done()
command is used to return a True or False value if the selected motor has completed its movement.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.is_done()
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
**返回:**这将返回一个布尔值。
motor.is_spinning()#
The motor.is_spinning()
command is used to return a True or False value if the selected motor is moving.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.is_spinning()
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
**返回:**这将返回一个布尔值。
motor.position()#
The motor.position(units)
command is used to return the current rotational position of the selected motor.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.position(units)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
单位 |
The unit of the returned value, |
**返回:**这将返回一个数值。
# Make the raised Arm the new 0 degrees position.
arm_motor.spin_for(FORWARD, 400, DEGREES)
arm_motor.set_position(0, DEGREES)
brain.screen.print(arm_motor.position(DEGREES))
motor.velocity()#
The motor.velocity(units)
command is used to return the current velocity of the selected motor.
To use this command, replace motor
with the desired motor or motor group, for example: arm_motor.velocity(units)
.
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
单位 |
The unit of the motor’s velocity, |
**返回:**这将返回一个数值。
# Lift the Arm up before moving.
arm_motor.set_velocity(100, PERCENT)
arm_motor.spin_to_position(400, DEGREES)
ai_objects = ai_vision.take_snapshot()#
The ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
statement captures the current image from the AI Vision Sensor and analyzes it for all AI Classifications. Identified classifications are stored in an array. While ai_objects
is the default array name used in VEXcode toolbox commands, you can customize this name as needed.
**重要提示:**您需要抬起机器人的手臂,以便 AI 视觉传感器能够清晰地拍摄到游乐场的快照。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此语句返回检测到的 AI 分类及其属性的数组,按其面积从大到小排序。
在此示例中,将拍摄快照,并将最大 AI 分类的中心 X 和 Y 坐标重复打印到打印控制台。
# Lift the Arm to not block the AI Vision Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
while True:
brain.screen.clear_screen()
# Take a snapshot with the AI Vision Sensor with the specified
# signature and store the object data into a variable
# "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is empty before
# pulling any data from the array.
if len(ai_objects) is not 0:
# If yes, print the data of the largest AI Classification.
brain.screen.print("Center X: ", ai_objects[0].centerX)
brain.screen.next_row()
brain.screen.print("Center Y: ", ai_objects[0].centerY)
brain.screen.next_row()
else:
brain.screen.print("No object detected.")
# Take a new snapshot every 0.2 seconds.
wait(0.2, SECONDS)
ai_objects[0].id#
The ai_objects.id
property returns the specified index’s id.
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
Each object has an id
property that identifies its type. The possible id values are:
Mobile Goal:
0
Red Ring:
1
Blue Ring:
2
您还可以将 id 直接与这些预定义常量进行比较:
Mobile Goal:
GameElements.MOBILE_GOAL
Red Ring:
GameElements.RED_RING
Blue Ring:
GameElements.BLUE_RING
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此属性以整数形式返回指定索引的 id。
在这个例子中,AI 视觉传感器将拍摄快照,然后检查检测到的最大的 AI 分类是否是移动目标。
# Lift the Arm by 350 degrees to not block the AI Vision
# Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
# Take a snapshot with the AI Vision Sensor with the
# specified signature and store the object data into
# a variable "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is empty
# before pulling any data from the array.
if len(ai_objects) is not 0:
# If the array is not empty, check if the largest
# AI Classification is a Mobile Goal.
if ai_objects[0].id == GameElements.MOBILE_GOAL:
brain.screen.print("This is a Mobile Goal.")
else:
brain.screen.print("This is not a Mobile Goal.")
ai_objects[0].centerX#
The ai_objects.centerX
property returns the specified index’s X coordinate of the AI Classification’s exact center.
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此属性以整数形式返回指定索引的中心 X 坐标。
此示例将拍摄快照并打印最大 AI 分类的中心 X 坐标。
# Lift the Arm by 350 degrees to not block the AI Vision
# Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
# Take a snapshot with the AI Vision Sensor with the
# specified signature and store the object data into a
# variable "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is empty
# before pulling any data from the array.
if len(ai_objects) is not 0:
brain.screen.print(ai_objects[0].centerX)
ai_objects[0].centerY#
The ai_objects.id
property returns the specified index’s Y coordinate of the AI Classification’s exact center.
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此属性以整数形式返回指定索引的中心 Y 坐标。
此示例将拍摄快照并打印最大 AI 分类的中心 Y 坐标。
# Lift the Arm by 350 degrees to not block the AI Vision
# Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
# Take a snapshot with the AI Vision Sensor with the
# specified signature and store the object data into a
# variable "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is empty
# before pulling any data from the array.
if len(ai_objects) is not 0:
brain.screen.print(ai_objects[0].centerY)
ai_objects[0].originX#
The ai_objects.id
property returns the specified index’s X coordinate of the AI Classification’s top-leftmost corner.
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此属性以整数形式返回指定索引的原点 X 坐标。
此示例将拍摄快照并打印最大 AI 分类的原点 X 坐标。
# Lift the Arm by 350 degrees to not block the AI Vision
# Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
# Take a snapshot with the AI Vision Sensor with the
# specified signature and store the object data into
# a variable "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is
# empty before pulling any data from the array.
if len(ai_objects) is not 0:
brain.screen.print(ai_objects[0].originX)
ai_objects[0].originY#
The ai_objects.id
property returns the specified index’s Y coordinate of the AI Classification’s top-leftmost corner.
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此属性以整数形式返回指定索引的原点 Y 坐标。
此示例将拍摄快照并打印最大 AI 分类的原点 Y 坐标。
# Lift the Arm by 350 degrees to not block the AI Vision
# Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
# Take a snapshot with the AI Vision Sensor with the
# specified signature and store the object data into
# a variable "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is
# empty before pulling any data from the array.
if len(ai_objects) is not 0:
brain.screen.print(ai_objects[0].originY)
ai_objects[0].width#
The ai_objects.id
property returns the specified index’s width in pixels.
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此属性以整数形式返回指定索引的宽度。
此示例将拍摄快照并打印第二大 AI 分类的宽度。
# Lift the Arm by 350 degrees to not block the AI Vision
# Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
# Take a snapshot with the AI Vision Sensor with the
# specified signature and store the object data into a
# variable "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is empty
# before pulling any data from the array.
if len(ai_objects) is not 0:
brain.screen.print(ai_objects[0].width)
ai_objects[0].height#
The ai_objects.id
property returns the specified index’s height in pixels.
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
Before attempting to access data stored from the last snapshot, you should always check if your array is not empty. You can use the len()
function to verify this. If len()
returns 0
, the array is empty and contains no data from the last snapshot.
if len(ai_objects) is not 0:
**返回:**此属性以整数形式返回指定索引的宽度。
此示例将拍摄快照并打印第二大 AI 分类的高度。
# Lift the Arm by 350 degrees to not block the AI Vision
# Sensor's field of view.
arm_motor.spin_for(FORWARD, 350, DEGREES)
# Take a snapshot with the AI Vision Sensor with the
# specified signature and store the object data into a
# variable "ai_objects".
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
# Use the len() function to check if the array is empty
# before pulling any data from the array.
if len(ai_objects) is not 0:
brain.screen.print(ai_objects[0].height)
front_optical.is_near_object()#
The front_optical.is_near_object()
command is used to report a Boolean value if the Optical Sensor is close enough to an object to detect a color.
**返回:**报告一个布尔值。
# Print if the Front Optical Sensor is detecting an object.
brain.screen.print(front_optical.is_near_object())
front_optical.color()#
The front_optical.color()
command is used to return the color detected by an Optical Sensor.
这是一个非等待命令,允许任何后续命令无延迟地执行。
以下颜色可用于与光学传感器检测到的颜色进行比较:
红色的
绿色的
蓝色的
黄色的
橙子
紫色的
青色
**返回:**以字符串形式返回检测到的颜色的名称。
# Identify the color of the ring on the Arm.
brain.screen.print(front_optical.color())
front_optical.brightness()#
The front_optical.brightness()
command is used to report the amount of light detected by an Optical Sensor within a range of 0 to 100 percent.
**返回:**这将返回一个数值。
# Lift the Arm by 350 degrees to not block the Optical Sensor.
arm_motor.spin_for(FORWARD, 350, DEGREES)
brain.screen.print(front_optical.brightness())
front_optical.hue()#
The front_optical.brightness()
command is used to report the hue of the object detected by an Optical Sensor within a range of 0 to 359. This number represents the location of the detected color on a color wheel.
**返回:**这将返回一个数值。
# Print the hue of the ring on the Arm.
brain.screen.print("Hue: ", optical.hue())
rotation.set_position()#
The pusher_rotation.set_position(value, units)
command is used to sets a Rotation Sensor’s position to the given value.
参数 |
描述 |
---|---|
价值 |
设置旋转传感器位置的值。 |
单位 |
The unit of the set position, |
**返回:**无。
rotation.angle()#
The pusher_rotation.angle(value, units)
command returns the Pusher Motor’s current angle of rotation in degrees.
**返回:**一个整数。
rotation.position()#
The pusher_rotation.position(units)
command returns the Pusher Motor’s current position.
参数 |
描述 |
---|---|
单位 |
The unit of the set position, |
**返回:**一个整数。
gps.x_position()#
gps.x_position(units)
returns the X positional offset of a GPS (Game Positioning System™) Sensor or defined origin point from the center of a field.
这是一个非等待命令,允许任何后续命令无延迟地执行。
参数 |
描述 |
---|---|
单位 |
The unit of the offset value, |
**返回:**这将返回一个数值。
def main():
# Print the current X positional offset of the robot.
brain.screen.print(gps.x_position(MM))
gps.y_position()#
gps.y_position(units)
returns the Y positional offset of a GPS (Game Positioning System™) Sensor or defined origin point from the center of a field.
这是一个非等待命令,允许任何后续命令无延迟地执行。
参数 |
描述 |
---|---|
单位 |
The unit of the offset value, |
**返回:**这将返回一个数值。
def main():
# Print the current Y positional offset of the robot.
brain.screen.print(gps.y_position(MM))
gps.heading()#
The gps.heading()
command is used to report the heading that a robot is currently facing based on a GPS Sensor’s readings from the VEX GPS Field Code.
这是一个非等待命令,允许任何后续命令无延迟地执行。
**返回:**这将返回一个数值。
def main():
# Print the current heading of the robot.
brain.screen.print(gps.heading())