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

Plane: Differential spoilers support, elevon offset #2935

Closed

Conversation

ethomas997
Copy link
Contributor

This is a resubmit of PR #2137 , applied to ArduPlane v3.4.1dev as of 2015-10-03.

Fixes ArduPlane differential spoilers when ELEVON_MIXING=0 and ELEVON_OUTPUT>0 (mixing done in flight controller). All flight modes are supported. This functionality is used on flying wings with "split elevons" using two servos on each side. In v3.2-v3.4.0 of ArduPlane, differential spoilers are non-operational (see issue #1032). This patch fixes them so they operate as described in the ArduPlane docs: http://plane.ardupilot.com/wiki/differential-spoilers

Added parameter: DSPOILR_RUD_RATE "Differential spoilers rudder rate"
Sets the amount of deflection that the rudder output will apply to the differential spoilers, as a percentage. The default value of 100 results in full rudder applying full deflection. A value of 0 will result in the differential spoilers exactly following the elevons (no rudder effect).

Added parameter: MIXING_OFFSET
The offset for the Vtail and elevon output mixers, as a percentage. This can be used in combination with MIXING_GAIN to configure how the control surfaces respond to input. The response to aileron or elevator input can be increased by setting this parameter to a positive or negative value. A common usage is to enter a positive value to increase the aileron response of the elevons of a flying wing. The default value of zero will leave the aileron-input response equal to the elevator-input response.

Notes: The new parameter DSPOILR_RUD_RATE allows the rudder effect to be "toned down." Otherwise it can be too easy to apply too much rudder-spoiler control and stall the wing. The new parameter MIXING_OFFSET allows the elevon mixing on a wing to be tuned so that the "aileron" effect is greater than the "elevator" effect. Flying wings are usually pitch-sensitive while being difficult to roll, so this tuning is desirable.

I have successfully tested this patch (on APM2) in a 47" Popwing, in Manual, Stabilized, and GPS-guided flight modes. I've flown it (on APM2) with the patch applied to ArduPlane v3.3.0. I've bench tested the patch, applied to ArduPlane v3.4.0, on Pixhawk.

Source and hex files are also posted here: http://www.etheli.com/APM/ArduPlane_etMod_DiffSpoilersFix

Here is sample set of parameters for testing the new functionality:

DSPOILR_RUD_RATE,75
ELEVON_OUTPUT,2
MIXING_OFFSET,75
RC5_FUNCTION,16
RC5_MAX,1900
RC5_MIN,1100
RC5_REV,1
RC6_FUNCTION,17
RC6_MAX,1900
RC6_MIN,1100
RC6_REV,1

The four servos are plugged into RC1, RC2, RC5 and RC6. One thing to watch out for is that the RC5_MIN, RC5_MAX, RC6_MIN and RC6_MAX parameters can be modified when a radio calibration is performed. If this happens, they should be restored to values like the ones above.

--ET

@gmorph
Copy link
Contributor

gmorph commented Nov 25, 2015

I have checked out the code, rebased on master and built the code and tested and its not working for me. I will try to determine why.

@magicrub
Copy link
Contributor

Grant, did you rebase master? Did the original code work?
On Nov 24, 2015 9:28 PM, "Grant Morphett" notifications@github.com wrote:

I have built the code and tested and its not working for me. I will try to
determine why.


Reply to this email directly or view it on GitHub
#2935 (comment).

@gmorph
Copy link
Contributor

gmorph commented Nov 25, 2015

I had rebased master (see my comment above).
The original code only works with the old ELEVON_MIXING which is why we want this patch which uses the new ELEVON_OUTPUT.
Regardless I now have it working. I changed a BUNCH of things and it started working. Reset everything I changed and it still works. I HATE that. I have obviously done something with my setup to fix it but I'm not sure what. At any rate I'm putting it on a physical plane now to check its ok.

@gmorph
Copy link
Contributor

gmorph commented Nov 25, 2015

MIXING_OFFSET is a generic parameter name. Do we think it should change to something a bit more specific? I don't have any great ideas - what about - WING_MIXING_OFFSET? Hmmm, I don't really like that either. Thoughts?

@gmorph
Copy link
Contributor

gmorph commented Nov 25, 2015

Note the tabbing in the files isn't great. A lot of the comments are offset from the code. Would be nice if that could be fixed.

@ethomas997
Copy link
Contributor Author

I called the new parameter MIXING_OFFSET to match up with the existing parameter MIXING_GAIN.

--ET

ch2 += abs(channel_rudder->servo_out);
ch4 -= abs(channel_rudder->servo_out);
}
//get rudder value and multiply by DSPOILR_RUD_RATE/100:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block doesn't need to be here as its only called for the old ELEVON_MIXING configuration which we don't really want to change as its legacy code.

@gmorph
Copy link
Contributor

gmorph commented Nov 25, 2015

Hi ET. First thanks for submitting this PR. I know its been a long road for you as you have had to rebase a couple of time and resubmit the PR. We are nearly there!
Are you able to make the code updates I commented on above? If so I'll test the minute its ready and we will get these code changes into Master as we do need them.
Thanks, Grant.

@ethomas997
Copy link
Contributor Author

Sure, I should be able to work on it over the next few days.

--ET

@gmorph
Copy link
Contributor

gmorph commented Nov 25, 2015

That's great ET - thanks! I look forward to testing the new code.

@ethomas997
Copy link
Contributor Author

I've updated it to use 'set_servo_out()', which supports the RC REV/MIN/MAX/TRIM settings. Added constraints to keep the generated values in the 900-2100 range, which matches what is in the existing elevon-mixing code. Reverted the legacy 'ELEVON_MIXING 1' code back to original (except removed tab chars).

Setting the RC MIN/MAX values for the differential-spoiler channels to 900/2100 should yield matching outputs on the spoilers vs. the elevons. Here is an updated set of sample parameters for testing:

DSPOILR_RUD_RATE,75
ELEVON_OUTPUT,2
MIXING_OFFSET,75
RC5_FUNCTION,16
RC5_MAX,2100
RC5_MIN,900
RC5_REV,1
RC5_TRIM,1500
RC6_FUNCTION,17
RC6_MAX,2100
RC6_MIN,900
RC6_REV,1
RC6_TRIM,1500

--ET

@gmorph
Copy link
Contributor

gmorph commented Dec 2, 2015

Just a note that we really prefer whitespace changes as a separate commit. I know it seem's overly fussy but it makes our job much easier when we have to review loads of commits at release time.

@ethomas997
Copy link
Contributor Author

@gmorph Point taken on the whitespace commits. Do you want me to do an additional commit on this PR that reverses that bit of whitespace mod? (It just affects about 5 lines of code.) In general I see this PR as ready.

--ET

@magicrub
Copy link
Contributor

What's the status of this? @gmorph ? Has it been flown?

@magicrub magicrub modified the milestones: Plane v3.5.0, Plane 3.4.1 Dec 15, 2015
@magicrub magicrub changed the title Plane: Differential spoilers support, elevon offset v3.4.1dev Plane: Differential spoilers support, elevon offset Dec 15, 2015
@kwikius
Copy link
Contributor

kwikius commented Dec 24, 2015

Looks great, however wouldnt a general purpose HAL mixer be a better approach?

regards
Andy

@ethomas997
Copy link
Contributor Author

Rebased to master 2016-01-23

@ethomas997
Copy link
Contributor Author

Oops, I think I accidentally swapped in the older version when I rebased. It should have the updated version now, and I rebased it to the current master (2016-02-11).

--ET

@magicrub
Copy link
Contributor

It will be great when it goes in. Been a long time! Thanks for taking the time @gmorph to get this through!

}
//change elevon 1 & 2 positions; constrain min/max:
channel_roll->radio_out = constrain_int16(ch1,900,2100);
channel_pitch->radio_out = constrain_int16(ch2,900,2100);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather then the hardcoded values for max and min PWM of 900 and 2100 its better to use the max and min for that channel. So
channel_roll->radio_min, channel_roll->radio_max
channel_pitch->radio_min, channel_pitch->radio_max

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in my Nov 29th comment, the constraints to keep the generated values in the 900-2100 range match what is in the existing elevon-mixing code (see line 698 with the comment "scale for a 1500 center and 900..2100 range, symmetric"). The channel-min/max values are applied later in the 'set_servo_out()' calls, yes?

@ethomas997
Copy link
Contributor Author

I've processed modified sections through 'astyle' (to conform comment indentations, etc), and rebased to current master 2016-02-20.

--ET

@marvinlange
Copy link

Could this possibly Be used for Differential thrust in twin engine Wing

@iskess
Copy link

iskess commented Mar 8, 2016

See #1861 for twin motor plane

@marvinlange
Copy link

Until this is finish if I just added some flap like vertical spoilers to my the verticals on my flying wings tips will the apm use them as rudder yaw when elvon mixing is enabled ? or enabled dose it just forget about yaw control ? the reason I ask as I had a pan servo hooked up on the rudder channel had to change channel as it would turn by its self
2016-03-08 00 06 22
2016-02-16 14 54 38

Fixed differential spoilers support, added elevon offset
See PR ArduPilot#2935
@ethomas997 ethomas997 force-pushed the etMod_DiffSpoilersFix1_v3.4.1 branch from 8699b5e to c3e6a6e Compare April 27, 2016 05:12
@ethomas997
Copy link
Contributor Author

Rebased to current master (2016-04-26) and changes put into single commit.

@gmorph As far as I can tell this is ready for merging. Please let me know if something else needs to be done with it on my end.

--ET

@magicrub
Copy link
Contributor

magicrub commented Jun 6, 2016

@ethomas997 you've been a champ keeping up on this PR with the rebases. Sorry it's taking so long. @tridge Let's try and get this into v3.6.0 if we can.

@magicrub
Copy link
Contributor

magicrub commented Jun 6, 2016

@ethomas997 are you able to do a rebase soon? Perhaps also a wiki entry? We'd like to get this merged ASAP

gmorph pushed a commit to gmorph/ardupilot that referenced this pull request Jun 7, 2016
Fixed differential spoilers support, added elevon offset
See PR ArduPilot#2935
@gmorph
Copy link
Contributor

gmorph commented Jun 7, 2016

I have rebased on master, made the necessary fixes and tested it again on my plane on the ground. It works correctly. I submitted a new PR for it #4283 but you will still get the commit credit Thomas. Thanks for your patience.
Thanks, Grant.

magicrub pushed a commit that referenced this pull request Jun 7, 2016
Fixed differential spoilers support, added elevon offset
See PR #2935
@magicrub
Copy link
Contributor

magicrub commented Jun 7, 2016

merged, thanks! (7d82424)

@magicrub magicrub closed this Jun 7, 2016
@WickedShell
Copy link
Contributor

There is a report of someone having trouble getting their elevons to work correctly with plane 3.6 but that they work fine with plane 3.5 so I'm wondering if this is related? http://discuss.ardupilot.org/t/3-6-elevons-mixing-gain-mixing-offset-cant-get-proper-throw/9648

@magicrub
Copy link
Contributor

Possibly. Should be able to see with the other guys params.
On Jun 12, 2016 1:53 PM, "WickedShell" notifications@github.com wrote:

There is a report of someone having trouble getting their elevons to work
correctly with plane 3.6 but that they work fine with plane 3.5 so I'm
wondering if this is related?
http://discuss.ardupilot.org/t/3-6-elevons-mixing-gain-mixing-offset-cant-get-proper-throw/9648


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#2935 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AEj7Gz25fsA0TVXspu89l_wMlnj8_Fspks5qLHHlgaJpZM4GIi6l
.

@jgilbertfpv
Copy link
Contributor

I got here by following a different post asking about what i was looking for as well, but i don't seem to see any relation. i have differential spoilers and crowing one side at a time with yaw working on a fx-79 buffalo flying wing, now how do i also get both sides to crow for landing flaps?

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.

9 participants