4、Test the robot arm

Introduction of API

1、is_all_servo_enable()

Function:Determine if six joint points are working properly.

Return parameter:1 indicates working properly,0 means that it doesn't work,-1 indicates an error alarm.

2、jog_angle(joint_id,direction,speed)

Function:Let a joint point move continuously.

Parameter Description:

joint_id:value range1-6, six integers represent joint points 1 to 6.

direction:1 indicates increase in angle,0 indicates decrease in angle.

speed:Indicates the speed of increase and decrease.

3、jog_stop()

Function:Stop the movement of joint points.

4、release_servo(servo_id)

Function:Relax the specified joint points.

Parameter Description:

servo_id:valuer range 1-6, six integers represent joint points 1 to 6.

5、focus_servo(servo_id)

Function:Secure the specified joint points

Parameter Description

servo_id:valuer range 1-6, six integers represent joint points 1 to 6.

Content of code

from pymycobot.mycobot import MyCobot
from pymycobot import PI_PORT, PI_BAUD  # When using the Raspberry Pi version of myCobot, you can refer to these two variables for MyCobot initialization
import time

# Initialize a MyCobot object
mc = MyCobot(PI_PORT, PI_BAUD)
# Determine whether the robot arm is powered or not, and if there is no power supply, it needs to be powered first
if not mc.is_power_on():
    # Power the robot arm
    mc.power_on()

# Check that the six joints are working properly
# You can also use is_servo_enable(servo_id) to change single calibration
if mc.is_all_servo_enable():
    # Power off the robot arm
    mc.power_off()
    # Check whether the robot arm is power off
    if mc.is_all_servo_enable() == -1:
        print("机臂

Effects as shown

2

results matching ""

    No results matching ""