View Single Post
  #2   Spotlight this post!  
Unread 25-06-2008, 02:49
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,826
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: Accelerometers & Gyros for N00bs

Think of the accelerometer as a big flat plate with a plumb bob (string with a weight on the end) hanging down from it. As you accelerate the plate in a horizontal direction, the angle of the string relative to the plate will change. As you tip the plate the angle of the string relative to the plate will change. The value returned by the accellerometer is, essentially, the angle of the string. Thus if you hold the plate level, you are measuring accelleration. If you hold the plate at constant velocity, you are measuring a change in the angle (tipping) of the plate. (Which, since gravity counts as acceleration, is the same thing, even though the plate isn't actually speeding up or slowing down, but I digress...)

In reality, it kind of works upside down, as my understanding of the MEMS (micro electro mechanical systems) devices we use acutally create a bubble inside the chip that floats, and it is the position of the bubble that gets returned. Same thing, but upside down.

A gyro uses... well... something similar, I think, to measure twist. I'll have to look up what actually goes on inside a MEMS gyro, or let someone else describe that here, however what the gyro is sensing and returning is how fast it is being turned.

Note that both sensors detect the rate of change in a parameter. This is a great opportunity to talk about derivatives and integrals with students. If you want to know what direction your robot is pointing, you use a gyro. By repeatedly measuring the rate of change in direction (turning one direction is positive, the other negative), you can create a graph. The cumulative area under the curve of the graph is... approximately... how far you have turned.

Likewise to determine your speed, hold the accelerometer flat, and rapidly measure your acceleration. Integrate that value and you have your velocity. Integrate that and you have your position.

There are several factors that make this a little more challenging to do than it sounds, and it is possible that you can use pre-defined software libraries that make this easier to do than it sounds (someone else takes care of the measuring and integrating for you), but that is a simple description of what the two sensors do.

We used a gyro on our robot this year to make sure it would track in a straight line. If the robot turned (without instruction from the driver) the gyro would send a message saying "I'm turning in this direction at this speed". The robot would then automatically speed up the wheels on one side and slow down (or reverse) the wheels on the other side to compensate and put the robot back on track. It worked great! Had we got the code working right, we could have used those measurements, integrated with respect to time, to determine which direction we were facing and help with navigating the corners of the course in hybrid mode.

Jason

Last edited by dtengineering : 25-06-2008 at 02:51.