I am starting this thread because once again I am going to try to do something I don't know how to do! I designed a balancing BOE-Bot (though I bet I am not the first) that is going to be programmed in Blocklyprop and use a PID.
So I will be posting a lot of questions in a quest for help with this.
Carol Lynn Hazlett
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
Comments
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
wonderful idea.
Enjoy!
Mike
A determined coder can write COBOL programs in any language. -- Author unknown.
Press any key to continue, any other key to quit
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
It might be old hack for some, but I like it and plan to do the same soon.
Thanks for sharing this.
with it and want to learn how to use it for almost all my robotics.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
It's a very healthy choice.
- Pablo Picasso
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
- Pablo Picasso
coded. Only fine tuning and adjusting was needed from me. So this will be a first for me and is a prelude to a bigger project, a robot that balances on a ball.
There are a lot of self balancers out there and plenty of code snippets but I want to do it in Blocklyprop so I am sort of breaking some new ground a little bit.
BTW, what the heck is that thing between the wheels and sticking out the back of your robot? I want to use the Ping to make this robot have some roaming behavior.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
I believe the thing sticking out in the vid that erco posted is like a kick-stand to prevent the bot from falling completely over if it gets off balance. That way it is not smacking on the floor or table if it falls. just a guess though.
- Pablo Picasso
It has been hard but a lot of fun. I am really getting hooked on the Blocklyprop. I will show code too. Then you
can all tell me what could have been done better!
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
- Pablo Picasso
I may have damaged this PABWX when thrashing around. I am
testing it for trouble but I do have another PABWX to use if this
is broken. Did you make the BOE-Balancer in your video? Now I
know what that thing between its wheels is for! Keep it from
slamming on its face. I have the PID written and it seems to work
but the robot is just not stable enough. So I need to go through every
system to see what is wrong. I am hoping it is not because Blocklyprop
does not do floating point math. I don't know all the little work
around formulas people use to simulate floating point results.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
I made this one a while back:
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
I am using the Parallax 9-axis IMU.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
Have a look at this code: https://github.com/parallaxinc/Flight-Controller/blob/master/Helpers/ComplimentaryFilter/ComplimentaryFilterSample/Main.cs#L174
Specfifically at the function called UpdateComplimentaryFilter(). This code takes a gyro and accel sample from a Prop and does the computation on a PC, but it demonstrates the idea pretty solidly. That said, if Blockly doesn't let you use floats, this may be a little trickier.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
I have printed it out for perusal.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
I am ready for the big one now.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
now back to work on the BOE-Balancer. I am not having much trouble with making a PID in Blocklyprop but
just can't dial in the robot enough at the beginning to make it stable. It is either not responsive enough or
overshooting. I have not found the sweet spot. You can not make it stable in the first stage of the PID but it
should be trying to stand. I have tried it with encoders, without encoders, with high speed servos and regular
CR servos. It is very close but not close enough. I will keep trying...............................Once again I am eating
something bigger than my head.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
Who needs a biped robot, when you can have code like yours that makes a balancing robot so stable. Either one falls over when the battery gone though.
PropWare: C++ HAL (Hardware Abstraction Layer) for PropGCC; Robust build system using CMake; Integrated Simple Library, libpropeller, and libPropelleruino (Arduino port); Instructions for Eclipse and JetBrain's CLion; Example projects; Doxygen documentation
CI Server: https://ci.zemon.name?guest=1
PropWare: C++ HAL (Hardware Abstraction Layer) for PropGCC; Robust build system using CMake; Integrated Simple Library, libpropeller, and libPropelleruino (Arduino port); Instructions for Eclipse and JetBrain's CLion; Example projects; Doxygen documentation
CI Server: https://ci.zemon.name?guest=1
A setpoint is one of the parameters of your PID. It is essentially the balance point of your robot. Only in an ideal world is it ever at 0.
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker
The sweet spot should be consistent, so once you've found "true level" through a calibration routine, that should work as your set point. It may require an offset because of weight imbalance on the craft, but that's typically handled by integral term in the PID.
I fused the accelerometer and gyro readings together to produce a more accurate and faster responding angular reading, and just used the raw gyro numbers for the rotation rate. I also found that the motor output required to balance isn't linear with angle - it's more like 1 / cos(Angle). When the bot is vertical, it's perpendicular to the floor, and that's the direction the wheels move, so all movement goes more or less directly into rotating the bot. If you're at 30 degrees, you need to move the motors farther to make a similar change in your angle - motor impulses at this point are cos(30) = 0.866 effective at rotating you.
This effect is amplified because the effect of gravity is affected by this as well, but inverted - When perfectly vertical, gravity has zero effect on your rotation. The further you are off center, the stronger the effect of gravity, in this case, it's sin(Angle).
So, cumulatively, if you're at zero, everything is peachy. If you're slightly off zero, gravity starts to accelerate you away from it, and your motors have to work harder to push you back to it, so you need to ramp your PID response based on your current angle to account for all of this.
I did merge both readings into one but my setpoint is a minus number and it seems to me to cause anomalies in reversing the motor
speeds from positive to negative. I have also tried dividing the gyro output by 360 or 180 to bring the numbers down to something the
motors can use. Am I barking up a wrong path there?
carolhaz391@gmail.com
In the birthing of any machine there is that moment when it actually works. It is always fresh and astounding for me...............Red Whittaker