View Single Post
  #5   Spotlight this post!  
Unread 17-04-2009, 03:08
Molten's Avatar
Molten Molten is offline
Registered User
AKA: Jason
FRC #1766 (Temper Metal)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2006
Location: Indiana
Posts: 2,289
Molten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond reputeMolten has a reputation beyond repute
Re: very urgent help needed regarding algorithm for self balancing of two wheeled rob

From what I know about dynamics here is a picture of what is happening.


....................................._____________
.....................................\............ .............\
......................................\........... ...............\
.......................................\.......... ..C............\
........................................\......... ....---..........\
.........................................\.......--.......--.........\
......................<---------- ...\__.|....O.....|_____\
.................................................. --......--
.................................................. ....---


Ok, so basically. The C is the center of mass, O is the center of the axle, and U is the distance between C and O. There is a moment created by gravity anytime that C isn't directly over O. The accelerometer provides you with an angle that can be used with geometry to find the displacement in the horizontal plane. The formula for the moment created is mass*gravity*displacement. Now, you have the amount of torque that needs to be corrected against. The way you plan on fixing this is by adding another moment in the opposite direction created by the movement of the axle. The only way this will work well is if the axle supports the frame with bearings so that the actual turning does not create a torque about the axle. All you want is a push along the arrow marked above. Now, the way to calculate this moment is to use the angle found by the accelerometer and geometry to find the vertical displacement between the axle and the C. This moment is going to be displacement*pushing force. The pushing force is going to be mass*gravity*mu*pi*diameter of wheel*rpm. The rpm may take a sensor of sorts.(not sure on that part) So, in essence:

mass*gravity*mu*pi*U*sin(90-N)*diameter of wheel*rpm=mass*gravity*U*cos(90-N)
I go ahead and cancel the mass, gravity and U. This leaves:

sin(90-N)*diameter of wheel*rpm=cos(90-N)

So, rpm=cot(90-N)/diameter of wheel.

OK, now for the disclaimer: All the math posted above was done at 3 in the morning while watching tv and being half asleep. I am not by any means confident in all of the math I did. I think that it should give you a rough estimate of what you are looking for. Anyone that can confirm or improve my work would be greatly appreciated.
__________________
"Curiosity. Not good for cats, great for scientists."- Numb3rs

"They can break your cookie, but... you'll always have your fortune."-T.W. Turtle, Cats Don't Dance

"Tell my tale to those who ask. Tell it truly - the ill deeds along with the good, and let me be judged accordingly. The rest... is silence."-Dinobot, Beast Wars

"Though the first step is the hardest and the last step ends the quest, the long steps in between are certainly the best."
–Gruffi Gummi, Disney's Adventures of the Gummi Bears