So I thought, why not have the radio break itself in... if nothing else, it would be a nice way to fiddle with custom switches and get that figured out.
So I hot glued a couple of servos onto the radio, and connected them to the troublesome stick with some craft stick linkages. I left some slop in the connections so that nothing would bind.
It moves the sticks around pretty well. I'll let it go for a couple of hours and see if it helps the centering.
BUT, the important thing is that it's a good example of using custom switches.
Here's how to set this up.
First, we need to cover a bit about Custom Switches. A custom switch is a logical or virtual switch that can take on a value of -100 or 100, similar to a two-position physical switch. You define logical rules defining when the switch is on or off. You can typically compare two values... one stick is higher than a certain value, a telemetry value is lower than some limit, etc.
So, if we create a custom switch like this:
CS2 CH01 > 100
then Custom Switch 2 will be 100% when channel 1 is more than 100% (counting the scaling).
Now let's make a channel that will flip off and on:
CH15 (+110%)CS1
R (-110%)MAX Switch(CS2)
R (+110%)MAX Switch(CS3)
And finally, let's look at the channel controlling the servo:
CH01 (+100%)CH15 Slow(u0.8:d0.8)
Once CH01 is all the way down, then CS3 becomes true, setting CH15 to +115% by its third mix rule. This causes CH01 to be set to +115%, but of course it takes .8 seconds to move to that value.
CS1 is necessary to kick things off. If CH01 is not outside of the range -115% to 115%, then CS1 will be either false or true depending on the values of CH01 and CH15. The actual values of these channels don't matter... if CH01 is less than CH15, then CH01 will start moving down and eventually cause CS3 to become true. Otherwise, CH01 will start moving up and eventually cause CS2 to become true. In either case, the logic picks up as above.
Whew, that's really hard to explain in words! Think of it like this:
- When starting out, CH01 and CH15 may be random. CS1 handles these cases, and sends CH01 to -115% or 115%.
- When CH01 is less than -100%, CS3 kicks in and sends CH01 to 115%
- When CH01 is greater than 100%, CS2 kicks in and sends CH02 to -115%
Here's the final result. Thanks to w4kac for proofreading assistance!
Mixes:
CH01 (+100%)CH15 Slow(u0.8:d0.8)
CH02 (+100%)CH16 Slow(u0.9:d0.9)
CH03 (+100%)Rud
CH04 (+100%)Ail
CH15 (+110%)CS1
R (-110%)MAX Switch(CS2)
R (+110%)MAX Switch(CS3)
CH16 (+110%)CS4
R (-110%)MAX Switch(CS5)
R (+110%)MAX Switch(CS6)
Custom Switches:
CS1 CH01 < CH15
CS2 CH01 > 100
CS3 CH01 < -100
CS4 CH02 < CH16
CS5 CH02 > 100
CS6 CH02 < -100
Thanks for sharing. You rock.
ReplyDelete