Shop OBEX P1 Docs P2 Docs Learn Events
Two Wheeled Inverted Pendulum Bot/Car Help — Parallax Forums

Two Wheeled Inverted Pendulum Bot/Car Help

TylerSkylerTylerSkyler Posts: 72
edited 2012-03-26 19:07 in Propeller 1
Hello All! For a Math project I decided to build A two wheeled inverted pendulum bot(powered by propeller). The bot is all ready built and outfitted with an acceleromter(This One) and gyro(This One) as well as two dc motors that can be controlled through a motor controller using "Regular Pulsout" values(e.g. 750 = stop). All of these sesors and motors have been tested and they all work. My problem is the implementation of Logic that balances it I have read about fusing the gyro's and accelromter's values in order to get one value and such as well as fuzzy control in theory...But it isn't much help as none of them have any information as to the implementation methods of this into a system(Not SPIN, not any language or system). So this is where I need help. How can I combine the values from the gyro and acclerometer and how does that help me get an accurate reading of "Tilt"? Then how can I percisely control the servos to address thes changes presicely using "Normal" pulse values? Please don't take this as me trying to get you to do my work I just want some help clarifying the use of the data from my sensors and how to percisely move the servos. And the reason that it is in the propeller section and not the robot section is that I hoped that people familiar with the propeller's weaknesses and strengths would be able to provide info specific to this platform.


1000 Thanks,

Tyler

Comments

  • jmgjmg Posts: 15,183
    edited 2012-03-26 16:54
    How can I combine the values from the gyro and acclerometer and how does that help me get an accurate reading of "Tilt"?

    To know tilt, you need to also know the location of the TOP of the pendulum, as well as the bottom or, add a 2 axis angle sensor, or even a joystick.

    Simplest would be a joystick gimbol base, with maybe add a simple mechanical circle limit/catcher 'halo' that stops the pendulum going outside sensible limits. Maybe 15'-30' of tilt, and from there, you should be able to recover.

    A Joystick also allows a Nice-to-watch algorithm, that can be slowish :
    Decide the precise 'angle of crash' from present bot rotation, and then spin the bot to match that angle, and move fwd.back to restore the pendulum to 90'.
    Wait for the next fall, and repeat. You can make that action threshold user adjustable.

    A purist might add a creep compensator, (and a cable de-tangler, if this has a tether) so the bot tended to stay in the centre of a designated area, or you could make creep a feature, and make a small polystyrene block maze testers can steer the bot around, by blowing on the pendulum....
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-26 19:07
    jmg wrote: »
    To know tilt, you need to also know the location of the TOP of the pendulum, as well as the bottom or, add a 2 axis angle sensor, or even a joystick.

    Simplest would be a joystick gimbol base, with maybe add a simple mechanical circle limit/catcher 'halo' that stops the pendulum going outside sensible limits. Maybe 15'-30' of tilt, and from there, you should be able to recover.

    A Joystick also allows a Nice-to-watch algorithm, that can be slowish :
    Decide the precise 'angle of crash' from present bot rotation, and then spin the bot to match that angle, and move fwd.back to restore the pendulum to 90'.
    Wait for the next fall, and repeat. You can make that action threshold user adjustable.

    A purist might add a creep compensator, (and a cable de-tangler, if this has a tether) so the bot tended to stay in the centre of a designated area, or you could make creep a feature, and make a small polystyrene block maze testers can steer the bot around, by blowing on the pendulum....

    I don't think this approach would work. Need more than just an accelerometer (or pendulum switch). The motion of the robot will throw off your pendulum/accelerometer readings.

    You need to use a gyro in conjunction with the accelerometer or some other means to sense the bot's angle to the ground (with something like a Ping).

    I think the "standard" way of making a balancing two wheeled bot is to combine accelerometer and gyro readings with a Kalman filter.

    Hanno made a nice balancing bot with the Prop (I think it's called "My Dance Bot"). I believe his code is available somewhere.
Sign In or Register to comment.