New movement controlling software module

May 30, 2016 Leave a comment

After coding many different types of movements like boxing and typing I wanted to have a better control “language”. For these movements I used atomic servo commands: servo 1 goes to 90 degrees, servo 2 goes to 47 degrees, etc. The scheduling was solved by a simple timer and all the phases were activated by a counter and threshold values. If counter is less than 10 move to start position, if counter < 30 move the servos to first phase position, etc. All this was very boring and required a lot of calculations. On the top of this it was absolute dependent on timer period. All the threshold values had to be recalculated if I wanted to change the speed.

I needed something more flexible and timer independent solution which was able to handle complex commands. 2 simple Java classes solved the problem 🙂

Command class

Instead of sending a simple servo position (atomic command) this class has the below properties to form a higher level instruction. Progress is calculated by the class knowing the start time, duration and the control frequency. So the timer period can be changed free.

  • command type (IK leg positioning, balance mode on/off, sensor reading, etc.)
  • command state (added, started, finished, etc.)
  • parameters
  • duration (in ms)
  • start time (ms)
  • delay (ms)
  • repeat flag (when the command ends it adds itself to the queue)

Command processing rules:

  • All timing calculation uses milliseconds
  • Any positioning uses IK and builds on the last position using linear transition
  • Any command can be deleted any time independently from its state

Command queue class

This class handles complex command lists which could be extended or even deleted any time.

Queue processing rules:

  • The processing order is simple FIFO where every completed command is deleted from the queue (except repeat flagged ones)
  • The queue can be manipulated any time on any way

This way a more difficult control can be developed where the main robot logic can send command queues, extend them or delete or replace any time. I know that this is just 1 step towards the behavior programming but on a higher level you can request very complex tasks like: discover a room and come back to the base and report the results…

The queue itself is visible on the Android app together with the current command progress. So you don’t have to read robot brain just watch the screen 🙂

Queue elements in green, progress is above the list:

Command Queue list

Categories: Robot HW and SW Tags: , , ,

4 legged robot jumping

May 19, 2016 Leave a comment

This is a milestone video because we always wanted a real jumper 🙂 This is far from perfect but can be a good base for further development. On the other hand this jump test was the first real test of our brand new movement controlling software module.

Categories: Robot HW and SW Tags: , ,

Development of balancing – PID controller

May 11, 2016 Leave a comment

This is a very hard topic. Control Systems was not my favourite subject at university (but it should have been…) I tried to avoid difficult math and googled a lot to have something simple that could do the magic. Finally all the links lead me to the same page:

https://en.wikipedia.org/wiki/PID_controller

After few hours of reading I realized that this just seems to be difficult and this was the simple thing that can do the magic 🙂 This is more than a 100 years old theory but still works properly. The one who developed it was a real genius. Respect!

So you have basically a measured value from the accelerometer, which can be interpreted as the error value. This error is the input of any PID calculation. There are tons of math functions you could use but the PID inventor genius selected only 3! Luckily all these function can be ultra easily implemented using programming on any language.

P : use multiplication (*) Wow!

I : use + operator to store a sum. (sum+=current error value)

D: use – operator to calculate difference. (current value – old value)

20-30 lines of code in Java and we have the PID controller for our 4 legged robot! 🙂

For few seconds I tested the accelerometer feedback without balancing and after that I checked different PID control modes (P, PI, PD, PID)

Check the result: