0
$\begingroup$

So I am using a complementary filter to find the attitude in my quadcopter, doing the following

$$\text{angle} = 0.98\cdot (\text{angle}+\text{dt}\cdot \text{angle_rate})+0.02\cdot \text{accelerometer_angle}$$

Now the problem is that the angle is wrong when my system(quadcopter) is accelerating, do you know how to solve the problem, or it is normal not to get accurate values when accelerating even if one is using the complementary filter?

$\endgroup$
2
  • 1
    $\begingroup$ try 0.02 as weight for the accelerometer_angle. the sum currently seems to add up to 1.18 instead of 1. $\endgroup$
    – Petrus1904
    Commented Dec 6, 2020 at 18:01
  • $\begingroup$ @Petrus1904 sorry I wrote wrong, I meant 0.02, I also tried other values like 0.01 and 0.99, but there is the same problem $\endgroup$ Commented Dec 7, 2020 at 10:31

1 Answer 1

0
$\begingroup$

I have scrolled through the data sheet of this device, and first things first: never expect accurate values from a device that costs like 5 euro. looking at you equation, I think you are calculating the angle by effectively integrating the gyro value. Since integrating a sensor value is not an accurate estimation (because noise), the angle measured from the accelerometer could compensate for this deviation. This means that if the device is hovering statically, the angle saturates to the value of the accelerometer angle. The accelerometer calculates the angle using the gravitational acceleration (which it measures). However, the accelerometer also measures any other force acting on the system and that causes your accuracy problem.

The solution to an issue like that is hard, increasing the weight of the accelerometer improves estimation at constant velocities. decreasing it prevents measurement offsets when accelerating.

However, the sensor seems to have a couple tricks for you to use (DPM and noise filtering), so if you havent already, you might to check these.

$\endgroup$
1
  • $\begingroup$ Consider looking at kalman filtering $\endgroup$ Commented Dec 7, 2020 at 17:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.