机器人专用 Python#
所有标准 VEXcode VR 命令均可用于 V5RC 虚拟技能 - 高风险 游乐场。
运动#
电机.旋转()#
motor.spin(direction)
命令用于无限旋转电机。
这是一个非等待命令,允许任何后续命令无延迟地执行。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.spin(direction)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
方向 |
电机转动的方向:“前进”或“后退”。 |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin(FORWARD)
wait(1, SECONDS)
arm_motor.stop()
电机.spin_for()#
motor.spin_for(direction, distance, units, wait)
命令用于使电机旋转给定的度数或圈数。
这可以是非等待或等待命令,取决于是否使用了“wait”参数。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.spin_for(direction, distance, units, wait)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
方向 |
电机转动的方向:“前进”或“后退”。 |
距离 |
电机移动的距离,为整数。 |
单位 |
电机将使用的单位:“度”或“圈”。 |
等待 |
可选。 wait 参数决定命令是否阻止后续命令( |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin_for(FORWARD, 400, DEGREES)
电机.旋转到位置()#
motor.spin_to(angle, unit, wait)
命令用于将电机旋转到给定位置。
这可以是非等待或等待命令,取决于是否使用了“wait”参数。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.spin_for(angle, unit, wait)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
角度 |
电机旋转的特定角度或圈数。 |
单位 |
电机将使用的单位:“度”或“圈”。 |
等待 |
可选。 wait 参数决定命令是否阻止后续命令( |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin_to_position(400, DEGREES)
电机停止()#
motor.stop()
命令用于停止电机。
这是一个非等待命令,允许任何后续命令无延迟地执行。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.stop()”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.spin(FORWARD)
wait(1, SECONDS)
arm_motor.stop()
电机.设置位置()#
motor.set_position(position, units)
命令用于将电机的编码器位置设置为给定的位置值。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.set_position(position, unit)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
位置 |
要设置的电机编码器的具体整数。 |
单位 |
电机使用的单位:“度”或“圈”。 |
**返回:**无。
# 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(velocity, units)
命令用于设置电机的速度。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.set_velocity(velocity, units)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
速度 |
电机旋转的速度,范围从 -100 到 100。 |
单位 |
电机速度的单位“百分比”。 |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.set_velocity(100, PERCENT)
arm_motor.spin_to_position(400, DEGREES)
电机.设置超时()#
motor.set_timeout(value, units)
命令用于设置电机运动命令的时间限制。
这可以防止未到达预定位置的运动命令阻止后续命令运行。
这是一个非等待命令,允许任何后续命令无延迟地执行。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.set_timeout(value, units)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
价值 |
电机停止前等待的时间。 |
单位 |
电机计时器的单位“秒”。 |
**返回:**无。
# Lift the Arm up before moving.
arm_motor.set_timeout(1, SECONDS)
arm_motor.spin_for(FORWARD, 3, TURNS)
活动#
前端光学.物体检测()#
front_optical.object_detected(callback)
与 eye.object_detected(callback)
是相同的命令。
该命令仅使用 Axel 的光学传感器“front_optical”来替换标准命令中的“eye”。
front_optical.object_lost()#
front_optical.object_lost(callback)
与 eye.object_lost(callback)
是相同的命令。
该命令仅使用 Axel 的光学传感器“front_optical”来替换标准命令中的“eye”。
传感#
电机.is_done()#
如果选定的电机已完成其运动,则 motor.is_done()
命令用于返回 True 或 False 值。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.is_done()”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
**返回:**这将返回一个布尔值。
电机正在旋转()#
如果选定的电机正在移动,则使用 motor.is_spinning()
命令返回 True 或 False 值。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.is_spinning()”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
**返回:**这将返回一个布尔值。
电机位置()#
motor.position(units)
命令用于返回所选电机的当前旋转位置。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.position(units)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
单位 |
返回值的单位, |
**返回:**这将返回一个数值。
# 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(units)
命令用于返回所选电机的当前速度。
要使用此命令,请将“motor”替换为所需的电机或电机组,例如:“arm_motor.velocity(units)”。
对象 |
描述 |
---|---|
|
抬起或放下 Axel 的手臂。 |
|
升起或降低推杆,将环从臂上推下来。 |
参数 |
描述 |
---|---|
单位 |
电机速度的单位,“百分比”。 |
**返回:**这将返回一个数值。
# 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()#
ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句会从 AI 视觉传感器捕获当前图像,并分析所有 AI 分类。已识别的分类存储在数组中。虽然 ai_objects
是 VEXcode 工具箱命令中使用的默认数组名称,但您可以根据需要自定义此名称。
**重要提示:**您需要抬起机器人的手臂,以便 AI 视觉传感器能够清晰地拍摄到游乐场的快照。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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#
ai_objects.id
属性返回指定索引的 id。
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
每个对象都有一个 id
属性来标识其类型。可能的 id 值包括:
移动目标:
0
红色环:
1
蓝色环:
2
您还可以将 id 直接与这些预定义常量进行比较:
移动目标:
GameElements.MOBILE_GOAL
红色圆环:
GameElements.RED_RING
蓝色环:
GameElements.BLUE_RING
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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#
ai_objects.centerX
属性返回 AI 分类的精确中心的指定索引的 X 坐标。
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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].中心Y#
ai_objects.id
属性返回 AI 分类精确中心的指定索引的 Y 坐标。
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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#
ai_objects.id
属性返回 AI 分类最左上角的指定索引的 X 坐标。
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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#
ai_objects.id
属性返回 AI 分类最左上角的指定索引的 Y 坐标。
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
AI视觉传感器的屏幕尺寸为宽320像素,高240像素,AI视觉传感器屏幕的精确中心对应于坐标(160,120)。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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].宽度#
ai_objects.id
属性返回指定索引的宽度(以像素为单位)。
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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].高度#
ai_objects.id
属性返回指定索引的高度(以像素为单位)。
必须先使用 ai_objects = ai_vision.take_snapshot(AiVision.ALL_AIOBJS)
语句创建一个数组,然后才能使用此属性。
创建 AI 分类数组后,您可以使用索引访问特定对象及其属性。该数组按对象面积从大到小排序,索引从 0 开始。这意味着 ai_objects[0] 表示检测到的最大对象,而索引最高的对象表示最小对象。
所有后续的 AI 视觉传感器命令都依赖于最新快照的数据。为了确保您使用最新信息,定期拍摄新快照至关重要。每个新快照都会刷新所有 AI 视觉传感器命令可用的数据,使它们能够处理来自传感器环境的最新视觉信息。
在尝试访问上次快照存储的数据之前,您应该始终检查数组是否为空。您可以使用 len()
函数来验证这一点。如果 len()
返回 0
,则表示数组为空,不包含上次快照的数据。
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()#
如果光学传感器距离物体足够近以检测到颜色,则使用 front_optical.is_near_object()
命令报告布尔值。
**返回:**报告一个布尔值。
# Print if the Front Optical Sensor is detecting an object.
brain.screen.print(front_optical.is_near_object())
正面光学颜色()#
front_optical.color()
命令用于返回光学传感器检测到的颜色。
这是一个非等待命令,允许任何后续命令无延迟地执行。
以下颜色可用于与光学传感器检测到的颜色进行比较:
红色的
绿色的
蓝色的
黄色的
橙子
紫色的
青色
**返回:**以字符串形式返回检测到的颜色的名称。
# Identify the color of the ring on the Arm.
brain.screen.print(front_optical.color())
正面光学亮度()#
front_optical.brightness()
命令用于报告光学传感器检测到的 0 到 100% 范围内的光量。
**返回:**这将返回一个数值。
# 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.brightness()
命令用于报告光学传感器检测到的物体的色调,范围在 0 到 359 之间。该数字表示检测到的颜色在色轮上的位置。
**返回:**这将返回一个数值。
# Print the hue of the ring on the Arm.
brain.screen.print("Hue: ", optical.hue())
旋转.设置位置()#
pusher_rotation.set_position(value, units)
命令用于将旋转传感器的位置设置为给定值。
参数 |
描述 |
---|---|
价值 |
设置旋转传感器位置的值。 |
单位 |
设置位置的单位, |
**返回:**无。
旋转.角度()#
pusher_rotation.angle(value, units)
命令以度为单位返回推动器电机当前的旋转角度。
**返回:**一个整数。
旋转.位置()#
pusher_rotation.position(units)
命令返回推动器电机的当前位置。
参数 |
描述 |
---|---|
单位 |
设置位置的单位, |
**返回:**一个整数。
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.
这是一个非等待命令,允许任何后续命令无延迟地执行。
参数 |
描述 |
---|---|
单位 |
偏移值的单位, |
**返回:**这将返回一个数值。
def main():
# Print the current X positional offset of the robot.
brain.screen.print(gps.x_position(MM))
gps.y_位置()#
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.
这是一个非等待命令,允许任何后续命令无延迟地执行。
参数 |
描述 |
---|---|
单位 |
偏移值的单位, |
**返回:**这将返回一个数值。
def main():
# Print the current Y positional offset of the robot.
brain.screen.print(gps.y_position(MM))
gps.航向()#
gps.heading()
命令用于根据 GPS 传感器从 VEX GPS 字段代码读取的数据报告机器人当前所面对的航向。
这是一个非等待命令,允许任何后续命令无延迟地执行。
**返回:**这将返回一个数值。
def main():
# Print the current heading of the robot.
brain.screen.print(gps.heading())