-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Channel limits, generic mixer and channel remapper #2869
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
base: master
Are you sure you want to change the base?
Conversation
if gyros should be mixed like this, shouldn't one have possibility to use one of the channels as weight as well? |
Full resoulution channels can go from 885us to 2135us and the current failsafe configuration storage isn't large enough to hold it. By using a larger field for failsafe we no-longer need to use a 988 constant sprinkled through the codebase.
Seems similar to #2671 |
Except that was extending the hardware page, not the model page, which is where it actually belongs. This would not only enable the gyro branch to progress further, but also cater for the "one model" crowd somewhat, as more of the model differences can be handed on the RX side. One think to keep in mind is there is also some interest being able to support a wider output range than 885us to 2135us, specifically 500us to 2500us in #2773, to allow continuous rotation and wider movement servos to be used without additional hardware. |
@pfeerick said
Perhaps this could be handled by increasing a mixer weight to over 100%, so 150% to reach what ever PWM timing required? |
95cc5b9
to
689a6e7
Compare
I think this would also be suitable for me. I'm also looking for a range of 500-2500 us. Wouldn't it make sense to have two columns for MAX min and MAX max values? So that the input value first gets transformed by weight and then cutoff to the MAX and MIN values. This would basically allow the user to create any output PWM that's supported by the hardware. Well, I could also enforce these limits by exactly calculating my weight. Same could be done for a gyro though, once you know it's max and min values, together with the other max and min input, you could calculate the weight that's within the valid range. These signals also seem difficult to debug. Can I somehow see the input and output of the RX? I don't know if it's a common use-case. But let's say I have a normal servo, however physically it can turn 180°, that makes the 500-2500 range. Now I believe the best way to kill a servo is to give it a position that's out of bounds and some proper current. So I would like to configure my range to be 600-2400. I know these numbers, I could just enter them in the online thing. For the weights, I just increase them step by step. Now if I can only configure weights, I need to check my TX for it's min and max values, put them into a calculator to figure out the weight to have it in a 600-2400 range. That's a formula I always forget. Do I really need to know it, when I just want to drive/fly something? |
I have been testing the gyro branch and plan on using it extensively, so this gets a +1 from me. I do have some old models that use the Radiolink Byme-A gyro, which has flight mode configured via channels 5 and 7 and it cannot be changed. So this mixer allows me to output channel 6 from the TX to channel 5, and use channel 5 on tx for arm so I can use dynamic power and have it work correctly. The mixer is overkill for this, but it's still a welcome addition. So far I bench tested it and seems to be working great, will fly it tomorrow. I can also imagine setting up a model for a friend or as a club trainer where simple TX setup would be desirable. |
Swapped my model with the Byme-A over to an RP3-H so I could use the PWM receiver on a different model, and I am not seeing channel mixer coming up on the Model in webui, or the output mapping in the lua. Am I dowing something wrong or is mixer only enabled for PWM rx currently? |
Answered my own question by looking at the diffs. MIXER is only defined for ESP32 platform. Can this be enabled for ESP8285 as well? |
This PR solves this issue: #2584 |
Co-authored-by: Bryce Allen <bryce@bda.space>
I too desire the ability to output 500-2500us |
@awigen Hi There, i just flashed your generic-mixer branch to a BetaFPV PPM receiver. Thanks a lot for your work. |
i did some tests and it works great. One strange thing: I did all my tests with an RM ER5C-i. The settings of the RX is coming up after flashing (flashing by ExpressLRS Configurator via WiFi) with the "pull request" firmware (3.5.1 was installed before) are compleatly stupid and always different (did several swaps between regular and pull request firmware). |
@derFrickler |
Yes, you are right, works flawless, problem was that that my servo limits were totally messed up due to the settings were from another firmware. Thanks a lot! |
one more bug: |
No personal experience, but have helped a user set it up. Overall the mixer seems very well structured and behaves similar to implementations like EdgeTX. Perhaps a note or a tooltip could be added specifying the ranges(and that negative weights invert?) |
RFC - Adding a generic mixer
This PR adds prerequisites for receiver gyro support, primarily to be used for stabilization of airplanes and cars.
Having a generic receiver mixer is however very useful in many cases.
The gyro devlopment happens here: https://github.com/awigen/ExpressLRS
Full resolution failsafe
Full resolution channels can go from 885us to 2135us and the current failsafe configuration storage isn't large enough to hold it.
The current failsafe configuration is stored in the EEPROM as a 10-bit value and a magic constant of 988us is used to convert it to the appropriate units.
To allow a failsafe to any valid channel range, this PR converts the failsafe configuration to an 11-bit value and removes the magic constant.
Channel limits
When controlling servo outputs it's important to limit the range of motion of the servo to avoid binding and possible damage. When gyro support is added it is no longer possible to limit the servo range solely from the transmitter as the gyro will add to the channel commanded position.
This PR adds a channel limits to channels.
TODO: Change the way the limits are applied so that we map the input range 0-100% to the new limited output range. This would mean the servo limit only needs to be set once on the receiver, the transmitter should just use default 100% limits.
The downside to this approach is that the limits can not be adjusted on the transmitter without using forward programming with lua.
Generic mixer
To support gyro functionality, a mixer is needed to add the gyro output to the channel output. A generic mixer is also useful for other scenarios, some examples are:
TODO: Add logical conditions to the mixer.
Receiver gyro support
With the addition of the prerequisites, gyro support can be added to the receiver. See my https://github.com/awigen/ExpressLRS/tree/gyro-with-mixer branch for the current state of this work.