-
1Step 1
0. Getting file
For the source files please visit Gihub Dog.
1. Mechanical assembly
The assembly of printed parts and their count is easiest to understand from the
dog_semi_assembled.stlfile in the uploaded files. I don’t know how to make it more understandable; all the parts that are not connected are held together by the servos.The Pi is mounted in the center of the dog, the PCA is mounted hanging over the Pi. I very much hope it is possible to figure this out from the images of the fully assembled dog, as well as the servo positioning.
2. Electronics wiring
Each battery holder has to have a dedicated step-up converter connected to it. In case of using cheap ones it is important not to mess up plus and minus connection, because that would fry the step-up converter. Pololu step-up converters seem to be immune to this kind of mistake.
One step-up has to be connected to the Pi 5 V pin and ground. Again, it is important not to mess up plus and minus, as that can fry the Pi now. The second step-up has to be connected to the 5 V input of the PCA marked as V+ and to ground of PCA, again, don’t mess up plus and minus. You also have to connect grounds of the Pi and PCA for them to be able to communicate over data lines.
In my setup I have the Pi 3.3 V output connected to VCC of the PCA, but I don’t think it is essential.
SCL pin of the PCA has to be connected to pin 3 of the Pi, SDA pin of the PCA has to be connected to pin 2 of the Pi. In case you want to change these pins for any reason, they are hardcoded in line 12 of
overall_controller.pyfile.All the servos have to be connected to the PCA, order doesn’t matter, as it will be set up later in configs. Yet it is a bit more convenient to connect servos of the same leg to nearby pins.
3.
settings.jsonstructure and meaningsettings.jsonis used to set minor offsets of legs, movement speed and some other stuff.For each leg there is a trajectory which the leg controller is trying to follow. Initially the trajectory is built on values between 0 and 1. In order for the dog to move, this trajectory is multiplied by some factor, this factor is what controls speed of the dog. The trajectory consists of around 200 positions.
generalsectionUnder
generalsection one can find:-
collinear_max_speed– value deciding at what max speed the dog can move forward/backward -
perp_max_speed– max speed sideways -
rotation_max_speed– max speed for rotation
These are factors for multiplying leg trajectory for movement.
-
step_count– how many steps are taken on each iteration -
delay– time that has to pass for the leg to go to the next desired position
Here are the recommended starting values (you are welcome to try out something else):
"collinear_max_speed": 20, "perp_max_speed": 8, "rotation_max_speed": 8, "step_count": 3, "delay": 0
defaultsectionUnder
defaultsection are the ranges of motion of each joint; these ranges are used for all the legs.If using 180° servos as I’m using, you should have all the angles as 90 and -90. If using 90° servos: 45 and -45.
Per-leg sections
Next four sections are similar:
front_left,front_right,rear_left,rear_right.-
base_channel,hip_channel,knee_channel– corresponding channels on PCA into which servos are plugged in. -
base,hip,kneevalues of1and-1represent which way each joint should bend for correct movement, please leave these values as they are. -
base_offset,hip_offset,knee_offsetrepresent minor offset in degree values for each servo, they should ideally be under 10. -
upper_len,thigh_len,shank_lenare values for lengths of the corresponding pieces in mm.
upper_lenis a legacy appendix, though hardware-wise it has already been reduced to zero; for sake of calculations it has to be kept at 1.thigh_lenis averaging at 21 for all the legs andshank_lenis at 56.headsectionThe last section is settings for the head. I would imagine that most of the values are self-explanatory. The only remarks I consider to be worth mentioning:
-
verticalandhorizontalvalues of-1are there for setting move direction relative to joystick movement in the view screen. -
horizontal_hard_min,horizontal_hard_max,vertical_hard_min,vertical_hard_maxare the limiting values of the servos themselves. -
horizontal_min,horizontal_max,vertical_min,vertical_maxare how far they should move in normal use.
4. Zeroing and offsets procedure
After all the servos are connected to the PCA but before connecting them to the body you should:
-
Go into
settings.jsonfile and set all the offset values in each leg and head to zero. -
Change all the
*_channelvalues to corresponding channels of PCA where the servos are connected. -
Run the
set_to_zero.pyscript – it will set each of the servos to the approximate zero value.
Only then you should connect the servos’ horns to corresponding pieces. After the full assembly you will have to play around with each of the offsets a little, till all the joints are perfectly straight.
The
set_to_zero.pyscript constantly rereads thesettings.jsonfile, so there is no need to restart the script, you can see offsets in real time. They all are expected to be under 10 degrees; these are the offsets produced by servo horns’ slight inconsistency in rotation in straight position. -
Stanislav Britanishskii
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.