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

Remote gain adjustment support #96

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

kilrah
Copy link

@kilrah kilrah commented Apr 28, 2014

It's the thing I was missing the most in the otherwise great baseflight FW, all my other FCs have an inflight gain adjustment feature... so there it is.

Obviously setting everything in the CLI is not the most convenient way, but it works for now if you know what you're doing. Ideally it should be in the GUI, I've had a little try at it but my lack of web-oriented programming skills is badly showing. I can probably get the backend done but I keep breaking the display layout, I don't understand much about CSS...

config

I noticed since then that we could reuse the pidnames[] array and just append P, I, D to populate the dropdowns, that way we're sure the destinations will match.


For the Wiki or other user doc:

The remote gain adjustment feature is turned on with:
feature REMOTEGAINS

It presents 4 "remote gain adjusters" that can be configured through the CLI and each have the following settings (x is 1-4):
rg_x_mode
rg_x_min
rg_x_max
rg_x_source
rg_x_dest

rg_x_mode: How this adjuster works. 0=disabled, 1=enabled by an AUX position, 2=enabled when unarmed, 3=always enabled. If set to 1, you will need to choose in which AUX channel position(s) the adjustment is enabled in the GUI "Auxiliary Configuration", and it is recommended to use the failsafe feature (feature FAILSAFE) especially if you have enabled adjustment in a MED AUX position to avoid unwillingly triggering gain adjustment when no valid RC signal is present.
rg_x_min: Min value of the adjusted parameter when the selected AUX channel is at minimum pulse width.
rg_x_max: Max value of the adjusted parameter when the selected AUX channel is at maximum pulse width.
rg_x_source: Which AUX channel is used to adjust the parameter. Range 1-4 for AUX1-AUX4.
rg_x_dest: Which parameter should be adjusted. Linked to the PID table, see enum in mw.h. Currently, 0-9 are P terms of ROLL, PITCH, YAW, ALT, POS, POSR, NAVR, LEVEL, MAG, VEL. 10-19 are the I terms of the same, 20-29 are the D terms of the same, and 30 is TPA Rate.

So for example with:
set rg_2_mode = 1
set rg_2_min = 20
set rg_2_max = 150
set rg_2_source = 2
set rg_2_dest = 1

clipboard01

RG2 will adjust PITCH_P between 20 and 150 based on AUX2's position when enabled by AUX1 HIGH.

Important notes:
The remote gain adjustments are done in RAM, and are not saved into EEPROM automatically. Connecting to the GUI, going to the PID Tuning page, refreshing and saving is required. It's a good idea to do it to review the result anyway. Be aware that entering and exiting CLI WILL also save everything. Until saved cycling power to the board will reload the previous values.

Change source range to 1..4 for clearer mapping to AUX1..AUX4
…hould think more instead of just doing like the others (aka OP).
… position, which is true at startup before we have a valid rc signal e.g. if radio is off, we'd screw up the gains with the fake 1500 input. Powering up the radio could bring the enable out of range before the source channels are valid, essentially making it unnoticeable that the gains were screwed up even when the enable switch was always off.)
@hydra
Copy link
Contributor

hydra commented Apr 28, 2014

nice work, i will have to give it a try

@trollcop
Copy link
Member

trollcop commented May 2, 2014

The idea is not so bad, implementation not so.
Especially the gratuitous abuse of set= stuff in cli. surely there's gotta be a better way to do this.

@kilrah
Copy link
Author

kilrah commented May 2, 2014

All the CLI stuff could be removed once supported in the GUI. It makes little sense being in the CLI indeed, but in the absence of GUI support something was needed to test and use. Even if it's kludgy I've been able to fine tune my mini H in flight which is what I wanted - and when I told others about it there was a rush of "I want too!!" so...
Isn't it valid for the whole CLI thing anyway? I wondered why the mix of CLI and GUI, why can't we jsut set everything in the GUI - assumed it was more like a "move in progress" and the CLI would disappear at some point. If it's not the intended path, then it means not having a GUI is an option and there needs to be a way of setting everything through the CLI...

@trollcop
Copy link
Member

trollcop commented May 2, 2014

No, cli stuff for this would be neat, but I think it would be much better served by its own command instead of adding hard-to-understand numbers to set().
The command could also do range checking and other stuff, to prevent users from setting idiotic stuff.

something like rgain or whatever, maybe using human-readable stuff for mode/dest... but not bloating stuff up TOO badly. yanno.

@kilrah
Copy link
Author

kilrah commented May 3, 2014

Good idea. Something like

rgain num mode source min max dest

With mode, source and dest as plain text. Much cleaner indeed.
I can implement if you're happy with that.

ChrisNisbet01 pushed a commit to ChrisNisbet01/baseflight that referenced this pull request Oct 20, 2014
Idea and initial implementation by viktor80.  Closes multiwii#96.
@fiendie
Copy link
Member

fiendie commented Mar 15, 2015

@kilrah: I'd love to revive this if there is still interest ;)

@fiendie
Copy link
Member

fiendie commented Mar 16, 2015

I have merged the work you have done so far into the current master. Maybe we can go from there?
fiendie@d42a3d1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants