Altimeter using a Accelerometer and Barometer
Shawna
Posts: 508
I have been working on my quad again, and I am making pretty good progress. I have hit a dead end with the tilt compensated magnetometer, so I have decided to have a try at an altimeter. I have been messing with the altimeter for about a week now and have hit a dead end here also. I was wondering if any of you guys have done this? I have code that I have been trying, but it is a mess with all of my trial and error, I am going to give it another try and clean it up a little. Once I get the code reworked I will post it here whether it is a success or failure.
I am messing with the acc portion of the code now, and I am getting nowhere. I have the acc running and the values filtered but I am having problems getting a meaningful velocity.
This is the site I am using for equations for calculating velocity.
http://www.aerospaceweb.org/question/dynamics/q0203.shtml
I know I do not have much info here yet, but I thought I would get a feeler out there and see what you guys think about this project.
Thanks
Shawn
I am messing with the acc portion of the code now, and I am getting nowhere. I have the acc running and the values filtered but I am having problems getting a meaningful velocity.
This is the site I am using for equations for calculating velocity.
http://www.aerospaceweb.org/question/dynamics/q0203.shtml
I know I do not have much info here yet, but I thought I would get a feeler out there and see what you guys think about this project.
Thanks
Shawn
Comments
2. in PUB Calc_ACC_Velocity when ACC = 0 g's you should not reset the accumulated velocity to 0 - it just stays at it is.
do you need to multiply with 0 to set a variable to 0 ?? - I haven't used F32 before ...
3. and I recommend metric units, since there are no strange factors to take care of in calculations.
if you need it for display, you can do the scaling in the end.
Your right floating point is not really needed. I tend to use floating point a lot when I am trying to get math equations working, and then I switch them over to integers.
I new for sure taking the float X 0 it would reset my floating point variable to 0.
I set velocity to zero when acc = 0 because at zero the chip is not moving, but the formula is still accumulating movement, because the velocity is not 0. This maybe one of the points I am missing.
I need to revisit some definitions, this doesnt seem like it should be real complicated.
x(next)=x(initial)+v(now)*t+(1/2)*A(now)*t^2
http://forums.parallax.com/showthread.php/67104-using-an-accelerometer-to-measure-distance
This is the paper I am studying now.
http://cache.freescale.com/files/sensors/doc/app_note/AN3397.pdf?fsrch=1&sr=2
What do you guys think, am I on the right track?
This is just the main loop below.
Here is the whole program if any of your are even more interested.
Give it a look, if you would.
Thanks
Shawn
If you start at zero velocity and accelerate then you add up the acceleration values to get the velocity, if you then move at constant speed the velocity value remains the same as nothing is added to it (acceleration is zero) then if you decelerate negative values of acceleration are added to velocity eventually bringing it to zero.
Similar story with displacement.
Cheers,
Graham