Shuffle robot is a very simple (if not to say primitive) construction of a walking robot. It`s whole movement relies on one servo motor so it will not be very effective nor fast. Imagine how would your body move if you had only one muscle, no matter how strong this muscle would be.
Try to find this two things in the internet:
1. Search for WALKING ROBOT change search mode to images and browse different types of robot constructions – you will find humanoid robots, so called hexapods that look like spiders – try to count how many motors do they use?
2. Serach for: HOW MANY MUSCLES IN HUMAN BODY or HOM MANY MUSCLES IN HUMAN FACE – quite a big number isn`t it? Maybe that is the reason why it is so hard to make a robot look like a real human.
In practice walking robots constructions are quite complex when it comes to mechanics (simultaneous operation of many motors) and software that has to cover complex kinematic models.
What it has to do with our shuffle robot?
In such a competition our shuffle robot might look unimpressive, but it`s goal is not being advanced. We should better treat him as an experiment: how to build the simplest walking robot possible that would still be able to walk.
What is more our robot is connected with a cable to a computer – maybe it is iven better that he it doesn`t run to quickly 😉
Connect LOFI Brain controller to the computer and connect it with LOFI Blocks app through LOFI Robot Extension for Chrome
Set servo motor to middle position – servo shaft rotates from 0 to 180 degrees, in code it converts to 0 to 100. In shuffle robot construction servo controls a robot leg, which turns a little bit left and right, we assume for this tutorial that the leg is set straight when servo motor is set to 50.
If the leg is of center when you set the serovo to 50 simply remove it from the shaft and attach again centered as much as possible. Then correct the middle position in code (usually between 45-55).
Experimenting with the moves
Movement model of the shuffle robot is very simple – the leg moves slightly left and right, so if the leg is set straight on 50 then make the robot move we switch the motor position between 40 and 60 (as you can see both values differ 10 from 50). We control the speed of the movement by adding WAIT block between each SET SERVO block. The longer we wait to slower is robot movement.
Our first approach looks like this:
Shuffle robot is a bit slow and forward movement is minimal. To make it move faster we have to reduce WAIT time to 15 (hundreths of second). Also lets try to make the steps bigger and set servo position to 35 and 65.
Much better! Please note that exact values depend on the servo motor setup so try to experiment yourself with choosing the best WAIT and SET SERVO values.
Consider this conditions:
– theoretically – the less time we WAIT the faster the movement of the robot – however the servo motor has it`s maximum speed for setting to position so if you set the delay to low, the motor will not have enough time to adjust to the position thus the result in movement will be worse.
– it seems that if we make the steps bigger (further from the middle position) the robot would move faster, in practice moving above some maximum value does not add up to the robot move
Adding some more functionality
To make testing different movement speed values easier it would be useful to create a variable which we can call TEMPO. We set TEMPO variable as a parameter in WAIT blocks, a pause between each steps is always equal to the value of TEMPO. Now we only have to change one value instead of two.
Make this robot smart (at least a bit smarter)
We know how to make the shuffle robot move so lets improve his thinking skills and teach him how to react to surrounding environment. This robot is equipped with a distance sensor which makes him capable of detecting objects that happen to be on his way. It is a friendly robot so lets program it the way that when the distance sensor detects an object the robot starts moving forward. If no object is detected the robot stands still.
We have to add a conditional value to our program – IF YOU SEE SOMETHING -> WALK. In code it would look something like this: IF DISTANCE SENSOR READING IS LESS THAN …lets say 20 centimeters… SET SERVO 35..65..35..65.. and so on..
Right now the shuffle robot will walk tirelessly (yet slowly) forward as long as it`s distance sensor detects any object closer than 20cm ahead. It is reasonable to improve the code a bit and make the robot stop it the object it is approaching is already to close, so they will not bump into each other. Make the robot walk when the object is less than 20cm ahead but make the robot stop when the object is less that 5cm away. To do this we have to use a new block logical AND, this block checks two conditions and returns TRUE only if both of the conditions are fullfilled.
As you can see our shuffle robot os not a deamon of speed nor a skilled acrobat buto still it can be a nice fello to learn basics of walking robots operation.