Let's Make Robots!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
antonio.caciuc's picture

It measures the distance from the floor then it tries to maintain a constant distance reading using a PI algorithm.

To operate it, you first balance the robot and then the algorithm tries to maintain the reading from the sensor, thus keeping a constant angle between the robot body and the floor. Since you started the robot when it was balanced it will keep itself balanced. I guess this only works on flat surfaces because a change in the distance between the sensor and the floor would tilt the robot. It could probably stay on an inclined surface if recalibrated for that angle. If you start the robot out off balance it will probably move forward continuosly. I probably drifts too. I wonder if changes in floor color would throw it off balance.

alegiaco's picture

You are right. The sensor measures the distance from the floor and it tries to mantain a constant distance using the PI algorithm. The surface has to be flat, otherwise the distance measured has no sense, so the robot tilt. This is the main difference with gyro and accelerometer sensor. The gyro and the accelerometer work always. The IR sensor works only in a flat surface.

Another possibility is to use 2 IR sensors, that is better for precision of balancing. But also with 2 sensors you can use only in a flat surface. 

 

Dan M's picture

I am betting you are right that changes in floor colour will unbalance the robot.  I have been using the same type IR sensor, and found that colour and texture of the object it is measuring has given me varying readings.  While I trust the IR sensor more than I trust the ultrasonic ones, I'm not so sure they are sufficiently accurate for keeping a robot balanced.

That said, I saw that your robot did seem to be keeping highly accurate balance with only minor corrections.  Perhaps that is more a testament to your programming rather than relying totally on the abilities of the sensor.

Good job.

Perhaps you could try laying out (taping down) some black strips on the floor and see what happens to his balance when he tries to cross them.

Hmmm, I was thinking of a possible "fix"...  If the readings from the sensor suddenly changed, but did not continue to change, the robot might assume it was a floor fluctuation and ignore it, but if the change continues for so many milliseconds [Testing for optimal performance would be needed.] then the robot would consider it was indeed off balance and apply corrections.  That would make him respond more slowly, as he waits for corroboration but could protect against disrupting his balance in the case of floor-colour or slope-change differences.

Dan M's picture

I am wondering: You said, "No gyro, no accelerometer, no other sensors." --so if that is the case, then how does the robot keep its balance?  How does it know if it is tipping over?

 

i would hazard a guess that using the ir sensor to measure the distance to the floor, when the robot pitches forward or backwards the servos kick in to realign it