Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AHRS-AvionicsDuino compensate for centrifugal force #2

Closed
brightproject opened this issue Sep 27, 2023 · 3 comments
Closed

AHRS-AvionicsDuino compensate for centrifugal force #2

brightproject opened this issue Sep 27, 2023 · 3 comments

Comments

@brightproject
Copy link

brightproject commented Sep 27, 2023

Good afternoon @bfrmd.
How do you compensate for centrifugal forces?
For first flight test I used a simple Madwick filter.
270898929-acfe1ebb-7355-4f93-9c80-bbb1a8eea9f8
I'm will try to use uNavAHRS - I haven't tested it in flight yet.
I mentioned the main problem here.
This is simplest AHRS or IMU code.
It contains the basic concepts of how orientation angles are obtained from acceleration and angular velocity data.

#include <Adafruit_LSM303_Accel.h> // Library for the LSM303 accelerometer
#include <Adafruit_LSM303DLH_Mag.h> // Library for the LSM303 magnetometer

Adafruit_LSM303_Accel_Unified accel;
Adafruit_LSM303DLH_Mag_Unified mag;

void setup() {
  Serial.begin(115200);

  if (!accel.begin() || !mag.begin()) {
    Serial.println("Could not start Adafruit sensor, check wiring!");
    while (1);
  }
}

void loop() {
  sensors_event_t accelEvent, magEvent;

  // Read data from the accelerometer
  accel.getEvent(&accelEvent);

  // Read data from the magnetometer
  mag.getEvent(&magEvent);

  // Calculate orientation (example)
  float roll = atan2(accelEvent.acceleration.y, accelEvent.acceleration.z);
  float pitch = atan2(-accelEvent.acceleration.x, sqrt(accelEvent.acceleration.y * accelEvent.acceleration.y + accelEvent.acceleration.z * accelEvent.acceleration.z));
  float heading = atan2(magEvent.magnetic.y, magEvent.magnetic.x);

  // Convert radians to degrees
  roll = roll * 180.0 / M_PI;
  pitch = pitch * 180.0 / M_PI;
  heading = heading * 180.0 / M_PI;

  // Print orientation to the serial port
  Serial.print("Roll: "); Serial.print(roll); Serial.print(" degrees\t");
  Serial.print("Pitch: "); Serial.print(pitch); Serial.print(" degrees\t");
  Serial.print("Heading: "); Serial.print(heading); Serial.println(" degrees");

  delay(100); // Delay to control the update frequency
}

This code has no filtering at all, i.e. It has no noise, no errors, much less compensation for centrifugal forces.
But it is very clear and simple for a beginner to get started in the world of motion and MEMS sensors.
Using his example, you could show how to compensate for the value of centrifugal acceleration, depending on the angle of rotation (roll).

@bfrmd
Copy link
Owner

bfrmd commented Sep 27, 2023

Hi brightproject,
As explained on our website, without using GNSS data (or air data), I'm afraid it may not be possible to compensate for centrifugal force in a fixed-wing aircraft...
We have extensively flight tested our AHRS. It is based on the uNav INS library by Brian Taylor (Bolder Flight Systems). It works like a charm.

@brightproject
Copy link
Author

brightproject commented Sep 28, 2023

You conducted quite a lot of tests when developing AHRS, did you try using uNavAHRS or straight from using IMU Naveol to uNavINS?
Have you tested uNavINS without a GPS signal?
I came across information from Brian Taylor himself from BFS that he seemed to want the filter to be operational when the GNSS signals disappeared.
I’m making my own device and don’t want to complicate it yet with the presence of a GPS - this means additional space in the case, power supply and, of course, an external antenna.
In addition, from time to time you come across articles that even using a gyro and axels you can compensate for centrifugal forces.
And this gives me hope for a possible solution to the problem of determining orientation without using sensors other than the accelerometer and gyro.
I think it is necessary to somehow reduce the weight of the accelerometer at the beginning of the roll, and the greater the roll, the less the weight of the accelerometer should be and the greater the weight of the angular velocity data from the gyroscope.
As far as I understand, this is not implemented in principle at uNavAHRS.
In uNavIns, the flight speed correction signal is taken from the GPS.
The same iNav was somehow able to compensate for the values of centrifugal force

https://github.com/iNavFlight/inav/blob/39e8e7c4bb0c8a4c65aab4d86d3e6e268ac3a7be/src/main/flight/imu.c#L547

But as far as I understand, they also use GPS for correction.
In some threads on Github, there were lively discussions, including iNav, about the use of some kind of direction cosine matrix DCM.
And even tests were carried out on quadcopters, with flight without GPS.
So I don't know what to do.
NavImu works great for you, but for me it is a complication of the device, and for now I do not plan to move in this direction.
As I understand it, you didn’t decide to develop your own AHRS or IMU and took a ready-made solution.
This is the right path, but many uncertainties remain.

@bfrmd
Copy link
Owner

bfrmd commented Oct 2, 2023

I did not try using uNavAHRS. I tried other similar projects, and they all had the same problems during a long coordinated turn.
Correction of the gyroscope bias drift remains a big challenge. Gravity is locally indistinguishable from other accelerations and cannot be filtered out by lowpassing the accelerations. To compute the real gravity vector, one must subtract the accelerations due to non-inertial motion obtained from an independent source like a GPS.
The math necessary for this data fusion calls for particularly complex notions beyond the capabilities of a non-specialist. And I am a non-specialist...
To implement a reliable DIY AHRS, genuinely usable in a real fixed-wing aircraft, I had to rely on the works of specialists!
If you demonstrate in flight (in a real fixed-wing aircraft) that it is possible to build a reliable AHRS with commercial low-cost MEMS IMU without GPS or air data, I would not be the only one interested.

@bfrmd bfrmd closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants