Now the simpler and easier part is done - it is time for writing some code. Fortunately, most of previous PiWars robot's architecture rested on PyROS (more references: Clustered PyROS, GCC Rover 2017 Software Part II ) it is easy to continue where those robots stopped. There is already quite a few elements of PyROS and extra services that will come handy:
- PyROS discovery service - ability to discover and talk to robots based on their names not IP addresses
- storage - registry of key/value pairs for other services - mostly used for calibrated values for servos
- telemetry - library and service for streaming structured/record data out of services
- shutdown service - service to check GPIO and shuts down Raspberry Pi
- game controller service - service that reads PS4 gamepad changes and sends digested driving information to other services
But before we can apply our inverse kinematics code (One Leg, Two Legs...), we need way of defining angles of servos - translation between servo position in hundreds of µs (1500 being middle) to angles of servos.
Without that software we would need to have to hard code values for each servo, for each leg. When checked - each servo is so different in comparison to others that it would be impossible just blindly relying on 'hard values'.
At the same time, there's a service to drive servos on Flig - new service that utilises PCA9685. Also, that service is directly coupled with reading servo currents from INA3221 breakout boards. And those servo currents are exposed through telemetry library on Flig itself...
At the end, only thing that was needed was piece of square paper folded into a triangle (for 45º angle) and lots of eyeballing angles of legs for calibration to be done. It turns out that the process is something that can last about an hour if done from scratch.
Simple Programmed Movements
First movement that was programmed for Flig was getting up from sitting on the ground position:
Note slow sitting down - that was done with servos being driven at half the speed - only 25 times a second making them 'weak' - allowing for movement (like initial set up legs to first position) where we are not wanting to stress servos in case they bind or reach positions where they cannot go further (obstacle or such).
CommentsComments powered by Disqus