myCobot 280 Pi — commands
Open a terminal on the Pi (Ctrl + Alt + T), tap Copy, paste with Ctrl + Shift + V, press Enter.
Firefox says "unsafe" or won't load this page?
The Pi has no battery clock. If it starts without internet, it thinks it's the wrong date, and every https site looks unsafe. Use the plain http copy served from the Mac instead. Both must be on the same Wi-Fi.
On the Mac, find its address:
ipconfig getifaddr en0
On the Mac, serve this page (from the folder that has site/):
python3 -m http.server 8000 --directory site
On the Pi, open http://<Mac address>:8000 in Firefox. Type http://, not https. Last time it was http://192.168.4.18:8000.
On the Pi, check the clock. If the year is wrong, that's the cause; it fixes itself after the Pi has been online a minute or two.
date
Last known Pi address on Wi-Fi: 192.168.4.8.
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