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

examples/sensor_fusion: Support for Madgwick Fusion lib and example #2113

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

fdcavalcanti
Copy link
Contributor

Summary

This PR adds support for the Madgwick Algorithm (Sensor Fusion Library) and adds an example that uses this lib with the MPU6050.
The library is under Application Configuration -> Inertial Libraries Support and requires MIT licenses to be enabled.
The example is available under Application Configuration -> Examples -> Sensor Fusion Example.

On compilation, it downloads the Fusion library from Github and the header files can be accessed using:
#include "Fusion/Fusion.h""

Next PRs should add board example and the example code will support other IMUs.

Shout out to @acassis for helping to set up the library entries!

Impact

New entry on Application Configuration and new example is available. This can be useful for those who use NuttX to control drones.

Testing

Testing works fine using MPU6050 on a Tiva-C development board.
I need some assistance on linter issues. Not sure how to solve the following error due to the Fusion library naming convention:

root@DESKTOP-G6CVIMP:~/nuttxspace/nuttx# ./tools/checkpatch.sh -f ../nuttx-apps/examples/sensor_fusion/sensor_fusion_main.c
/root/nuttxspace/nuttx-apps/examples/sensor_fusion/sensor_fusion_main.c:78:2: error: Mixed case identifier found

On sensor_fusion_main.c

  FusionAhrs ahrs;
  FusionAhrsInitialise(&ahrs);

Any ideas on how to fix this?

@xiaoxiang781216
Copy link
Contributor

@fdcavalcanti Mixed case could be ignored for the 3rd party library. But please fix other ci issue.

examples/sensor_fusion/sensor_fusion_main.c Show resolved Hide resolved
examples/sensor_fusion/sensor_fusion_main.c Show resolved Hide resolved
examples/sensor_fusion/sensor_fusion_main.c Outdated Show resolved Hide resolved
inertial/Kconfig Outdated Show resolved Hide resolved
examples/sensor_fusion/sensor_fusion_main.c Show resolved Hide resolved
@fdcavalcanti
Copy link
Contributor Author

Thanks for the code review!
All issues addressed. Only the mixed case issue on 3rd party library remains.

examples/sensor_fusion/sensor_fusion_main.c Outdated Show resolved Hide resolved
examples/sensor_fusion/sensor_fusion_main.c Outdated Show resolved Hide resolved
examples/sensor_fusion/sensor_fusion_main.c Outdated Show resolved Hide resolved
examples/sensor_fusion/sensor_fusion_main.c Outdated Show resolved Hide resolved
@fdcavalcanti
Copy link
Contributor Author

Thanks again for the review @xiaoxiang781216
It would be great if someone could validate this using the MPU6050. I'm getting some bad readings on mine, I believe it might be on its last legs..

@xiaoxiang781216
Copy link
Contributor

xiaoxiang781216 commented Oct 17, 2023

please add Kconfig to the .gitignore like other similar folder to fix the following warning:

HEAD detached at pull/2113/merge
Untracked files:
	inertial/Kconfig

@fdcavalcanti
Copy link
Contributor Author

Gitignore added.

Working read from mpu6050 - fixed makefile issues

Succesfull yaw pitch roll reads

Linter fixes - still erroring on mixed case

Added inertial lib

Fixed makefile to use inertial lib

Kconfig fix
@acassis acassis merged commit 36a9ccc into apache:master Oct 19, 2023
24 of 25 checks passed
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

Successfully merging this pull request may close these issues.

4 participants