Centripetal AHRS Compensation problems

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:

3691319149?profile=original

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:

  • GPS speed not being totally accurate (I am in the process of implementing the pitot tube as we speak)
  • I have some kind of sign error in my compensation, perhaps due to the fact that my IMU is not following convention.

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):

http://pastebin.com/K1Zn7j8D

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!

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • 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:

    gif.latex?A_y%3D%5Cfrac%7B%7BV_x%7D%5E2%7D%7BR_y%7D          (1.0 - Radial acceleration

    gif.latex?R_y%3D%5Cfrac%7BV_x%7D%7B%5Comega%20_x%7D           (2.0 - Radius of rotation with a given tangential and angular velocity

    Combining eq 1.0 and 2.0

    gif.latex?A_y%3DV_x%5Comega%20_z        (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

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @SahikaGenc: AWS DeepRacer & Hot Wheels Track https://youtu.be/4H0Ei07RdR4 via @YouTube
Monday
DIY Robocars via Twitter
Sep 8
DIY Robocars via Twitter
RT @davsca1: We are releasing the code of our Fisher Information Field, the first dedicated map for perception-aware planning that is >10x…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: How this works: 1)object detection to find cones in single camera image, 30 frames/sec on @NVIDIAEmbedded Xavier. 2)comp…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: Use two color cones to guide the robocar. No map needed, on onsite training needed. Just place the cones and it will fol…
Sep 7
DIY Robocars via Twitter
Sep 7
DIY Robocars via Twitter
RT @roboton_io: Great to see http://roboton.io running at 60fps on the cheapest #chromebook we could find! #edtech #robotics #educat…
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Crazy in-depth article about using the OpenMV Cam for Astrophotography: https://github.com/frank26080115/OpemMV-Astrophotography-Gear https://t.co/BPoK9QDEwS
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Hi folks, it's finally here! Our first draft of our Arduino Interface Library is out! It works over SoftwareSerial, Hardware…
Sep 3
DIY Robocars via Twitter
RT @chr1sa: Please let them have an open API. This would be perfect for @DIYRobocars races https://twitter.com/NintendoAmerica/status/1301513099707658246
Sep 3
DIY Robocars via Twitter
RT @SmallpixelCar: Lanenet pretty much used all my GPU power on @NVIDIAEmbedded Xavier since I optimized with tensorRT. I need to run anoth…
Sep 3
xemone liked Max Gilson's profile
Aug 31
DIY Robocars via Twitter
RT @LyftLevel5: Our @kaggle competition on Motion Prediction for Autonomous Vehicles is now live! Experiment with the largest-ever self-dri…
Aug 24
DIY Robocars via Twitter
RT @chr1sa: Our next @DIYRobocars virtual AI car race will be on Sept 26th. Sign up here https://www.meetup.com/DIYRobocars/events/272786977/ https://t.co/UENKGSOWO8
Aug 24
DIY Robocars via Twitter
New ready-to-run @NVIDIAEmbedded JetRacer car from Waveshare. Perfect for the next @diyrobocars race as soon as we… https://twitter.com/i/web/status/1297960223013867520
Aug 24
DIY Drones via Twitter
RT @chr1sa: The US government just approved 5 US-made drones for purchase, all based on the @Dronecode @PX4Autopilot standard. Great news f…
Aug 20
More…