EdgeTX / edgetx

EdgeTX is the cutting edge open source firmware for your R/C radio
https://edgetx.org
GNU General Public License v2.0
1.44k stars 309 forks source link

Disable trainer function on master movement #4837

Open LeanderVanhulle opened 1 month ago

LeanderVanhulle commented 1 month ago

Is there an existing issue for this feature request?

Is your feature request related to a problem?

Trainer function is now enabled/disabled by a switch. As an instructor I'm using the momentary switch on my TX16 and hold this until i need to take over the control. If something happens I'll first need to release (or switch) the switch and only then the trainer function is disabled and my own inputs take over the plane/drone.

Describe the solution you'd like

I would like an option to disable the trainer function on master stick movement. Especially on the ailerons/elevator sticks. The trainer function would we switched off until it's enabled again.

Describe alternatives you've considered

I wrote a whole list of special functions that takes into account the difference of the trainee input and my sticks and compare this to the actual outputs. If there is a difference the trainer function is switched off. But due to the slow calculation the trainer function is also switched off if the student moves it's sticks fast from left to right.

Additional context

I've not used Spectrum transmitters but i believe these have this function.

AJHAJHAJH commented 1 month ago

I think close what you want is already achievable. Perhaps this will help: https://www.rcgroups.com/forums/showpost.php?p=50716867&postcount=9470

LeanderVanhulle commented 1 month ago

I've tested the proposed solution and it indeed seems to work. The only thing is that after deactivating and activating the trainer mode again, you can't disable it by stick movement in the first 3-5 seconds. It seems like the act function isn't triggering again if it was triggered before.
Second issue i have with the solution is that the ACT is reacting on any input, not only stick movement. So if i scroll the screen it deactivates, if I for example touch a switch to retract the landing gear, it also deactivates the trainer function.

That's why i would propose a different solution or have the ACT function split up by for example the act_stick to have only stick movement and not switches or other buttons.

shadowjig commented 1 month ago

I'd actually like to take this request a step further. There are two options for trainer input (sticks or channels). Channels requires that the entire model configuration needs to copied from the master TX to the student TX. I think that it's completely unnecessary to copy the model config to the student TX. Furthermore, it may not even be an option if the student TX is a non-EdgeTX/OpenTX capable transmitter.

In my opinion, the best trainer config is stick mode. Because it removes the need to copy the config to the slave transmitter. But an issue arises when using sticks mode and setting up a quick takeover via logical switches.

The issue: Set the master TX to use sticks trainer mode, and setup logical switches to enable a quick take over (i.e. use a physical switch enables trainer mode, and movement on the right stick disables trainer mode). Once the student moves the sticks on the student TX, the trainer mode on the master TX is disabled (which makes sense). However, I think the stick movement from the student TX should be inserted after the master TX stick input, but before the master TX mixes are applied. That would allow for a quick takeover function to work when trainer mode on the master TX is set to sticks mode.

Ralf-W commented 4 weeks ago

You can set the master TX to Sticks Mode, and ADD the commands from the student Tx sticks. Now defining a free mixer channel to be the difference between this combined Sticks signal and the signals "TRx" coming from the students sticks. This difference does create a signal that is purely representing the input from your trainer sticks. Use it to trigger quick takeover:

Logical switch Mixer channel Special function Trainer

I tested it on the bench - and it seems to work as expected.

mha1 commented 4 weeks ago

creative thinking!

LeanderVanhulle commented 3 weeks ago

I tried this solution before and had 2 issues with it: 1) Adding thrust with add gives the uses only 50% thrust if you set your stick down. Else you really need to hold it still in the center to to interfere with this solution as thrust isn't self centering. 2) if the trainer remote is moving sticks fast from left to right the trainer is deactivated. It seems then that the remote isn't calculating the differences fast enough.

I know you guys try to find an existing solution but they don't work and An easy option should be in the OS.

pfeerick commented 3 weeks ago

While complicated, this is probably the best solution I've seen so far for quick takeback

https://youtu.be/030liiCDXYY?si=QME5NQLFTHBY_b9C&t=437

basically you monitor all four sticks for more than a certain amount of change, and then you just OR them together until you get a single LS you can use as your 'master wants control' takeover condition.

However, what is clear from some of issues that have been raised is that there is room for improvement for trainer options, so that might be an area to focus on soon generally.

LeanderVanhulle commented 3 weeks ago

While complicated, this is probably the best solution I've seen so far for quick takeback

https://youtu.be/030liiCDXYY?si=QME5NQLFTHBY_b9C&t=437

basically you monitor all four sticks for more than a certain amount of change, and then you just OR them together until you get a single LS you can use as your 'master wants control' takeover condition.

However, what is clear from some of issues that have been raised is that there is room for improvement for trainer options, so that might be an area to focus on soon generally.

This seems the best workaround so far for the missing features in Edge TX. Thank you for the idea. But still a simple solution for the system should be created. As now you'll need to add 6 logical switches to every model to use the trainer function. This might be faster by putting them on higher LS numbers and copy the json entries in the model files on a pc. But that's not really user friendly.

Several solutions of fixing the issue in my opinion:

Solution 1: Just having 2 addtional function triggers next to the current ACT trigger (that triggers on any input on the controller, even touchscreen):

ACT_JOY_L => triggers on movement of the left joystick ACT_JOY_R => triggers on movement of the right joystick

Advantage: Use SF to disable a sticky trainer enabled function. You can decide to use one of the sticks or both in an OR function

Disadvantage: Small movements might trigger the ACT is it does now. Still need to add several SF an LS entries to each model

Solution 2:

As @shadowjig suggested add the trainer stick inputs after the own inputs and before the mixer. This allows to differentiate the master stick movement from the student stick movement.

Advantage: Use SF to disable a sticky trainer enabled function. You can decide to use one of the axis of the sticks or combine them in an OR function A minimum movement can be set before triggering the LF.

Disadvantage: Still need to add several SF an LS entries to each model

Solution 3:

Having additional options in the System settings to disable the trainer on movement of the sticks. There should be like a small list where you can set the conditions. These can be specific trainer conditions or maybe global Logical functions. The trainer function could then still be enabled with a SF on a switch but then 'pauzed' or 'disabled' by stick movements.

Advantage: User chooses on what stick movements the trainer function is deactivated. As it's a system setting it can be applied to all models in the controller with adding single SF. Users can easy choose to pauze or disable student inputs by moving the sticks by choise.

Disadvantage: System options need to be created an might conflict with current OS architecture.

I think the third option would be the best but also the most complex to integrate. I don't know if this would be feasible by the developers.

shadowjig commented 3 weeks ago

I appreciate the out of the box thinking and problem solving. But I agree with @LeanderVanhulle that these features need to be rolled into the OS at this point. There has been quick take over solutions available for some time now (using logical switches), but it's time to roll that functionality into the OS and reduce the need to create multiple logical switches.

I think these are some good example of features to implement:

sande005 commented 3 weeks ago

All of this, of course, must be an optional configuration. I shadow fly my students continuously, so when I release the trainer switch my controls are already in the preferred position. Having only "quick take back" would be detrimental to my ability to assume control.

gagarinlg commented 3 weeks ago

All of this, of course, must be an optional configuration. I shadow fly my students continuously, so when I release the trainer switch my controls are already in the preferred position. Having only "quick take back" would be detrimental to my ability to assume control.

Same here