|
Re: 2 wheeled balancing robot
Here's one way to approach it (or at least get started):
You are trying to "drive under" the center of mass. If you had a pendulum connected to the shaft of a potentiometer attached to the robot, it would give a certain voltage when you are directly underneath it, lets say 2.0 Volts. If the robot is tilted to the "North" 10 degrees, you get 1.8 Volts, to the "South" 10 degrees you get 2.2 Volts. If your robot tilts South, drive South , if it tilts North drive North. Try setting your motor command in proportion to the difference between the pot. signal and your pot.target signal. This example shows Kfactor as 1, adjust as needed. This is basic proportional control, the "P" in PID. If you want your robot to move South, adjust your target to something greater than 2 Volts so that your robot is "falling" in the direction you want it to travel.
To add integral control ("I"), add a constant whenever it is falling too far in one direction, subtract it if it is falling in the other direction. To add derivative control ("D"), subtract off a term proportional to the rate of change of the pot.signal [IMG]Diagram[/IMG]
__________________
"A hundred times every day I remind myself that my inner and outer life are based on the labors of other men, living and dead, and that I must exert myself in order to give in the same measure as I have received and am still receiving..."
--Albert Einstein
2001: FLL852 |2002: FLL20/FLL21 |2003: FLL23/FLL25 |2004: FLL14/FLL16 |2005: FVC22/FLL124 |2006: FLL3/FLL2986/FVC22/FRC1732 |2007:FLL3/FLL34/FLL56/FRC1732
2008: FLL3/FLL18/FRC1732 |2009: FLL101/FLL8963/FRC1732 ...(etc.!)
Last edited by John Wanninger : 26-08-2005 at 09:42.
Reason: drawing cleanup
|