-
Notifications
You must be signed in to change notification settings - Fork 356
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
base: master
Are you sure you want to change the base?
Conversation
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.)
…kilrah/remotegains
nice work, i will have to give it a try |
The idea is not so bad, implementation not so. |
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... |
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(). something like rgain or whatever, maybe using human-readable stuff for mode/dest... but not bloating stuff up TOO badly. yanno. |
Good idea. Something like
With mode, source and dest as plain text. Much cleaner indeed. |
Idea and initial implementation by viktor80. Closes multiwii#96.
@kilrah: I'd love to revive this if there is still interest ;) |
I have merged the work you have done so far into the current master. Maybe we can go from there? |
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...
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
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.