7.2.2 API Usage
The UNO Q Python examples use the same high-level pymycobot API as the normal myCobot 280 Python workflow. The key difference is the initialization method.
UNO Q Initialization
from pymycobot import MyCobot280
mc = MyCobot280(unoq_bridge=True)
Notes:
unoq_bridge=Trueenables UNO Q Bridge communication.- A serial port such as
COM3or/dev/ttyUSB0is not required in this mode. - The firmware must provide
XferBridgeMsg. - Run only one control script at a time.
Common API Groups
To keep the GitBook PDF output readable, this page lists common APIs by function group instead of using a wide table. For the full API reference, see 6.2.2 API description.
Status Reading
get_system_version(): read the robot firmware version.get_angles(): read the current 6 joint angles.get_coords(): read the current end-effector coordinates.
Joint Motion
send_angle(id, degree, speed): move one joint to a target angle.send_angles(angles, speed): move multiple joints to target angles.go_home(): return the robot to the zero or home position.
Coordinate Motion
send_coord(id, coord, speed): move one coordinate axis.send_coords(coords, speed, mode): move to a full pose.
Jog Control
jog_angle(joint_id, direction, speed): jog by joint.jog_coord(coord_id, direction, speed): jog by coordinate axis.stop(): stop the current motion.
State Control
pause(): pause the current motion.resume(): resume motion.power_on(): power on or enable communication.release_all_servos(): release all servos.
Note: after releasing servos, the robot may lose holding force. Hold the robot first and make sure it is in a safe posture.
RGB and IO
set_color(r, g, b): control the Atom RGB light.set_digital_output(pin_no, pin_signal): set end digital output.set_basic_output(pin_no, pin_signal): set base IO output.
Gripper
set_gripper_state(flag, speed): open or close the gripper.set_gripper_value(gripper_value, speed): move the gripper to a target value.get_gripper_value(): read the current gripper value.
UNO Q Notes
Do not copy the serial-port initialization code from Chapter 6 directly into UNO Q Python scripts. For local Python on UNO Q, initialize the object as follows:
mc = MyCobot280(unoq_bridge=True)
After calling a motion API, the robot needs time to reach the target. Simple examples can use time.sleep(); stricter programs can use is_in_position() with a timeout to avoid waiting forever.