View Single Post
  #11   Spotlight this post!  
Unread 24-03-2015, 16:03
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Anti-tipping algorithm

Quote:
Originally Posted by Jared Russell View Post
This approach will make it appear that your robot is pitching or rolling any time you have acceleration due to any force other than gravity (such as the reactive force exerted by the carpet against the tractive force of your wheels).
That is very true... the induced acceleration due to robot motion will appear as high frequency noise on each signal. The great thing about that, is that it is easy to determine which acceleration is legitimate, and which acceleration is induced due to robot motion. Simple Low pass filters, will allow for more stable readings... but will increase delay. There is a happy medium to allow for reliable tilt measurements.

A simple Euler linear filter can be used if one desires. It is a autoregressive infinite impulse response moving average.

Code:
accelX = (accelX * alpha) + (Robot.accel.getX() * (1.0 - alpha));
Where alpha is a value from 0 to 1. as you increase alpha from 0 towards 1, the filtering gets more aggressive, and the delay increases. If alpha is 0, its easy to see that there is no filtering at all.

This is the most basic filter you can implement in my book, and it does a pretty good job. There are more robust filters if you ever wanted to experiment with them. Two popular filters to try to smooth acceleration data out would be a median filter, or a Butterworth filter. They are popular because they are relatively easy to implement in code.

If you have the means to use a Gyro to measure the axis of rotation you care about, that is the sensor I would recommend for this application... if you don't, or want to experiment otherwise, it shouldn't take too much effort to use an accelerometer to have a similar implementation.
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner

Last edited by NotInControl : 24-03-2015 at 16:18.