Use of gripper

Adaptive gripper

1. Set gripper mode

Before using, you need to use the set_gripper_mode interface to set the gripper mode to 0

from pymycobot import Mercury

ml = Mercury('/dev/left_arm')
mr = Mercury('/dev/right_arm')

ml.power_on()
mr.power_on()

ml.set_gripper_mode(0)
mr.set_gripper_mode(0)

2. Gripper control

Angle control

Use the set_gripper_value interface to set the gripper's opening angle

from pymycobot import Mercury
import time

ml = Mercury('/dev/left_arm')
mr = Mercury('/dev/right_arm')

ml.power_on()
mr.power_on()

ml.set_gripper_value(0, 50)
time.sleep(2)
mr.set_gripper_value(100, 50)
time.sleep(2)

IO control

Use set_digital_output interface to realize IO control gripper opening or closing

from pymycobot import Mercury

ml = Mercury('/dev/left_arm')
mr = Mercury('/dev/right_arm')

ml.power_on()
mr.power_on()

ml.set_digital_output(1, 0)
mr.set_digital_output(2, 1)
time.sleep(2)
ml.set_digital_output(1, 1)
mr.set_digital_output(2, 0)
time.sleep(2)

Note: By default, IO control can be used directly. If the gripper mode is set to 0, you need to set the gripper mode to 1 first, that is, set_gripper_mode(1), and then use IO control. If IO control cannot be used after setting it to 1, you need to power on again.

Electric gripper

1. Initialize the gripper

Use the init_electric_gripper interface to initialize the gripper

from pymycobot import Mercury

ml = Mercury('/dev/left_arm')
mr = Mercury('/dev/right_arm')

ml.power_on()
mr.power_on()

ml.init_electric_gripper()
mr.init_electric_gripper()

2. Gripper control

Use the set_electric_gripper interface to control the opening or closing of the gripper

from pymycobot import Mercury
import time

ml = Mercury('/dev/left_arm')
mr = Mercury('/dev/right_arm')

ml.power_on()
mr.power_on()

# Open the gripper
ml.set_electric_gripper(0)
time.sleep(2)
# Close the gripper
ml.set_electric_gripper(1)

results matching ""

    No results matching ""