Start up the BrachioGraph¶
Power up the Raspberry Pi. Run:
sudo pigpiod cd BrachioGraph python3
And then, using the
outer_arm length measurements (in cm) that you noted earlier:
from brachiograph import BrachioGraph bg = BrachioGraph(inner_arm=<inner_arm>, outer_arm=<outer_arm>)
The system will create a BrachioGraph instance and initialise itself, adjusting the motors so that the pen will be at a nominal:
- x =
- y =
And this will correspond to:
- the upper arm at -90 degrees, 1500µS pulse-width
- the lower arm at 90 degrees to it, 1500µS pulse-width
- the lifting motor in the pen up position, 1700µS pulse width
Check the movement¶
We must make sure that the arms move in the direction we expect. Run:
This shouldn’t do anything; the arms should already be at those angles.
Now try changing the values (one at a time) in five-degree increments, e.g.:
bg.set_angles(angle_1=-95, angle_2=90) # should move the inner arm 5 degrees anti-clockwise
Increasing the values should move the arms clockwise; decreasing them should move them anti-clockwise. To avoid violent movement, don’t move them more than five or ten degrees at a time.
The movements may be reversed, because different motors, or the same motor mounted differently, can produce a reversed movement for the same input.
In this case you need to incorporate that into your
BrachioGraph definition, by explicitly providing
servo_1_degree_ms (default: -10) and
servo_2_degree_ms (default: 10) values. For example, if the outer arm’s
movement were reversed, you’d need to initialise the plotter with:
bg = BrachioGraph(inner_arm=<inner_arm>, outer_arm=<outer_arm>, servo_2_degree_ms=-10)
Attach the arms¶
Attach the arms in the configuration shown, or as close as possible. Of course the arms may be a few degrees off the perpendicular, but don’t worry about that now.
Attach the horn to the lifting motor.
You need the pen to be just clear of the paper in the up position. The lifting movement can cause unwanted movement of the pen, so you need to minimise that. You can experiment with:
to find a good pair of up/down values. Then you can include them in your initialisation of the
BrachioGraph, by supplying
Of course your arms may be a few degrees off. Don’t worry about that now.
Take the BrachioGraph for a drive¶
increase x position 1cm
decrease x position 1cm
increase x position .1cm
decrease x position .1cm
increase y position 1cm
decrease y position 1cm
increase y position .1cm
decrease y position .1cm
Use this to discover the bounds of the box the BrachioGraph can draw.
Take a note of the
bounds - the box described by
[<minimum x>, <minimum y, <maximum x>, <maximum y>].
Reinitialise your plotter with these values:
bg = BrachioGraph(inner_arm=<inner_arm>, outer_arm=<outer_arm>, bounds=[<minimum x>, <minimum y, <maximum x>, <maximum y>])
Draw a box, using the
and a test pattern:
If the lines are reasonably straight and the box is reasonably square, try plotting a file:
Save your BrachioGraph definition¶
bg.py is a good place to save your defined
BrachioGraph instances for future use. It
already contains examples for units built during the development process.