手臂#
初始化 Arm 类#
使用以下构造函数创建 6 轴臂:
Arm(port)
此构造函数使用一个参数:
范围 |
描述 |
---|---|
|
6 轴臂连接到的有效 智能端口。 |
# Construct a 6-Axis Arm "arm" with the
# Arm class.
arm = Arm(Ports.PORT1)
This arm
object will be used in all subsequent examples throughout this API documentation when referring to Arm class methods.
类方法#
move_to()#
The move_to(x, y, z, wait)
method moves the End Effector to the requested X, Y, and Z absolute position.
This can be a waiting or non-waiting method depending on if the wait
parameter is used.
参数 |
描述 |
---|---|
x |
要移动到的 x 坐标(以毫米为单位)。 |
y |
要移动到的 y 坐标(以毫米为单位)。 |
z |
要移动到的 z 坐标(以毫米为单位)。 |
等待 |
Optional. The wait parameter determines whether the method will block subsequent method ( |
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 to (40, 140, 210).
arm.move_to(40, 140, 210)
move_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 轴上移动的距离(以毫米为单位)。 |
等待 |
Optional. The wait parameter determines whether the method will block subsequent method ( |
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)
move_end_effector_to()#
The move_end_effector_to(yaw, roll, pitch, wait)
method moves the End Effector to the requested absolute yaw, roll, and pitch orientation.
This can be a waiting or non-waiting method depending on if the wait
parameter is used.
参数 |
描述 |
---|---|
偏航 |
末端执行器应指向的围绕 z 轴的角度(以度为单位)。 |
卷 |
末端执行器应指向的围绕 x 轴的角度(以度为单位)。 |
沥青 |
末端执行器应指向的 y 轴周围的角度(以度为单位)。 |
等待 |
Optional. The wait parameter determines whether the method will block subsequent method ( |
Returns: True
if the End Effector has moved to the requested orientation when wait is True
. False
if it has not.
# Orient the End Effector to point towards
# 90 degrees around the x-axis.
arm.move_end_effector_to(0, 90, 0)
move_end_effector_inc()#
The move_end_effector_inc(yaw, roll, pitch, wait)
method moves the End Effector to the requested relative yaw, roll, and pitch orientation.
This can be a waiting or non-waiting method depending on if the wait
parameter is used.
参数 |
描述 |
---|---|
偏航 |
末端执行器围绕 z 轴应改变的角度(以度为单位)。 |
卷 |
末端执行器围绕 x 轴应改变的角度(以度为单位)。 |
沥青 |
末端执行器围绕 y 轴应改变的角度(以度为单位)。 |
等待 |
Optional. The wait parameter determines whether the method will block subsequent method ( |
Returns: True
if the End Effector has moved to the requested orientation when wait is True
. False
if it has not.
# Orient the End Effector -50 degrees on the y-axis.
arm.move_end_effector_inc(0, 0, -50)
set_speed()#
The set_speed(speed)
method sets the speed for moves.
参数 |
描述 |
---|---|
速度 |
6 轴臂移动的速度。 |
**返回:**无。
set_end_effector_type()#
The set_end_effector_type(type)
method sets the End Effector type to magnet
or pen
.
参数 |
描述 |
---|---|
类型 |
有效的 EndEffectorType。 |
Returns: True
if the requested type was set. False
if it was not.
# Set the End Effector type to the Magnet Pickup Tool.
arm.set_end_effector_type(MAGNET)
set_end_effector_magnet()#
The set_end_effector_magnet(state)
method sets the End Effector’s Magnet Pickup Tool to enabled or disabled.
参数 |
描述 |
---|---|
状态 |
|
**返回:**无。
# Enable the Magnet Pickup Tool.
arm.set_end_effector_magnet(True)
set_pen_offset()#
The set_pen_offset(zOffset)
method sets the pen End Effector z-axis offset.
参数 |
描述 |
---|---|
z偏移 |
The new offset in |
**返回:**无。
set_control_stop()#
The set_control_stop(state)
method disables the Arm and places the joint motors in brake mode.
如果启用了控制停止,则除非重新启动整个项目,否则将无法禁用它。
参数 |
描述 |
---|---|
状态 |
|
**返回:**无。
control_stopped()#
The control_stopped(callback, arg)
method registers a function to be called when the 6-Axis Arm control stop is enabled.
参数 |
描述 |
---|---|
打回来 |
当 6 轴臂控制停止时调用的函数 |
arg |
**可选。**用于向回调函数传递参数的元组 |
**返回:**事件类的一个实例。
# Define a function when_control_stopped
def when_control_stopped():
# Print to the Brain's screen that the Arm has been
# control stopped.
brain.screen.print("The arm has been control stopped")
# Run when_control_stopped when the Arm is control stopped.
arm.control_stopped(when_control_stopped)
can_arm_reach_to()#
The can_arm_reach_to(x, y, z)
method checks if the End Effector can move to the requested X, Y, and Z absolute position.
参数 |
描述 |
---|---|
x |
要移动到的 x 坐标(以毫米为单位)。 |
y |
要移动到的 y 坐标(以毫米为单位)。 |
z |
要移动到的 z 坐标(以毫米为单位)。 |
Returns: True
if the Arm can move to the requested position. False
if it cannot.
# Check if the Arm can move to the (100, -20, 50).
if arm.can_arm_reach_to(100, -20, 50):
# Move the Arm to (100, -20, 50).
arm.move_to(100, -20, 50)
can_arm_reach_inc()#
The can_arm_reach_inc(x, y, z)
method checks if the End Effector can move to the requested X, Y, and Z relative position.
参数 |
描述 |
---|---|
x |
x 轴上移动的距离(以毫米为单位)。 |
y |
沿 y 轴移动的距离(以毫米为单位)。 |
z |
z 轴上移动的距离(以毫米为单位)。 |
Returns: True
if the Arm can move to the requested position. False
if it cannot.
# Check if the Arm can increment its position
# +100 mm along the x-axis.
if arm.can_arm_reach_inc(100, 0, 0):
# Increment the Arm +100 mm along the x-axis.
arm.move_inc(100, 0, 0)
can_end_effector_reach_to()#
The can_end_effector_reach_to(yaw, roll, pitch)
method checks if the End Effector can move to the requested absolute yaw, roll, and pitch orientation.
参数 |
描述 |
---|---|
偏航 |
末端执行器应指向的围绕 z 轴的角度(以度为单位)。 |
卷 |
末端执行器应指向的围绕 x 轴的角度(以度为单位)。 |
沥青 |
末端执行器应指向的 y 轴周围的角度(以度为单位)。 |
Returns: True
if the End Effector can move to the requested orientation. False
if it cannot.
# Check If the arm can orient to 90 degrees on the x-axis.
if arm.can_end_effector_reach_to(0, 90, 0):
# Orient towards 90 degrees on the x-axis.
arm.move_end_effector_to(0, 90, 0)
can_end_effector_reach_inc()#
The can_end_effector_reach_inc(yaw, roll, pitch)
method checks if the End Effector can move to the requested relative yaw, roll, and pitch orientation.
参数 |
描述 |
---|---|
偏航 |
末端执行器围绕 z 轴应改变的角度(以度为单位)。 |
卷 |
末端执行器围绕 x 轴应改变的角度(以度为单位)。 |
沥青 |
末端执行器围绕 y 轴应改变的角度(以度为单位)。 |
Returns: True
if the End Effector can move to the requested orientation. False
if it cannot.
# Check if the End Effector can increment its orientation
# +10 degrees on the y-axis.
if arm.can_end_effector_reach_inc(0, 0, 10):
# Increment the End Effector by +10 degrees on the y-axis.
arm.move_end_effector_inc(0, 0, 10)
is_done()#
The is_done()
method is used to check if the 6-Axis Arm is currently moving or not.
Returns: True
if the 6-Axis Arm is currently performing a movement. False
if it is not.
def main():
# Move the Arm to (-100, 200, 100) and let subsequent
# methods execute.
arm.move_to(-100, 200, 100, False)
# Repeat the methods until the Arm is done moving.
while not arm.is_done():
# Print the Arm's current y position to the Brain's
# screen every .25 seconds.
brain.print(arm.get_y())
brain.next_row()
wait(0.25, SECONDS)
get_x()#
The get_x()
method returns the x position of the End Effector.
Returns: The x position of the End Effector in MM
.
def main():
# Print the current x position of the Arm in millimeters.
brain.print(arm.get_x())
get_y()#
The get_y()
method returns the y position of the End Effector.
Returns: The y position of the End Effector in MM
.
def main():
# Print the current y position of the Arm in millimeters.
brain.print(arm.get_y())
get_z()#
The get_z()
method requests the z position of the End Effector.
Returns: The z position of the End Effector in MM
.
def main():
# Print the current z position of the Arm in millimeters.
brain.print(arm.get_z())
get_pitch()#
The get_pitch()
method requests the current pitch of the End Effector.
**返回:**末端执行器的当前倾斜度(以度为单位)。
def main():
# Print the current pitch of the Arm in degrees.
brain.print(arm.get_pitch())
get_roll()#
The get_roll()
method requests the current roll of the End Effector.
**返回:**末端执行器当前的滚动角度(以度为单位)。
def main():
# Print the current roll of the Arm in degrees.
brain.print(arm.get_roll())
get_yaw()#
The get_yaw()
method requests the current yaw of the End Effector.
**返回:**末端执行器当前的偏航角(以度为单位)。
def main():
# Print the current yaw of the Arm in degrees.
brain.print(arm.get_yaw())
set_timeout()#
The set_timeout(timeout, units)
method sets the timeout value used when moving the 6-Axis Arm.
参数 |
描述 |
---|---|
暂停 |
新的超时值。 |
单位 |
A valid TimeUnits type. The default unit is |
**返回:**无。
get_timeout()#
The get_timeout()
method gets the current timeout value used by the 6-Axis Arm move methods.
**返回:**以毫秒为单位的超时值。
# Get the current timeout value of the 6-Axis Arm.
value = arm.get_timeout()
is_connected()#
The is_connected()
method checks if the CTE Arm is connected. This is a compatibility function that returns the same as the installed()
function.
这是一种非等待方法,允许下一个方法无延迟运行。
Returns: True
if the Arm is connected to the brain on the associated smartport. False
if it is not.
installed()#
The installed()
method checks for device connection.
这是一种非等待方法,允许下一个方法无延迟运行。
Returns: True
if the device is connected. False
if it is not.
timestamp()#
The timestamp()
method returns the timestamp of the last received status packet from the Arm.
这是一种非等待方法,允许下一个方法无延迟运行。
**返回:**从 Arm 接收的最后一个状态包的时间戳(以毫秒为单位)。