BOE-Balancer Program

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.
839 x 1038 - 274K
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

  • 22 Comments sorted by Date Added Votes
  • Has anybody used the LSM9DS1 in a project? When I try the calibration routine the P26 and P27 LEDs never turn off. The only code lines I am using for this right now is the initialize block and the calibration block.
    1383 x 1037 - 409K
    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

  • Found out I was rotating the unit too fast. Have the IMU up and working now.
    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

  • Balancing BOE BOT, the triple B!

    wonderful idea.

    Enjoy!

    Mike
    I am just another Code Monkey.

    A determined coder can write COBOL programs in any language. -- Author unknown.

    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.
  • Very Cool!

    It might be old hack for some, but I like it and plan to do the same soon.

    Thanks for sharing this.
  • I am doing it to see the how it would go in Blocklyprop. I am having fun programming
    with it and want to learn how to use it for almost all my robotics.
    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

  • I am doing it to see the how it would go in Blocklyprop. I am having fun programming
    with it and want to learn how to use it for almost all my robotics.

    It's a very healthy choice.

    700 x 466 - 40K
  • ercoerco Posts: 18,063
    edited July 12 Vote Up0Vote Down
    Bwockwee has not always garnered full executive endorsement.

    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
  • AAAHHH! Some things, even simple ones, can be a real pull. After putting encoders on I could not get them to calibrate and realized I had standard speed servos on it which do not work with the encoders. So switched to high speed encoders and also decided to put the Parallax li-on battery pack in it which completely changed how everything fit together, so I did a complete redesign and rebuild. That took most of the day and now I am charging the li-on battery pack. Getting there, slowly getting there. Been reading everything I can on PID's and I think I have that in control. (self delusion is a necessity in robotics!)
    1383 x 1037 - 565K
    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

  • ercoerco Posts: 18,063
    Carol: Way to dive right in. You've certainly taken a lot upon yourself in this heady endeavor! Sometimes it pays to walk before running. A lot of people have made BoeBots balance using just a PING sensor instead of IMU or gyro/accelerometers. Might this be an intermediate step worth checking off?

    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
  • I have done a couple of Lego segways, one with a gyro and one with a light sensor but both were in Lego's graphical language and most of it was already
    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.
    1383 x 1037 - 427K
    1383 x 1037 - 478K
    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

  • I like the idea of the ball balancing bot. That would be real interesting.

    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.
  • ercoerco Posts: 18,063
    I've posted this several times, but it's neat to see how simply this guy got his robot balancing with just a 555 timer & analog circuitry, using a light sensor.

    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
  • I am almost ready to video mine. I have finally got a working PID in Blocklyprop and will be tuning my bot today.
    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!
    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

  • ercoerco Posts: 18,063
    Carol, any updates? This is a bold challenge!
    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
  • I am having equipment trouble. Trying to troubleshoot it now.
    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.
    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

  • It shouldn't need to be done in floating point as long as you have enough precision in the longs. When I did it, it was useful to have two terms - One for the gyro readings, and another (independent) for the angle value. If you try to PID on just the angle value, you need a LOT of precision to keep it balanced, because you want to be able to respond to very small changes in angle. For that reason I found it better to just feed the gyro readings directly into the PID for derivative term, and use the angle value for P and another D term, then mix them all together.

    I made this one a while back:

  • I am using the angle reading from the accelerometer and the speed of rotation from the gyro. My thinking on this is the gyro gives me the rate of change and the angle gives the current place the robot is at so the gyro provides the porportional value needed to speed up or down the motors. They are incorporated together for the speed of wheels.
    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

  • Wow, that robot is really steady! Is that a flight controller on top?
    I am using the Parallax 9-axis IMU.
    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

  • That's a HoverflyGimbal controller, but it's essentially the same hardware. Are you using the raw accelerometer value to compute the angle? If so, you'll need to filter the living heck out of it to get anything useful. I'd recommend a complimentary filter for this, because you can just do a simple gyro + accel filter to get a decent result, then feed that filtered angle value into the PIDs.

    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.
  • We definitely had to filter the gyro data but since the only element we needed from it was its proportion of speed we just divided it by 180 to bring its values down to within the speed limits of the servos.
    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

  • Thanks Jason,
    I have printed it out for perusal.
    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

  • Carol HazlettCarol Hazlett Posts: 237
    edited July 21 Vote Up0Vote Down
    Took a little time off for some personal safety measures.
    I am ready for the big one now.
    397 x 329 - 54K
    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

Sign In or Register to comment.