myCobot 280 Pi — commands

Open a terminal on the Pi (Ctrl + Alt + T), tap Copy, paste with Ctrl + Shift + V, press Enter.

Hold or clear about 30 cm around the arm before any command that moves it. Speeds here are slow (20 of 100).

1Who am I logged in as

Prints the Pi's username.

whoami

2Check the arm library

Should print a version number. If it errors, run step 2b.

python3 -c "import pymycobot; print(pymycobot.__version__)"

2bInstall the arm library (needs internet)

Only if step 2 failed.

pip3 install --user pymycobot

3Read the arm (does not move)

Prints power state and six joint angles.

python3 -c "from pymycobot import MyCobot; m=MyCobot('/dev/ttyAMA0',1000000); print('power', m.is_power_on()); print('angles', m.get_angles())"

4Turn the base 15° and back

Slow. Moves only joint 1 (the base).

python3 -c "from pymycobot import MyCobot; import time; m=MyCobot('/dev/ttyAMA0',1000000); m.power_on(); time.sleep(1); a=m.get_angles(); print('start', a); b=list(a); b[0]+=15; m.send_angles(b,20); time.sleep(4); m.send_angles(a,20); time.sleep(4); print('end', m.get_angles())"

5Open and close the gripper

python3 -c "from pymycobot import MyCobot; import time; m=MyCobot('/dev/ttyAMA0',1000000); m.set_gripper_state(0,50); time.sleep(2); m.set_gripper_state(1,50); time.sleep(2); print('done')"

6Wave (base left, right, centre)

python3 -c "from pymycobot import MyCobot; import time; m=MyCobot('/dev/ttyAMA0',1000000); m.power_on(); time.sleep(1); a=m.get_angles(); [ (m.send_angles([a[0]+d]+a[1:],20), time.sleep(3)) for d in (20,-20,20,0) ]; print('done', m.get_angles())"

7Go to the straight-up pose

All joints to 0°. Bigger move — make sure there's room above the arm.

python3 -c "from pymycobot import MyCobot; import time; m=MyCobot('/dev/ttyAMA0',1000000); m.power_on(); time.sleep(1); m.send_angles([0,0,0,0,0,0],20); time.sleep(6); print(m.get_angles())"

8Go limp (move it by hand)

Hold the arm first — it drops when the motors release.

python3 -c "from pymycobot import MyCobot; m=MyCobot('/dev/ttyAMA0',1000000); m.release_all_servos(); print('released')"

9Lock the motors again

Holds whatever pose it's in now.

python3 -c "from pymycobot import MyCobot; m=MyCobot('/dev/ttyAMA0',1000000); m.power_on(); print('locked', m.get_angles())"

10Set a new login password

Asks for the current one first, then the new one twice. Lets you log in from the Mac later.

passwd