View Single Post
  #2   Spotlight this post!  
Unread 21-04-2014, 07:31
rich2202 rich2202 is offline
Registered User
FRC #2202 (BEAST Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Wisconsin
Posts: 1,187
rich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond repute
Re: Mini map display on the Dashboard

Quote:
Originally Posted by Kevin Phan View Post
It doesn't help that the accelerometer is not nice and neat and doesn't read a value of 0 when it is not moving. Maybe I'm just looking at this situation wrong or maybe I've got the wrong idea.
I have not programmed it, but I stayed at a holiday inn express last night ...

Here is an interesting tutorial

http://www.instructables.com/id/Acce...eter-and-Gyro/

I assume that you have used the WPI Lib SetZero command to zero out the effects of gravity. Other than that, the tutorial says that the accelerometer will measure vibrations (compressor motor?).

Quote:
I'm just having trouble with determining the velocity correctly when the driver jerks around or when the robot is at a constant velocity.
When the robot is moving at a constant velocity, then acceleration is 0. Just like you store position, you also need to store velocity. During each time slice, you take the Acceleration, and factor that into the new velocity. The new Velocity x Time should give you the new position. If acceleration is 0, then your new velocity is the same as your old velocity.

Jerking around is a little more difficult. Processing necessarily assumes constant acceleration since the last reading. Questions are:
1) Does the device and/or WPI Lib give instantaneous acceleration or average the acceleration since the last reading?
2) Even if instantaneous, what is the time period? What is the clock cycle of the device?
3) What happens if you sample too quickly?

Here is the issue: Somehow, you have to measure the abrupt changes (jerks) in acceleration. If the change happens quickly (like smashing into a steel wall), then you might miss it if you do not sample fast enough. Let's take an extreme example, let's say you sample once a second. At t=0, your are stopped, and at t=1, you have 1 meter/second/second acceleration. How long over that time slice have you been accelerating? Your velocity at t=1 could be 1 meter/second (if accelerating during the entire time slice), or 0 meter/second if you just started accelerating. More frequent sampling reduces the error.

Smoothing also happens between the accelerometer and the analog input board. As the accelerometer changes voltage, there is a lag time before the analog input board reflects the changes. If the voltage is changing quickly, then you might only get an average, depending upon how fast the analog input board updates the digital number.

On average, you would expect all the "noise" in the system to cancel out, or not be material to your measurement. There is also the problem that you are only estimating. Over time, you will be off, and you need some type of other readings to re-calibrate. For instance, use a camera pointed down to figure out when you are not moving, and zero all your readings.

What kind of readings are you getting when the robot is not moving?
What kind of readings are you getting when the robot is moving at a constant velocity? Note: What may seem constant to you may have a lot of variance (noise) for the accelerometer, which should average out over time (say 1 second). Also, it may detect smaller changes than you can see.

Last edited by rich2202 : 21-04-2014 at 07:35.
Reply With Quote