Raspberry Pi setup
To set up your Raspberry Pi so that it can communicate with the robot arm, you will need to follow a few steps.
-
Go to the Raspberry Pi setup application and under interfaces, turn on SSH.
-
Open a new terminal window and run the following: pip3 install HHS-Robotarm
It should install without any errors.
-
Make sure that you have a python IDE installed. If you don't or don't know if there is one, I reccomend mu - run the following in a new terminal:
sudo apt-get install mu-editor
It should show up in the menu under "programming"
-
Double check the python package intallation: open up your python IDE and create a new file with these lines:
from RobotArm import Robotarm
arm = Robotarm.Robot()
If there is a "connection not found" error after a bit, everything went well (as long as no errors show up immediatley, everything should be fine).
With that, your pi should be all set up and happy!
Turning on the arm!
There are a lot of switches on the robot arm. Be aware that in order to not break the arm, they must be flipped in a specific sequence.
With that warning out of the way, here are the switches to flick and when to flick them, from left to right along the switch panel:
Main disconnect - RPi power - Arduino power - Motor power
Mounted to the top of the chassis is an E-Stop button, for when things go wrong -
Hitting it will stop all motion and disconnect motor controller power.
To get started, connect the power cable to the socket and
only turn on the main power switch and the RPi power switch.
This will give power to the raspberry pi mounted inside of the robot arm.
Next, take the ethernet cable from inside the chassis and connect the free end of it to your Raspberry Pi's ethernet jack. Make sure wifi is turned off on your Pi.
You shold see two little arrows in the corner of your screen flash and after ~30 seconds turn solid blue. This means that the ethernet is connected
to the pi in the chassis.
Open up a new terminal window and type the following to open up a terminal on the pi inside the arm: ssh pi@169.254.126.87
It will prompt you for a password, which is "eagles"
Congratulations! you have successfuly powered on the arm.
First movements!
Now that you are connected to the robot arm, you probably want it to go zip! Here's how:
In your python editor of choice on your raspberry pi, type the following code:
from RobotArm import Robotarm
arm = Robotarm.Robot()
arm.go()
arm.interpolate([110,90,90,90,90,90,90],20,3)
arm.stop()
Pay attention to this bit - it is the procedure you have to follow each time you want to run a program!
Save it, then make sure you have a terminal window open that is ssh-ed into the robot arm.
First, turn on the switch for arduino power and reset the e-stop switch, if necessary.
then, in that window, type the following: ./robot.sh
after a few seconds, the letter "A" should appear.
This is your acknowledgement that the arm is connected.
You can now turn on the motor power switch.
Run the program you just typed in your python IDE, and the arm should scoot!
YAY!
Now, to turn it off, flip both the motor power and arduino power switches to off.
Run the command in the terminal that is sshed into the robot arm (where the "A" appeared at the start): sudo shutdown now
Wait 15 seconds, and flip the main power and RPi power switches to off.
Then, shut down your pi and give the robot arm a high-five!