Cleanflight aka Multiwii port to STM32 F10x and F30x

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

XeCutor wrote:It seems I probably jumped to conclusions. It turns out the aux tab (running the 5-pos firmware + configurator) has failed to function for me completely, be it over usb or bluetooth when it comes to saving values. It turns out that it starts working again if I "feature -GPS" and stops working again if I enable GPS.


that's very odd indeed. i shouldn't worry anyway since i'm doing the new range code this weekend and hope to have that tested soon.

XeCutor
Posts: 15
Joined: Tue Sep 23, 2014 9:06 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by XeCutor »

I went "back" to the 3-pos type firmware using the latest on github yesterday and all my problems seem gone, I can save stuff regardless if GPS is active or not and it seems to work over bluetooth as well. The only thing that doesn't work for me, and it seems you're aware, is in EZ-GUI on my phone, but that doesn't matter. I don't need to change aux values that frequently.

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

XeCutor wrote:I went "back" to the 3-pos type firmware using the latest on github yesterday and all my problems seem gone, I can save stuff regardless if GPS is active or not and it seems to work over bluetooth as well.


that's great, thanks for confirmation.

XeCutor wrote:The only thing that doesn't work for me, and it seems you're aware, is in EZ-GUI on my phone, but that doesn't matter. I don't need to change aux values that frequently.


yes, that is correct, there are two open issues on the github issue tracker relating to detecting of cleanflight and aux configuration.

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

Spent a little more time on the UI this evening:

ui with active modes and channel indicators.PNG


It now shows active modes and channel positions. here you can see that arm and camstab are enabled (due to switch positions) and that i've not yet saved my changes for angle, horion and mag modes (they're still grey, not red or green).

The code for this is currently living here: https://github.com/cleanflight/cleanfli ... its/ranges

It's not finished yet but it's coming along very nicely.

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

OK! channel mode ranges is ready for testing!

latest binary attached - download configurator as zip file from here: https://github.com/cleanflight/cleanfli ... ree/ranges

The code for the configurator and firmware are not yet in the master branch, that will happen after a few more tweaks to the configurator and some test reports - please test!

I'm uploading a video showing how it works, check the cleanflight youtube channel in a couple of hours - please subscribe if you haven't already!

If you are going to test, please backup your config first and flash with full chip erase enabled. Advisable to take a screenshot of your current aux configuration for reference.
Attachments
cleanflight_NAZE-59c55b4a19fac71b2a0376c8a9b9ce99c75b88a9.zip
(97.66 KiB) Downloaded 281 times

Mrimstad
Posts: 2
Joined: Mon Oct 13, 2014 8:22 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by Mrimstad »

Looks good on the aux part.

I have an issue with auto tune, Might just be that i dont understand fully how this works :P
I get autotune to start, but once it gets going the craft keeps on gaining altitude fast to the point where i have to shut the auto tune off.
Or can i still controll throtle wile its going without it effecting the autotune?

Also once i got to a place where i could lett it do its own i lett i finnish but the craft went on to be so twitchy i could not even bring it down in once piece.
Any advice ? or should i just keep on manual tuning for now?

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

Mrimstad wrote:I have an issue with auto tune, Might just be that i dont understand fully how this works :P
I get autotune to start, but once it gets going the craft keeps on gaining altitude fast to the point where i have to shut the auto tune off.
Or can i still controll throtle wile its going without it effecting the autotune?

Also once i got to a place where i could lett it do its own i lett i finnish but the craft went on to be so twitchy i could not even bring it down in once piece.
Any advice ? or should i just keep on manual tuning for now?


start at a low altitude with less throttle that you would normally use for hovering, that should stop it rising so much. it does seem however that the autotune isn't great, in my experience it never detects an undershoot/overshoot (can't remember which) and keeps increasing P. With regards to it being twitchy afterwards, if you has pressed the autotune switch again it would have reset the pid values which would have let you fly it as it was before - as per the docs.

https://github.com/cleanflight/cleanfli ... utotune.md

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

Here's a video showing the channel mode ranges in action!



https://www.youtube.com/watch?v=WXsZWLdUwwY

Mrimstad
Posts: 2
Joined: Mon Oct 13, 2014 8:22 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by Mrimstad »

Thanks for the advise. Guess il hold of on the auto for now.
It flyes ok on stock pids anyway :)

hwurzburg
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by hwurzburg »

dominicclifton wrote:Here's a video showing the channel mode ranges in action!



https://www.youtube.com/watch?v=WXsZWLdUwwY

Looks great Dominic!

A suggestion: Perhaps it would be good to make this AUX behavior an expanded feature, ie FEATURE EXPANDAUX, keeping the old three way operation as is, in addition to this new feature...
that would allow backward compatibility with the MultiWii EZGui app(until it catches up), and with old BF CLI dumps, as people, hopefully, migrate from BF to Cleanflight...

thanks for the work!

hwurzburg
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by hwurzburg »

SONAR Questions:

1. Someone posted a video on the NAZE32 thread showing SONAR operating from the motor pins with PPM feature enabled....the docs imply that PPM requires it to be connected to the RC7/8 pins.
2. That video showed that SONAR could be used WITHOUT BARO and that it would switch to normal throttle above the SONAR max alt range...is this correct? its useable with or without using BARO?

thanks

nebbian
Posts: 67
Joined: Mon Jul 21, 2014 6:54 am

Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by nebbian »

hwurzburg wrote:SONAR Questions:

1. Someone posted a video on the NAZE32 thread showing SONAR operating from the motor pins with PPM feature enabled....the docs imply that PPM requires it to be connected to the RC7/8 pins.
2. That video showed that SONAR could be used WITHOUT BARO and that it would switch to normal throttle above the SONAR max alt range...is this correct? its useable with or without using BARO?

thanks


That might have been me :)

The changes I implemented allow:
1) Sonar to use motor pins 5 &6 if parallel PWM Receiver signals are used
2) A separate flight mode for sonar control even if you don't have a baro sensor.

So the 1. you posted isn't correct to the best of my knowledge, but 2. is.

I hope this helps.

EDIT: Sorry, that wasn't me who posted the video. The comments above are still relevant though.
Last edited by nebbian on Mon Oct 13, 2014 1:41 pm, edited 1 time in total.

nebbian
Posts: 67
Joined: Mon Jul 21, 2014 6:54 am

Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by nebbian »

Question about the cleanflight configurator:

Is there a way to run it on a tablet?

I'm hoping to be able to get a tablet to connect to my quad via bluetooth, and be able to change PIDs etc while flying.

I've gotten the bluetooth part to work, and I can do all of this on my macbook (laptop).

I know at there are a couple of apps that speak multiwii, but as cleanflight seems to be going further and further down its own path, I was wondering what the options were for running the recommended configurator on a small device.

I've had a look at a couple of android devices, but to the best of my knowledge it can't run chrome apps. Is this correct?

Any help would be appreciated :)

hwurzburg
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by hwurzburg »

Except for the AUX setup,until the app catches up or backward compatibility is restored, MultiWii EZGUI will let you do about anything the config will except flash firmware...
it runs on any Android OS....even has the CLI function

hwurzburg
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by hwurzburg »

nebbian wrote:
hwurzburg wrote:SONAR Questions:

1. Someone posted a video on the NAZE32 thread showing SONAR operating from the motor pins with PPM feature enabled....the docs imply that PPM requires it to be connected to the RC7/8 pins.
2. That video showed that SONAR could be used WITHOUT BARO and that it would switch to normal throttle above the SONAR max alt range...is this correct? its useable with or without using BARO?

thanks


That might have been me :)

The changes I implemented allow:
1) Sonar to use motor pins 5 &6 if parallel PWM Receiver signals are used
2) A separate flight mode for sonar control even if you don't have a baro sensor.

So the 1. you posted isn't correct to the best of my knowledge, but 2. is.

I hope this helps.

I posted a note on that thread re #1....thanks

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

hwurzburg wrote:SONAR Questions:

1. Someone posted a video on the NAZE32 thread showing SONAR operating from the motor pins with PPM feature enabled....the docs imply that PPM requires it to be connected to the RC7/8 pins.
2. That video showed that SONAR could be used WITHOUT BARO and that it would switch to normal throttle above the SONAR max alt range...is this correct? its useable with or without using BARO?

thanks


hi,

1) sonar can be connected to motor outputs when parallel pwm is used, or to the rc7/8 inputs when ppm/serial rx is used - the docs in the repo detail the connections correctly for each board that it has been tested on.
2) yes, there is a new flight mode to allow sonar without a baro.

do you have a link to the video?

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

hwurzburg wrote:A suggestion: Perhaps it would be good to make this AUX behavior an expanded feature, ie FEATURE EXPANDAUX, keeping the old three way operation as is, in addition to this new feature...
that would allow backward compatibility with the MultiWii EZGui app(until it catches up), and with old BF CLI dumps, as people, hopefully, migrate from BF to Cleanflight...

thanks for the work!


Hi, backwards compatibility is not planned, if you really need it add an issue to the issue tracker and say why. It's technically possible, conversation from irc:

Code: Select all

[21:33] <stronnag> Hydra: I was under the (mis)apprehension that you were keeping the legacy stuff (BOX / SETBOX) for degenerates with old software and 3 pos switches. I was evidently mistaken.
[22:18] <Hydra_> i was thinking about adding backwards compatibility in, if people want it then we can raise a ticket.
[22:19] <Hydra_> if all the ranges fall on the 900/1300/1700/2100 boundaries then it could be backwards compatible to some extent (max 40 checkboxes ticked)
[22:20] <Hydra_> but then there would need to be logic in the FC that checked the ranges and additional implementations for the old MSP_BOX/MSP_SET_BOX commands


and there would also have to be code somewhere to port old configuration values, and check that a mix of old ranges and new ranges is not used, and check that no more than 40 ranges are used, and so on. all of which takes lots of time AND bloats the GUI and firmware code. Don't forget that all that logic needs to be tested, all the varitions add testing overhead and when things go wrong having lots of configuration options only complicates solving the problem. better to keep it simple. I think there 's more important things to do right now, such as attending to the other issues in the issue tracker :D :D

keeping the old code in the firmware is not an option due to ram/flash usage.

It's trivial to migrate your settings too, i did it on my CJMCU quad and it took less than 30 seconds given a screenshot of my old config.

also, ezgui has been incompatible with aux settings since i added the 8 channel support months ago but no-one mentioned that being a problem :D

the author of ezgui expressed a desire to support cleanflight, the new commands let him do that, there's also new msp commands coming up for cleanflight in addition to the ones recently added to baseflight (which I will rework, since MSP_(SET)_CONFIG is not well designed and not focused to doing one thing).

so, given all the above i see backwards compatibility with MSP_BOX/MSP_SET_BOX unlikely unless enough people complain.

nebbian
Posts: 67
Joined: Mon Jul 21, 2014 6:54 am

Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by nebbian »

dominicclifton wrote:
hi,

1) sonar can be connected to motor outputs when parallel pwm is used, or to the rc7/8 inputs when ppm/serial rx is used - the docs in the repo detail the connections correctly for each board that it has been tested on.
2) yes, there is a new flight mode to allow sonar without a baro.

do you have a link to the video?


http://youtu.be/seVDPjSFRrE

alastairseggie
Posts: 4
Joined: Sun Aug 31, 2014 9:18 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by alastairseggie »

Dominic,

I have done lots of searching and can't find any definitive answers on cleanflights support of one shot. From what I have found it is not currently supported and I can't find any indication that it will be supported in the future.

Could you shed some light on the subject? Is it something that's on the radar for future development?

I am busy building a LOS quad and I have just ordered some KISS ESC's from flyduino but I fear that I will have to revert to one of the newer Multiwii FC'S that support One shot.

Alastair

pS I would offer to have a go myself at felix's code but I would need lots of help, The only experience I have with coding is arduino and even then it was just modifying existing code.

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

alastairseggie wrote:Dominic,

I have done lots of searching and can't find any definitive answer.


One shot support is not on my radar. Please open an issue on the issue tracker and provide details as to what it is, why you need it, example product links and links to source / implementations. If someone wants to take up the challenge of adding it please get in contact with me and we can progress things.

franko_
Posts: 15
Joined: Tue Apr 16, 2013 7:56 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by franko_ »

Hi Dominic,

i have your latest hex flashed to my NAze32 Rev3 and want to enable Telemtry, but it´s not working.
I have a FRSKY D8R-II RX and enabled RX_PPM/GPS/SOFTSERIAL/TELEMETRY

Set´s are
frsky_inversion = 1
telemetry_provider = 0

When these Parameters are enabled my GPS lost Signal.
I have soldered softserial pins 5/6 .. (how can i add those pins in cli?), or 7/8?

Opentx (9x with telemtry mod not tested regarding gps lost signal, but telemtry RSSI is working)

Hope you can help me
BR
Frank

alastairseggie
Posts: 4
Joined: Sun Aug 31, 2014 9:18 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by alastairseggie »

dominicclifton wrote:
alastairseggie wrote:
One shot support is not on my radar. Please open an issue on the issue tracker and provide details as to what it is, why you need it, example product links and links to source / implementations. If someone wants to take up the challenge of adding it please get in contact with me and we can progress things.


Will do thanks

Here is an explination of the concept of oneshot PWM by its original author.
http://www.multiwii.com/forum/viewtopic.php?f=7&t=2729

It is a function that is available with the KISS http://flyduino.net/KISS-ESC-2-4S-18A_1 and Ultra ESC's in combination with some MultiWii FC's. As to why it is needed, it provides a faster update to the ESC and hence better control of the ESC/aircraft.

Source code from multiwii http://ultraesc.de/downloads/MWC21nanoSetupChromeAppGUI_0991.zip

I will add this to the issue tacker later
Last edited by alastairseggie on Sat Oct 18, 2014 12:16 am, edited 4 times in total.

hwurzburg
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by hwurzburg »

franko_ wrote:Hi Dominic,

i have your latest hex flashed to my NAze32 Rev3 and want to enable Telemtry, but it´s not working.
I have a FRSKY D8R-II RX and enabled RX_PPM/GPS/SOFTSERIAL/TELEMETRY

Set´s are
frsky_inversion = 1
telemetry_provider = 0

When these Parameters are enabled my GPS lost Signal.
I have soldered softserial pins 5/6 .. (how can i add those pins in cli?), or 7/8?

Opentx (9x with telemtry mod not tested regarding gps lost signal, but telemtry RSSI is working)

Hope you can help me
BR
Frank

https://github.com/cleanflight/cleanfli ... aster/docs
read the serial and naze32bd docs

nebbian
Posts: 67
Joined: Mon Jul 21, 2014 6:54 am

Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by nebbian »

hwurzburg wrote:Except for the AUX setup,until the app catches up or backward compatibility is restored, MultiWii EZGUI will let you do about anything the config will except flash firmware...
it runs on any Android OS....even has the CLI function


Thanks for the info, but that really doesn't answer my question.

Is there a way to get cleanflight configurator running on a tablet?

ArrogantDuck
Posts: 17
Joined: Tue Jul 15, 2014 7:59 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by ArrogantDuck »

Now, no.

nebbian
Posts: 67
Joined: Mon Jul 21, 2014 6:54 am

Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by nebbian »

ArrogantDuck wrote:Now, no.


Many thanks, that's what I was after :)

TimJC
Posts: 4
Joined: Thu Aug 07, 2014 9:15 pm
Location: Cincinnati, OH, USA

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by TimJC »

nebbian wrote:
ArrogantDuck wrote:Now, no.


Many thanks, that's what I was after :)

Nebbian,
Cheap Windows 8.1 Intel powered tablets are starting to hit the market. My local PC shop has a house branded 8" tablet for $100-140 that should be capable of running Configurator Chrome app, though probably nothing else at the same time.

Intel and Microsoft want in the tablet market badly. Intel is paying manufacturers to make tablets using their chips, just to get some market share. Microsoft, likewise, is offering 1-year subscriptions to Office365 with Windows tablet purchases.

Availability in your country may vary, but if you looking for a tablet for just what you have described, it should be possible. Toshiba and Acer are two bigger companies that are making these products, so it might be easier to find them locally.

Keep in mind that you would need a tablet running an Intel x86 processor (not an ARM processor), and full Windows 8 (not the defunct Windows RT). A USB port would be helpful too, but most have Bluetooth as well.

franko_
Posts: 15
Joined: Tue Apr 16, 2013 7:56 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by franko_ »

hwurzburg wrote:
franko_ wrote:Hi Dominic,

i have your latest hex flashed to my NAze32 Rev3 and want to enable Telemtry, but it´s not working.
I have a FRSKY D8R-II RX and enabled RX_PPM/GPS/SOFTSERIAL/TELEMETRY

Set´s are
frsky_inversion = 1
telemetry_provider = 0

When these Parameters are enabled my GPS lost Signal.
I have soldered softserial pins 5/6 .. (how can i add those pins in cli?), or 7/8?

Opentx (9x with telemtry mod not tested regarding gps lost signal, but telemtry RSSI is working)

Hope you can help me
BR
Frank

https://github.com/cleanflight/cleanfli ... aster/docs
read the serial and naze32bd docs


Thx, now it´s working :-)

How can i add more agility and less drift in curves/straight flight?
It flies well, but i mean more acc brake, where can i find these settings?

THX
Frank
Last edited by franko_ on Thu Oct 16, 2014 7:06 pm, edited 1 time in total.

dfruehwald
Posts: 26
Joined: Wed Feb 20, 2013 1:08 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dfruehwald »

About to join you all in the 32-bit world.

Have a Flip32+ on its way. I assume I just need to download the latest Chrome browser for Windows 7 in order to use the configuration utility. Anything I need to know flashing cleanflight onto the board when it arrives?

I'm setup to flash the Atmega based boards (328, 32u4, Mega) and OpenTX so I assume I have the right tools installed somewhere.

User avatar
stronnag
Posts: 114
Joined: Thu Oct 24, 2013 9:32 pm
Location: New Forest, England
Contact:

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by stronnag »

You just need the Chrom(ium|e) for your chosen OS to enjoy the awesomeness of cleanflight. Just make sure you enable the "Full chip erase" option in order to exorcise what ever firmware the vendor may have left on the device.

dfruehwald
Posts: 26
Joined: Wed Feb 20, 2013 1:08 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dfruehwald »

Thanks, I'm pretty sure it will be preloaded with the other 32-bit port that is not harakiri. So yes an exorcism will be required upon arrival.

Ralf_E
Posts: 1
Joined: Tue Jul 22, 2014 9:36 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by Ralf_E »

Is it posible to flash STM32F3Discovery with Cleanflight Configurator or only with ST-Link or DFU?

fiendie
Posts: 151
Joined: Fri Apr 20, 2012 4:22 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by fiendie »

dfruehwald wrote:Thanks, I'm pretty sure it will be preloaded with the other 32-bit port that is not harakiri. So yes an exorcism will be required upon arrival.

Only one of those is a port, though. 2 of them are forks of a port.

Also no need to invoke the supernatural, it won't make your quad fly any better.

jmdhuse
Posts: 3
Joined: Sat Oct 18, 2014 6:42 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by jmdhuse »

Hello nebbian,

I'm looking at adapting this software to a flight controller that uses a micro with hardware floating point, so I'm also interested in this PID controller...

In studying the three PID controllers in the cleanflight "flight.c" module, I noticed something that I can't figure out and I wondered if you could shed some light on it.

I am looking at the relative ranges of the variables used to calculate the error between rate commanded by the stick and rate measured by the gyro... In the two PID controllers that are inherited from MultiWii (pidMultiwii and pidRewrite), we see scaling on rcCommand[] and gyroData[] that results in a ratio of somewhere between 7 and 10...

Example:
If rcCommand[] has a range of +/-500, and the MPU6040 gyro has a range of +/-32800, we see rcCommand[ROLL] being scaled by 27/16, with a resulting range of +/-843. gyroData[] is divided by 4, with a resulting range of +/-8200. Finally, this gives us a ratio of 8200/843 = 9.73, which suggests that response to gyro variations is about 10 times greater than the response to stick commands (assuming rollPitchRate = 0).

If we look at the same situation in the floating point "pidBaseflight" controller, we see that rcCommand[ROLL] is scaled by 20/50, with a resulting range of +/-200, and the gyroDat[] value is used without scaling, so it has a range of +/-32800. This gives us a ratio of 32800/200 = 164.

This difference in ratio suggests that the pidBaseflight controller is much, much more sensitive to gyro rate than it is to the stick command rate. I'm wondering if this means that in order for this PID controller to work in a similar fashion to the two integer-math controllers, you need to have yawRate and rollPitchRate cranked up to something like 64, so that the rate ratio is in a similar ballpark?

Since you've flown with this PID Controller and I haven't, did you find the stick rate values had to be much greater than with the "stock" PID controllers?

Sorry for the picky-sticky detail... and thanks for any light you can shed on this for me...

Cheers, Jon.


nebbian wrote:
dominicclifton wrote:
Yes to the video and Yes to the Tuneup! Please chat to Lux as I'm sure he'd be very interested in your findings.



Here's a video I made today, apologies for the wind noise in the microphone...

... video snipped out...

dominicclifton wrote:His code can be found here, https://github.com/luggi


Awesome, thanks. I've been in contact and will take this further with him.

nebbian
Posts: 67
Joined: Mon Jul 21, 2014 6:54 am

Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by nebbian »

jmdhuse wrote:Hello nebbian,

I'm looking at adapting this software to a flight controller that uses a micro with hardware floating point, so I'm also interested in this PID controller...

In studying the three PID controllers in the cleanflight "flight.c" module, I noticed something that I can't figure out and I wondered if you could shed some light on it.

I am looking at the relative ranges of the variables used to calculate the error between rate commanded by the stick and rate measured by the gyro... In the two PID controllers that are inherited from MultiWii (pidMultiwii and pidRewrite), we see scaling on rcCommand[] and gyroData[] that results in a ratio of somewhere between 7 and 10...

Example:
If rcCommand[] has a range of +/-500, and the MPU6040 gyro has a range of +/-32800, we see rcCommand[ROLL] being scaled by 27/16, with a resulting range of +/-843. gyroData[] is divided by 4, with a resulting range of +/-8200. Finally, this gives us a ratio of 8200/843 = 9.73, which suggests that response to gyro variations is about 10 times greater than the response to stick commands (assuming rollPitchRate = 0).

If we look at the same situation in the floating point "pidBaseflight" controller, we see that rcCommand[ROLL] is scaled by 20/50, with a resulting range of +/-200, and the gyroDat[] value is used without scaling, so it has a range of +/-32800. This gives us a ratio of 32800/200 = 164.

This difference in ratio suggests that the pidBaseflight controller is much, much more sensitive to gyro rate than it is to the stick command rate. I'm wondering if this means that in order for this PID controller to work in a similar fashion to the two integer-math controllers, you need to have yawRate and rollPitchRate cranked up to something like 64, so that the rate ratio is in a similar ballpark?

Since you've flown with this PID Controller and I haven't, did you find the stick rate values had to be much greater than with the "stock" PID controllers?

Sorry for the picky-sticky detail... and thanks for any light you can shed on this for me...

Cheers, Jon.


nebbian wrote:
dominicclifton wrote:
Yes to the video and Yes to the Tuneup! Please chat to Lux as I'm sure he'd be very interested in your findings.



Here's a video I made today, apologies for the wind noise in the microphone...

... video snipped out...

dominicclifton wrote:His code can be found here, https://github.com/luggi


Awesome, thanks. I've been in contact and will take this further with him.

Hi JMD,

I found that the stick rate values were all pretty close between the three controllers. I certainly didn't have to crank up the rates noticeably higher on one than the other.

I hope this helps, good luck with your project.

jmdhuse
Posts: 3
Joined: Sat Oct 18, 2014 6:42 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by jmdhuse »

nebbian wrote:
jmdhuse wrote:Hello nebbian,

I'm looking at adapting this software to a flight controller that uses a micro with hardware floating point, so I'm also interested in this PID controller...

In studying the three PID controllers in the cleanflight "flight.c" module, I noticed something that I can't figure out and I wondered if you could shed some light on it.

I am looking at the relative ranges of the variables used to calculate the error between rate commanded by the stick and rate measured by the gyro... In the two PID controllers that are inherited from MultiWii (pidMultiwii and pidRewrite), we see scaling on rcCommand[] and gyroData[] that results in a ratio of somewhere between 7 and 10...

Example:
If rcCommand[] has a range of +/-500, and the MPU6040 gyro has a range of +/-32800, we see rcCommand[ROLL] being scaled by 27/16, with a resulting range of +/-843. gyroData[] is divided by 4, with a resulting range of +/-8200. Finally, this gives us a ratio of 8200/843 = 9.73, which suggests that response to gyro variations is about 10 times greater than the response to stick commands (assuming rollPitchRate = 0).

If we look at the same situation in the floating point "pidBaseflight" controller, we see that rcCommand[ROLL] is scaled by 20/50, with a resulting range of +/-200, and the gyroDat[] value is used without scaling, so it has a range of +/-32800. This gives us a ratio of 32800/200 = 164.

This difference in ratio suggests that the pidBaseflight controller is much, much more sensitive to gyro rate than it is to the stick command rate. I'm wondering if this means that in order for this PID controller to work in a similar fashion to the two integer-math controllers, you need to have yawRate and rollPitchRate cranked up to something like 64, so that the rate ratio is in a similar ballpark?

Since you've flown with this PID Controller and I haven't, did you find the stick rate values had to be much greater than with the "stock" PID controllers?

Sorry for the picky-sticky detail... and thanks for any light you can shed on this for me...

Cheers, Jon.


nebbian wrote:Hi JMD,

I found that the stick rate values were all pretty close between the three controllers. I certainly didn't have to crank up the rates noticeably higher on one than the other.

I hope this helps, good luck with your project.


Doh! (sound of hand slapping head...) I see where I messed up... the error term uses the gyro reading after being converted to actual DPS units, not in it's raw form... this makes the ratio more like 2000/200 = 10, which is just where it ought to be...

Sorry for the inconvenience!

Cheers, Jon.

User avatar
leocopter
Posts: 101
Joined: Mon Jan 27, 2014 7:29 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by leocopter »

Hi,
I'm running the latest CleanFlight FW with PPM, GPS, telemetry and display enabled. I plugged an OLED display on I2C (http://www.banggood.com/0_96-Inch-I2C-I ... 22246.html) ... and ... nothing. No display. I tried another board (with the same FW) and a second OLED ... nada.
Any idea on what's the problem ? (there is power on the I2C header, the OLED supports 3 to 5 V ...).
Attachments
IMG_2014101916270.jpg

dklein
Posts: 7
Joined: Sun Nov 25, 2012 2:15 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dklein »

Just wanted to say thanks. I was looking for a way to get bluetooth, GPS, telemetry/OSD all running at once on a naze32 and stumbled over here. Here's a vid of the first flight on a new quad. The acro flying and alt and GPS hold were all great. I'll have to try the rth again. http://youtu.be/OTUt5fgjMfM

41south
Posts: 28
Joined: Tue Jun 26, 2012 11:44 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by 41south »

Hi Dominic and all

I have an older green (rev2??) Naze32 full board that has quite happily been running Cleanflight - until I updated it today to the latest version. Now all it does is alternate the red/green leds and won't connect to the configurator or reflash. If I short the bootloader pins and flash the latest BF it works fine so does not appear to be a hardware problem. Any ideas appreciated, I'd like to get it back running CF. Can I download an earlier version from somewhere and see where it breaks?

I loaded up a rev 5 board with the same latest version and it's fine so it looks like a firmware/hardware combo issue perhaps.

Many thanks.

bektorkhan
Posts: 10
Joined: Wed May 07, 2014 3:41 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by bektorkhan »

leocopter wrote:Hi,
I'm run I plugged an OLED display on I2C. nada.
Any idea on what's the problem ? (there is power on the I2C header, the OLED supports 3 to 5 V ...).


I have had some issues with the I2C bus.. the pullup on most Naze32 boards are 1k ohm which in my opinion is to small I changed mine to 2K7 to get my external Baro & Mag to work.

The I2C address is 0x3C according to an review on bangood, and thats what the software uses. Some other displays have had address 0x3D.

So that should work, looks like this module has an internal voltage regulator, so you should supply 5V as Vcc.

bektorkhan
Posts: 10
Joined: Wed May 07, 2014 3:41 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by bektorkhan »

Thanks Dominic and others for your great work..
And for fixing BMP180 (BMP085) driver so now my external BARO (GY-68) works.. updated from trunk .. and whoops.. awesome!!
Might try to oversample a bit more since it's drifting a bit, better than BMP085 though!

Been switching GPS modules and is the Sat signal table active or is a feature to come?

shufflez
Posts: 42
Joined: Sat Nov 19, 2011 5:26 pm
Location: Amsterdam, Netherlands

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by shufflez »

41south wrote:Can I download an earlier version from somewhere and see where it breaks?


Hi, there's an unofficial Jenkins server @ http://ci.esav.dy.fi/job/Cleanflight/.
Maybe you can find a version that works for older revision board there, please report if you have.

41south
Posts: 28
Joined: Tue Jun 26, 2012 11:44 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by 41south »

shufflez wrote:
41south wrote:Can I download an earlier version from somewhere and see where it breaks?


Hi, there's an unofficial Jenkins server @ http://ci.esav.dy.fi/job/Cleanflight/.
Maybe you can find a version that works for older revision board there, please report if you have.


It breaks after #149 October 7th

Its can also take 3 or 4 goes to flash successfully - which may be another issue. For now I'm glad that I have CF back on the board but it would be great to know what broke.

Now of course the problem is that I need to find the old configurator :evil: :evil: Just 2 words - backward compatibility .... please :?
Last edited by 41south on Thu Oct 23, 2014 11:34 pm, edited 1 time in total.

shufflez
Posts: 42
Joined: Sat Nov 19, 2011 5:26 pm
Location: Amsterdam, Netherlands

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by shufflez »

Thanks for testing 41south! Hopefully Hydra and other devs follow the thread :)
Can you log an issue in Github? Just to be sure mention the configurator in the case too.

41south
Posts: 28
Joined: Tue Jun 26, 2012 11:44 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by 41south »

shufflez wrote:Thanks for testing 41south! Hopefully Hydra and other devs follow the thread :)
Can you log an issue in Github? Just to be sure mention the configurator in the case too.


Done

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

41south wrote:Its can also take 3 or 4 goes to flash successfully - which may be another issue.


This is worrying and may be the cause of your problems, perhaps the flash is worn out on your old board? I would like someone else to confirm there is a problem with the latest code on the rev2 board.

whakahere
Posts: 20
Joined: Wed Jan 30, 2013 9:17 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by whakahere »

I agree with the green board failure. I just tried with mine and it also now flashes blue to red after using the latest cleanflight.

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by dominicclifton »

whakahere, can you please try using some older versions from here and see if you can find the newest version that works

http://ci.esav.dy.fi/job/Cleanflight/

does anyone have a spare rev2 board they can send me?

cosmic2112
Posts: 13
Joined: Thu Dec 05, 2013 12:58 am

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by cosmic2112 »

Okay, I guess I am a little behind here, I have updated one of my Naze32 boards to CF and notice now that we have a complicated set sliders instead of tick boxes.

I have a simple switch configuration, just two, three way switches, one for 3 flight modes the other for lost madel alarm, I used to tick a couple of boxes and I'm done - not any more.

How do I get the tick box configuration back?

Is it possible to have simple/complex AUX switch setups for those who just need a simple setup?

I have tried the MultiWii GUI which still has the tick boxes but that does not set anything, does not seem compatable any more with CF.

In the CLI the AUX channels asre now like this:-

aux 0 0 0 900 900
aux 1 0 0 900 900
......etc

what do all the numbers mean and can I set up the switch asignment in the CLI, then copy and paste each time I do an upgrade?


Cosmic

User avatar
stronnag
Posts: 114
Joined: Thu Oct 24, 2013 9:32 pm
Location: New Forest, England
Contact:

Re: Cleanflight aka Multiwii port to STM32 F10x and F30x

Post by stronnag »

See the modes documentation on the cleanflight wiki.

On linux, you can use mwptools/switchedit that maps the slider abomination back to MW compatible tick boxes, however you have to specify that it cleanflight as another gratuitously unnecessary change makes auto-detection impossible.

Yes you can save the aux CLI settings, at least until the next non-backwards compatible change.

Post Reply