PPRZ Complementary Filter

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PPRZ Complementary Filter

flavio_just
Hey guys!
I am currently trying to reproduce the PPRZ C.F (ahrs_int_cmpl_euler.c) in Matlab and for that I am trying to fully understand the equations and the code itself. (Old version of PPRZ, I have no other choice =/)

I would like to know the following points, if it's possible:
- How the ahrs_align works and how lp_gyro, lp_accel and lp_mag are calculated (is it the average of the sum of all the samples measured until that moment?)

- Where is the gyro information of ahrs_propagate put together with accel info to generate the so called C.F? I can notice ahrs_propagate integrates the gyro and that ahrs_update_accel uses accel measurements, but where is the line of code that puts all of them together for roll and pitch estimations?

- Why is it made a rotation from IMU to BODY always after ahrs_init, propagates, etc? Can't it be used always the estimations in IMU and only make the final rotation to BODY after all calculations?

- Finally, I assume that the functions go in this order: Init, Align, Propagate, update_accel, update_mag. Is that correct? If yes, what is the name of the variable containing the final att estimations that are uploaded to the estimator and sent to telemetry?

I know I asked a lot of questions, but I really thank you for your help.
Best regards,
Flavio
Reply | Threaded
Open this post in threaded view
|

Re: PPRZ Complementary Filter

Hector Garcia de Marina
Hello Flavio,

just in case, about the equations, the Mahony's paper is here: https://hal-unice.archives-ouvertes.fr/hal-00488376/document
In particular the main result is in Theorem 4.1 .

I had the opportunity of discussing briefly with Mahony about this paper two years ago. If you have whatever question about the equations in the paper, 
feel free to ask :P.



On Mon, Dec 28, 2015 at 9:38 AM, flavio_just <[hidden email]> wrote:
Hey guys!
I am currently trying to reproduce the PPRZ C.F (ahrs_int_cmpl_euler.c) in
Matlab and for that I am trying to fully understand the equations and the
code itself. (Old version of PPRZ, I have no other choice =/)

I would like to know the following points, if it's possible:
- How the ahrs_align works and how lp_gyro, lp_accel and lp_mag are
calculated (is it the average of the sum of all the samples measured until
that moment?)

- Where is the gyro information of ahrs_propagate put together with accel
info to generate the so called C.F? I can notice ahrs_propagate integrates
the gyro and that ahrs_update_accel uses accel measurements, but where is
the line of code that puts all of them together for roll and pitch
estimations?

- Why is it made a rotation from IMU to BODY always after ahrs_init,
propagates, etc? Can't it be used always the estimations in IMU and only
make the final rotation to BODY after all calculations?

- Finally, I assume that the functions go in this order: Init, Align,
Propagate, update_accel, update_mag. Is that correct? If yes, what is the
name of the variable containing the final att estimations that are uploaded
to the estimator and sent to telemetry?

I know I asked a lot of questions, but I really thank you for your help.
Best regards,
Flavio



--
View this message in context: http://lists.paparazziuav.org/PPRZ-Complementary-Filter-tp17628.html
Sent from the paparazzi-devel mailing list archive at Nabble.com.

_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



--

_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: PPRZ Complementary Filter

flavio_just
Thanks so much Hector,
I will try to understand the equations step by step. I am a bit familiarized with Mahony's work. Actually the goal of the work I am doing is to implement in PPRZ a Trace Based Filter that was developed in my faculty and this filter is mostly based on the trace maps that Mahony defines. I will ask you further questions if I need =) Thank you so much!

2015-12-28 8:52 GMT+00:00 Hector Garcia de Marina [via Paparazzi UAV] <[hidden email]>:
Hello Flavio,

just in case, about the equations, the Mahony's paper is here: https://hal-unice.archives-ouvertes.fr/hal-00488376/document
In particular the main result is in Theorem 4.1 .

I had the opportunity of discussing briefly with Mahony about this paper two years ago. If you have whatever question about the equations in the paper, 
feel free to ask :P.



On Mon, Dec 28, 2015 at 9:38 AM, flavio_just <[hidden email]> wrote:
Hey guys!
I am currently trying to reproduce the PPRZ C.F (ahrs_int_cmpl_euler.c) in
Matlab and for that I am trying to fully understand the equations and the
code itself. (Old version of PPRZ, I have no other choice =/)

I would like to know the following points, if it's possible:
- How the ahrs_align works and how lp_gyro, lp_accel and lp_mag are
calculated (is it the average of the sum of all the samples measured until
that moment?)

- Where is the gyro information of ahrs_propagate put together with accel
info to generate the so called C.F? I can notice ahrs_propagate integrates
the gyro and that ahrs_update_accel uses accel measurements, but where is
the line of code that puts all of them together for roll and pitch
estimations?

- Why is it made a rotation from IMU to BODY always after ahrs_init,
propagates, etc? Can't it be used always the estimations in IMU and only
make the final rotation to BODY after all calculations?

- Finally, I assume that the functions go in this order: Init, Align,
Propagate, update_accel, update_mag. Is that correct? If yes, what is the
name of the variable containing the final att estimations that are uploaded
to the estimator and sent to telemetry?

I know I asked a lot of questions, but I really thank you for your help.
Best regards,
Flavio



--
View this message in context: http://lists.paparazziuav.org/PPRZ-Complementary-Filter-tp17628.html
Sent from the paparazzi-devel mailing list archive at Nabble.com.

_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



--

_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



If you reply to this email, your message will be added to the discussion below:
http://lists.paparazziuav.org/PPRZ-Complementary-Filter-tp17628p17629.html
To start a new topic under paparazzi-devel, email [hidden email]
To unsubscribe from Paparazzi UAV, click here.
NAML



--
Flávio Justino

Reply | Threaded
Open this post in threaded view
|

Re: PPRZ Complementary Filter

flixr
Administrator
In reply to this post by flavio_just
Hi Flavio,

I would like to know the following points, if it's possible:
- How the ahrs_align works and how lp_gyro, lp_accel and lp_mag are
calculated (is it the average of the sum of all the samples measured until
that moment?)

Basically, yes... but it doesn't take all values, but just the ones during the period where the simple heuristic (using z-accel) says it's not moving...
 
- Where is the gyro information of ahrs_propagate put together with accel
info to generate the so called C.F? I can notice ahrs_propagate integrates
the gyro and that ahrs_update_accel uses accel measurements, but where is
the line of code that puts all of them together for roll and pitch
estimations?

The accel update stores a measurement, which is used in the propagation to compute a residual and correct the attitude.
 
- Why is it made a rotation from IMU to BODY always after ahrs_init,
propagates, etc? Can't it be used always the estimations in IMU and only
make the final rotation to BODY after all calculations?

That basically what is done. The attitude output is only written in propagate and then the body to imu correction is applied.
However note that the euler version does not fully support large IMU to body rotatons, see https://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Complementary_Euler_.28fixed_point.29
 
- Finally, I assume that the functions go in this order: Init, Align,
Propagate, update_accel, update_mag. Is that correct? If yes, what is the
name of the variable containing the final att estimations that are uploaded
to the estimator and sent to telemetry?

Init first of course, then it is aligned when the aligner is done lowpassing the values.
Propagate is the "main" function that integrates the gyros and applies the corrections,
but depending on the frequency that your accel and mag provide new measurements they might not come after every propagate...
Especially the mag has a lower freq usually...

Output (in v5.4) is in ahrs_impl.ltp_to_imu_euler, but that is rotated to body frame first before it's sent to the state interface:
https://github.com/paparazzi/paparazzi/blob/v5.4/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler.c#L319

Cheers, Felix

_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: PPRZ Complementary Filter

flavio_just
wow, thank you so much Felix. Exactly what I needed. The problem with the different frequencies and the fact that the align doesn't take all the values is the problem and that's why my results are a bit discrepant to the ones in PPRZ. Thank you so much for the detailed explanation.

Cheers, Flavio!

2015-12-29 14:50 GMT+00:00 Felix Ruess <[hidden email]>:
Hi Flavio,

I would like to know the following points, if it's possible:
- How the ahrs_align works and how lp_gyro, lp_accel and lp_mag are
calculated (is it the average of the sum of all the samples measured until
that moment?)

Basically, yes... but it doesn't take all values, but just the ones during the period where the simple heuristic (using z-accel) says it's not moving...
 
- Where is the gyro information of ahrs_propagate put together with accel
info to generate the so called C.F? I can notice ahrs_propagate integrates
the gyro and that ahrs_update_accel uses accel measurements, but where is
the line of code that puts all of them together for roll and pitch
estimations?

The accel update stores a measurement, which is used in the propagation to compute a residual and correct the attitude.
 
- Why is it made a rotation from IMU to BODY always after ahrs_init,
propagates, etc? Can't it be used always the estimations in IMU and only
make the final rotation to BODY after all calculations?

That basically what is done. The attitude output is only written in propagate and then the body to imu correction is applied.
However note that the euler version does not fully support large IMU to body rotatons, see https://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Complementary_Euler_.28fixed_point.29
 
- Finally, I assume that the functions go in this order: Init, Align,
Propagate, update_accel, update_mag. Is that correct? If yes, what is the
name of the variable containing the final att estimations that are uploaded
to the estimator and sent to telemetry?

Init first of course, then it is aligned when the aligner is done lowpassing the values.
Propagate is the "main" function that integrates the gyros and applies the corrections,
but depending on the frequency that your accel and mag provide new measurements they might not come after every propagate...
Especially the mag has a lower freq usually...

Output (in v5.4) is in ahrs_impl.ltp_to_imu_euler, but that is rotated to body frame first before it's sent to the state interface:
https://github.com/paparazzi/paparazzi/blob/v5.4/sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler.c#L319

Cheers, Felix

_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




--
Flávio Justino


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel