mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-824 Add CameraStab Elevon-type mixing. Redo servo reversing.
This commit is contained in:
parent
5e2aeeea76
commit
8104ae25dd
@ -241,19 +241,29 @@ static void attitudeUpdated(UAVObjEvent* ev)
|
||||
if (cameraStab.GimbalType == CAMERASTABSETTINGS_GIMBALTYPE_ELEVONSSGYAWPITCHROLL) {
|
||||
float elevon_pitch;
|
||||
elevon_pitch = output;
|
||||
output = (elevon_pitch + elevon_roll) / 2;
|
||||
CameraDesiredRollOrServo1Set(&output);
|
||||
// elevon reversing works like this:
|
||||
// first use the normal reversing facilities to get servo 1 working in the correct direction
|
||||
// for both roll and pitch
|
||||
// then use the new reversing switches to reverse servo 2 roll and/or pitch as needed
|
||||
if (cameraStab.ElevonSSGServo2RollReverse == CAMERASTABSETTINGS_ELEVONSSGSERVO2ROLLREVERSE_TRUE) {
|
||||
elevon_roll = 1.0 - elevon_roll;
|
||||
// first use the normal reversing facilities to get servo 1 roll working in the correct direction
|
||||
// then use the normal reversing facilities to get servo 2 roll working in the correct direction
|
||||
// then use these new reversing switches to reverse servo 1 and/or 2 pitch as needed
|
||||
// if servo 1 pitch is reversed
|
||||
if (cameraStab.ElevonSSGServo1PitchReverse == CAMERASTABSETTINGS_ELEVONSSGSERVO1PITCHREVERSE_TRUE) {
|
||||
// use (reversed pitch) + roll
|
||||
output = ((1.0 - elevon_pitch) + elevon_roll) / 2;
|
||||
}
|
||||
else {
|
||||
// use pitch + roll
|
||||
output = (elevon_pitch + elevon_roll) / 2;
|
||||
}
|
||||
CameraDesiredRollOrServo1Set(&output);
|
||||
// if servo 2 pitch is reversed
|
||||
if (cameraStab.ElevonSSGServo2PitchReverse == CAMERASTABSETTINGS_ELEVONSSGSERVO2PITCHREVERSE_TRUE) {
|
||||
elevon_pitch = 1.0 - elevon_pitch;
|
||||
// use (reversed pitch) - roll
|
||||
output = ((1.0 - elevon_pitch) - elevon_roll) / 2;
|
||||
}
|
||||
else {
|
||||
// use pitch - roll
|
||||
output = (elevon_pitch - elevon_roll) / 2;
|
||||
}
|
||||
output = (elevon_pitch - elevon_roll) / 2;
|
||||
CameraDesiredPitchOrServo2Set(&output);
|
||||
}
|
||||
else {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<field name="MaxAccel" units="units/sec" type="uint16" elements="1" defaultvalue="500"/>
|
||||
<field name="AccelTime" units="ms" type="uint8" elementnames="Roll,Pitch,Yaw" defaultvalue="5"/>
|
||||
<field name="DecelTime" units="ms" type="uint8" elementnames="Roll,Pitch,Yaw" defaultvalue="5"/>
|
||||
<field name="ElevonSSGServo2RollReverse" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="FALSE"/>
|
||||
<field name="ElevonSSGServo1PitchReverse" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="FALSE"/>
|
||||
<field name="ElevonSSGServo2PitchReverse" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="FALSE"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user