Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.

Getting position from my UAV
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Getting position from my UAV

by samuel on Mon Mar 29, 2010 6:26 pm

Hello guy!
I recently bought a gyros to implement real time position to my airplane. But I am having problems. The gyros, as known, send a analog ouput proportional to the angular velocity, but I need angular position.I remember from my school, position is the area below the curve of velocity, in other words, it is the integral of angular velocity. Could someone give an example code where obtaining the angular position from velocity. Or what else should I do?, what is the best way to obtein these parameters?

Posts: 6
Joined: Tue Feb 16, 2010 1:11 pm

Re: Getting position from my UAV

by adafruit_support_bill on Mon Mar 29, 2010 6:53 pm

I believe that the ArduPilot folks have published their sources. You might search for that.

Posts: 77936
Joined: Sat Feb 07, 2009 10:11 am

Re: Getting position from my UAV

by pstemari on Thu Apr 01, 2010 2:04 am

Basically you just need to keep a running total of the angular velocity as sampled at a fixed interval, being certain to not lose the sign, e.g. if you read 2, 3, 2, -2, -1, you should total that up as 4, not as 10. Then you're just a scale factor away from having the total rotation.

The part where it gets tricky is the math to add the rotations on all three axes properly, e.g. a 90 degree roll, followed up a 90 degree pitch up, followed by a -90 degree roll, winds up being the same as a 90 degree yaw.

If you look at existing code, you'll need to be very careful to pay attention to how the angles are combined and how the signs come in from the sensors. Getting a sign wrong will give you wildly bad results.

I'd concentrate on getting one axis working first, and then move to two and three axes.

A wholly owned subsidiary of:
Persephone: DL R+W+B C 7 X L W C++ I++ T+ A E H++ S+ V-- F+ Q P B PA+ PL
Aldebaran: DM Rt H 5 Y L- W+ C+ I++ T++ A+++ E H++ S+ V+ F++ Q+ P B++ PA- PL--
User avatar
Posts: 310
Joined: Sun Mar 21, 2010 6:10 pm
Location: Seattle, WA

Please be positive and constructive with your questions and comments.