Thread Tools
This thread is privately moderated by DigitalEntity, who may elect to delete unwanted replies.
Sep 05, 2015, 07:30 PM
Build, fly, crash, repeat :-D
DigitalEntity's Avatar
Download

Cleanflight iNav (navigation-rewrite) project


History behind iNav
I was flying Cleanflight for some while and I always wonvered why CF's navigational capabilities are so limited? Why RTH is unaware of altitude, why no possibility to RTH on FAILSAFE event, why altitude hold is very imprecise? For a while I struggled to improve things that are already there, but eventyally I realised that gps and althold code was very difficult to improve without changing most of it.

Around May 2015 I've started a project to rewrite navigation framework for cleanflight from scratch keeping things clean and modular.

My intention is improve the current "official" Cleanflight with advanced navigation functions and eventually merge everything back into Cleanflight.

Quick summary of main features:
- Legacy BARO, SONAR, GPS PH, GPS RTH modes are removed and replaced by ALTHOLD, POSHOLD and RTH modes
- Gyro and accelerometer FIR filtering
- Quaternion IMU logic for Level modes. More precision, less drift and faster performance
- Advanced INS/GPS position estimation for best accuracy
- Advanced accelerometer and magnetometer calibration
- Smart RTH (return to home) that would use the safe altitude to return home - avoid the trees and buildings - and land
- RTH on failsafe (radio signal loss)
- Waypoints and fully autonomous missions (work in progress)

iNav has different config settings and simply restoring old backup will result in poor performance!

iNav have changed some key settings, even if your experienced Cleanflight user you need to read the Wiki!

INAV Configurator for Chrome:
https://chrome.google.com/webstore/d...igkpdnpdhopgel

Documentation / Wiki / Read THIS:
https://github.com/iNavFlight/inav/wiki

iNav on GitHub:
https://github.com/iNavFlight/inav

Gitter chat channel:
https://gitter.im/iNavFlight/inav

Support IRC Channel:
#inavflight on Freenode

Donations
iNav is opensource and available free of charge to everybody. If you like iNav and find it useful, you can support future development by making a donation.



Or maybe you can give recurring support by pledging on my Patreon page.

Last edited by DigitalEntity; Nov 11, 2016 at 05:36 AM.
Sign up now
to remove ads between posts
Sep 05, 2015, 10:31 PM
Registered User
Fanastic! I need to get my props on and give this a test.

Is this based on current Cleanflight master, or is this based on the released version of 9.0 with only your changes?

One question that has come up in other threads is that the GPS-assisted modes do not work well if the mag is behaving poorly.

I've got some Blackbox logs from a recent flight, and the MAG seems to jump around a bit, but I don't know if it is acceptable or not. If I uploaded that here, would you be able to offer an opinion? I'd like to test this code, but want to be sure I'm starting off in a good place.

Also - I've currently been flying PID Controller 3. Does the PID Controller have an impact on the GPS-assisted flight modes?

And finally - does this work with the standard current Cleanflight configurator? I'm wondering if the mode selection in the GUI is different.

Thanks,

John
Sep 05, 2015, 11:11 PM
Build, fly, crash, repeat :-D
DigitalEntity's Avatar
Hi John!
Quote:
Originally Posted by JohnOCFII
Is this based on current Cleanflight master, or is this based on the released version of 9.0 with only your changes?
My code is currently few weeks behind Cleanflight master. I usually update to latest master when Hydra merges something significant.

Quote:
Originally Posted by JohnOCFII
I've got some Blackbox logs from a recent flight, and the MAG seems to jump around a bit, but I don't know if it is acceptable or not.
A 5-10 deg heading variance when tilting the copter is acceptable, just be sure to set your declination properly. If you are from Minnesota you're lucky to have declination of almost 0 deg, so you could leave it alone

Please send me a blackbox log, I'll have a look at it and see if your MAG looks fine to me.

Quote:
Originally Posted by JohnOCFII
Also - I've currently been flying PID Controller 3. Does the PID Controller have an impact on the GPS-assisted flight modes?
And finally - does this work with the standard current Cleanflight configurator? I'm wondering if the mode selection in the GUI is different.
I've tested this with PID Controller 5 (Harakiri), but other controllers should do just fine.

You can use the same configurator, there is a patched configurator to reflect changes to PID tuning scale, but I've done it mostly for myself to see actual values firmare uses in calculations.

Mode selection is completely different. No need to enable MAG mode or ANGLE mode explicitly, firmware will do that for you.

Can you share your setup? I'm testing this on 1kg 450-class quad with about 2x thrust-to-weight ratio (FC is MWC Paris AirHero32 + NEO-6M GPS + BMP180 baro)
Sep 06, 2015, 12:36 AM
Registered User
Awesome !! I will test this ASAP !! Thanks for your effort !!
Sep 06, 2015, 02:44 AM
Registered User
Mariete's Avatar
Great news!

Tank you very much for implementing this. :-)

Will this work also for fixed wings?
Sep 06, 2015, 03:18 AM
Build, fly, crash, repeat :-D
DigitalEntity's Avatar
Quote:
Originally Posted by Mariete
Great news!
Tank you very much for implementing this. :-)
Will this work also for fixed wings?
So far it works only for multicopters but I have fixed wing support in mind
Some of fixed-wing related code is already there - altitude hold _might_ work, you can test it and report if it works.
Sep 06, 2015, 03:21 AM
Registered User
M_3one's Avatar
Subscribed!
Sep 06, 2015, 05:29 AM
Registered User
Boris B's Avatar
Maybe interresting to add this in my betaflight project?
Sep 06, 2015, 06:38 AM
Build, fly, crash, repeat :-D
DigitalEntity's Avatar
Quote:
Originally Posted by Boris B
Maybe interresting to add this in my betaflight project?
That's a great idea, but my code is changed very frequently (almost on daily basis), it would be hard to maintain the up-to-date builds. If you think we still can do this, please advise what I should do from my side?
Sep 06, 2015, 07:26 AM
Registered User
Boris B's Avatar
Quote:
Originally Posted by DigitalEntity
That's a great idea, but my code is changed very frequently (almost on daily basis), it would be hard to maintain the up-to-date builds. If you think we still can do this, please advise what I should do from my side?
We can modify that one together I guess. If we both have authorization to the same repository. Should be possible.
There is a huge amount of people who are testing it and the feedback is enormous. It can only improve the future of cleanflight and it's stability.
Sep 06, 2015, 07:33 AM
Build, fly, crash, repeat :-D
DigitalEntity's Avatar
Quote:
Originally Posted by Boris B
We can modify that one together I guess. If we both have authorization to the same repository. Should be possible.
There is a huge amount of people who are testing it and the feedback is enormous. It can only improve the future of cleanflight and it's stability.
I like the idea. We should try it! Just let me clean up the code a bit, so there won't be much new features, just bugfixing. I still have to figure out landing detection, test RTH and get waypoints working to some level. Shouldn't take more than a month now I guess. After that I'd be ready to merge this to Betaflight for extensive testing and propose a PR to Hydra for merging to official.
Sep 06, 2015, 07:40 AM
Registered User
Boris B's Avatar
Quote:
Originally Posted by DigitalEntity
I like the idea. We should try it! Just let me clean up the code a bit, so there won't be much new features, just bugfixing. I still have to figure out landing detection, test RTH and get waypoints working to some level. Shouldn't take more than a month now I guess. After that I'd be ready to merge this to Betaflight for extensive testing and propose a PR to Hydra for merging to official.
Cool. My main goals for flight improvements in cleanflight are also reached. From now on I also might focus to clean up some some things within cleanflight.
Who knows it might even be part of cleanflight master code by then.
We will see.
Sep 06, 2015, 07:44 AM
Registered User
Boris B's Avatar
I am interrested in your 3 point median filter for delta in pid1. Did that give any improvements?

Also it would be great to put a floating median function in maths.c perhaps?
Sep 06, 2015, 08:21 AM
Registered User
Quote:
Originally Posted by DigitalEntity
CLI parameters affecting POSHOLD mode:
nav_user_control_mode - can be set to "0" (GPS_ATTI) or "1" (GPS_CRUISE), controls how firmware will respond to roll/pitch stick movement. When in GPS_ATTI mode, right stick controls attitude, when it is released, new position is recorded and held. When in GPS_CRUISE mode right stick controls velocity and firmware calculates required attitude on its own.
Thanks for all your hard work. Really appreciate it. I've been following you on github ever since you posted that you are working on this.

I was wondering if you could please explain the above a little bit better. I'm not sure I understand the difference and how they work.

In GPS_ATTI mode is that similar to loiter mode? Where if I use the cyclic control I can move the multirotor around it's axis and once I let go and the stick goes back to neutral it will just stay in that position? If so, what is GPS_CRUISE? Is it just speed control? Not sure I understand.

Thank you,
Vadim
Sep 06, 2015, 08:27 AM
Registered User
do these nav features work on any pid controller?

and is there dodobaro support on the F3 hex?
Last edited by johnzm; Sep 06, 2015 at 09:18 AM.