Hi all, this is my first post here but I've been lurking, reading and studying for a while.
I'm involved in a project entailing the development of a UAV (pretty much from the ground up), I've got the Adafruit 10-DOF of freedom IMU with the axes directions as indicated in the pic here:
https://cdn-shop.adafruit.com/1200x900/1604-01.jpg
Now, I've had test flights which have been successful - I'm developing all this stuff on an STM32F415RG which is a great platform. All the stuff is mounted in an AXN-Floater:
Everything has been (somewhat) smooth sailing, except the AHRS has been really tough. The approach I'm using is with a Complementary Filter (I have to do most everything from first principles and the complementary is do-able, I would've considered Kalman but that ups my complexity too much and would mean not reaching my deadline). So the complementary filter works okay, the plane can fly itself straight and level with autopilot (quite well actually) and handles the wind well too.
For centripetal compensation, I am calculating the acceleration: a = velocity x angular rates (cross-product).
The problem I'm having is with the AHRS in turns, I know this is a common problem - and I have since read up on the problem and formulated somewhat of a solution to compensate for both the IMU offset (it's located away from the CG, that was easy enough) and the centripetal force compensation works kind of... Previously the attitude indication would go absolutely nuts when in a relatively high-g turn (like displaying crazy pitch and roll values) which has since been fixed somewhat by the centripetal compensation that I have implemented now using GPS speed. My problem is that despite it improving the results quite a lot in level flight, it still struggles in turns which I have a feeling may be due to:
When I spin around in a rotating chair with the aircraft and watch the AHRS on my rudimentary GCS software, roll angle is perfectly calculated despite the centripetal forces - but when I pitch the aircraft nose up or nose down the attitude indication is not accurate ( it rolls over and the pitch indicated is completely wrong). In any case, here is my code (pastebin for formatting sake):
The IMUStruct contains the IMU information from gyro and accelerometer. Longitudinal speed is the reported GPS speed in m/s.
If anyone has any experience or has done this before, please I would really appreciate your input. Thanks in advance!
Tags:
You are probably way past this problem, but here's my take on it:
If you are assuming velocity aligns with the X axis, then you should only be compensating acceleration in the Z and Y-axis direction.
A_y is computed as follows:
(1.0 - Radial acceleration
(2.0 - Radius of rotation with a given tangential and angular velocity
Combining eq 1.0 and 2.0
(3.0 - Radial acceleration given tangetial velocity and rotational rate
A similar exercise can be performed to compute A_z
The above is provided for reference as the cross product will give these values.
Omega (gyro output) must have units of radians per second, or it will need to by scaled accordingly.
"longitudinalSpeed" should have units of M/S
Your output (centripetalAcceleration) has units of M/S^2. If you're Accelerometer has units of G, then you should scale the correction to match.
Check the sign of the corrections, it's possible that one of them needs to be reversed if your sensor axis alignement violates the right hand rule.
Good luck!
Phil
4 members
283 members
1074 members
77 members
164 members
© 2019 Created by Chris Anderson. Powered by