mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
OP-1036: rename some settings and move them in the right place
tags: de-kenzification
This commit is contained in:
parent
27eadc200b
commit
c1f32e9beb
@ -255,10 +255,10 @@ static void updatePathVelocity()
|
||||
VelocityStateData velocityState;
|
||||
VelocityStateGet(&velocityState);
|
||||
|
||||
// look ahead fixedwingpathfollowerSettings.HeadingFeedForward seconds
|
||||
float cur[3] = { positionState.North + (velocityState.North * fixedwingpathfollowerSettings.HeadingFeedForward),
|
||||
positionState.East + (velocityState.East * fixedwingpathfollowerSettings.HeadingFeedForward),
|
||||
positionState.Down + (velocityState.Down * fixedwingpathfollowerSettings.HeadingFeedForward) };
|
||||
// look ahead fixedwingpathfollowerSettings.CourseFeedForward seconds
|
||||
float cur[3] = { positionState.North + (velocityState.North * fixedwingpathfollowerSettings.CourseFeedForward),
|
||||
positionState.East + (velocityState.East * fixedwingpathfollowerSettings.CourseFeedForward),
|
||||
positionState.Down + (velocityState.Down * fixedwingpathfollowerSettings.CourseFeedForward) };
|
||||
struct path_status progress;
|
||||
|
||||
path_progress(pathDesired.Start, pathDesired.End, cur, &progress, pathDesired.Mode);
|
||||
@ -384,6 +384,7 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
StabilizationSettingsData stabSettings;
|
||||
FixedWingPathFollowerStatusData fixedwingpathfollowerStatus;
|
||||
AirspeedStateData airspeedState;
|
||||
SystemSettingsData systemSettings;
|
||||
|
||||
float groundspeedState;
|
||||
float groundspeedDesired;
|
||||
@ -408,6 +409,7 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
AttitudeStateGet(&attitudeState);
|
||||
StabilizationSettingsGet(&stabSettings);
|
||||
AirspeedStateGet(&airspeedState);
|
||||
SystemSettingsGet(&systemSettings);
|
||||
|
||||
|
||||
/**
|
||||
@ -424,8 +426,8 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
// Desired ground speed
|
||||
groundspeedDesired = sqrtf(velocityDesired.North * velocityDesired.North + velocityDesired.East * velocityDesired.East);
|
||||
indicatedAirspeedDesired = bound(groundspeedDesired + indicatedAirspeedStateBias,
|
||||
fixedwingpathfollowerSettings.BestClimbRateSpeed,
|
||||
fixedwingpathfollowerSettings.CruiseSpeed);
|
||||
fixedwingpathfollowerSettings.HorizontalVelMin,
|
||||
fixedwingpathfollowerSettings.HorizontalVelMax);
|
||||
|
||||
// Airspeed error
|
||||
airspeedError = indicatedAirspeedDesired - indicatedAirspeedState;
|
||||
@ -446,23 +448,19 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
// Error condition: plane too slow or too fast
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_HIGHSPEED] = 0;
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_LOWSPEED] = 0;
|
||||
if (indicatedAirspeedState > fixedwingpathfollowerSettings.AirSpeedMax) {
|
||||
if (indicatedAirspeedState > systemSettings.AirSpeedMax) {
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_OVERSPEED] = 1;
|
||||
result = 0;
|
||||
}
|
||||
if (indicatedAirspeedState > fixedwingpathfollowerSettings.CruiseSpeed * 1.2f) {
|
||||
if (indicatedAirspeedState > fixedwingpathfollowerSettings.HorizontalVelMax * 1.2f) {
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_HIGHSPEED] = 1;
|
||||
result = 0;
|
||||
}
|
||||
if (indicatedAirspeedState < fixedwingpathfollowerSettings.BestClimbRateSpeed * 0.8f && 1) { // The next three && 1 are placeholders for UAVOs representing LANDING and TAKEOFF
|
||||
if (indicatedAirspeedState < fixedwingpathfollowerSettings.HorizontalVelMin * 0.8f) {
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_LOWSPEED] = 1;
|
||||
result = 0;
|
||||
}
|
||||
if (indicatedAirspeedState < fixedwingpathfollowerSettings.StallSpeedClean && 1 && 1) { // Where the && 1 represents the UAVO that will control whether the airplane is prepped for landing or not
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_STALLSPEED] = 1;
|
||||
result = 0;
|
||||
}
|
||||
if (indicatedAirspeedState < fixedwingpathfollowerSettings.StallSpeedDirty && 1) {
|
||||
if (indicatedAirspeedState < systemSettings.AirSpeedMin) {
|
||||
fixedwingpathfollowerStatus.Errors[FIXEDWINGPATHFOLLOWERSTATUS_ERRORS_STALLSPEED] = 1;
|
||||
result = 0;
|
||||
}
|
||||
@ -487,7 +485,7 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
|
||||
// Compute the cross feed from vertical speed to pitch, with saturation
|
||||
float speedErrorToPowerCommandComponent = bound(
|
||||
(airspeedError / fixedwingpathfollowerSettings.BestClimbRateSpeed) * fixedwingpathfollowerSettings.AirspeedToPowerCrossFeed[FIXEDWINGPATHFOLLOWERSETTINGS_AIRSPEEDTOPOWERCROSSFEED_KP],
|
||||
(airspeedError / fixedwingpathfollowerSettings.HorizontalVelMin) * fixedwingpathfollowerSettings.AirspeedToPowerCrossFeed[FIXEDWINGPATHFOLLOWERSETTINGS_AIRSPEEDTOPOWERCROSSFEED_KP],
|
||||
-fixedwingpathfollowerSettings.AirspeedToPowerCrossFeed[FIXEDWINGPATHFOLLOWERSETTINGS_AIRSPEEDTOPOWERCROSSFEED_MAX],
|
||||
fixedwingpathfollowerSettings.AirspeedToPowerCrossFeed[FIXEDWINGPATHFOLLOWERSETTINGS_AIRSPEEDTOPOWERCROSSFEED_MAX]
|
||||
);
|
||||
@ -584,15 +582,15 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
bearingError -= 360.0f;
|
||||
}
|
||||
|
||||
bearingIntegral = bound(bearingIntegral + bearingError * dT * fixedwingpathfollowerSettings.BearingPI[FIXEDWINGPATHFOLLOWERSETTINGS_BEARINGPI_KI],
|
||||
-fixedwingpathfollowerSettings.BearingPI[FIXEDWINGPATHFOLLOWERSETTINGS_BEARINGPI_ILIMIT],
|
||||
fixedwingpathfollowerSettings.BearingPI[FIXEDWINGPATHFOLLOWERSETTINGS_BEARINGPI_ILIMIT]);
|
||||
bearingCommand = (bearingError * fixedwingpathfollowerSettings.BearingPI[FIXEDWINGPATHFOLLOWERSETTINGS_BEARINGPI_KP] +
|
||||
bearingIntegral = bound(bearingIntegral + bearingError * dT * fixedwingpathfollowerSettings.CoursePI[FIXEDWINGPATHFOLLOWERSETTINGS_COURSEPI_KI],
|
||||
-fixedwingpathfollowerSettings.CoursePI[FIXEDWINGPATHFOLLOWERSETTINGS_COURSEPI_ILIMIT],
|
||||
fixedwingpathfollowerSettings.CoursePI[FIXEDWINGPATHFOLLOWERSETTINGS_COURSEPI_ILIMIT]);
|
||||
bearingCommand = (bearingError * fixedwingpathfollowerSettings.CoursePI[FIXEDWINGPATHFOLLOWERSETTINGS_COURSEPI_KP] +
|
||||
bearingIntegral);
|
||||
|
||||
fixedwingpathfollowerStatus.Error[FIXEDWINGPATHFOLLOWERSTATUS_ERROR_BEARING] = bearingError;
|
||||
fixedwingpathfollowerStatus.ErrorInt[FIXEDWINGPATHFOLLOWERSTATUS_ERRORINT_BEARING] = bearingIntegral;
|
||||
fixedwingpathfollowerStatus.Command[FIXEDWINGPATHFOLLOWERSTATUS_COMMAND_BEARING] = bearingCommand;
|
||||
fixedwingpathfollowerStatus.Error[FIXEDWINGPATHFOLLOWERSTATUS_ERROR_COURSE] = bearingError;
|
||||
fixedwingpathfollowerStatus.ErrorInt[FIXEDWINGPATHFOLLOWERSTATUS_ERRORINT_COURSE] = bearingIntegral;
|
||||
fixedwingpathfollowerStatus.Command[FIXEDWINGPATHFOLLOWERSTATUS_COMMAND_COURSE] = bearingCommand;
|
||||
|
||||
stabDesired.Roll = bound(fixedwingpathfollowerSettings.RollLimit[FIXEDWINGPATHFOLLOWERSETTINGS_ROLLLIMIT_NEUTRAL] +
|
||||
bearingCommand,
|
||||
|
@ -3,20 +3,14 @@
|
||||
<description>Settings for the @ref FixedWingPathFollowerModule</description>
|
||||
|
||||
<!-- these coefficients control desired movement in airspace -->
|
||||
<field name="AirSpeedMax" units="m/s" type="float" elements="1" defaultvalue="30"/>
|
||||
<!-- Vne, i.e. maximum airspeed the airframe can handle -->
|
||||
<field name="CruiseSpeed" units="m/s" type="float" elements="1" defaultvalue="20"/>
|
||||
<field name="HorizontalVelMax" units="m/s" type="float" elements="1" defaultvalue="20"/>
|
||||
<!-- Maximum speed the autopilot will try to achieve, usually for long distances -->
|
||||
<field name="BestClimbRateSpeed" units="m/s" type="float" elements="1" defaultvalue="10"/>
|
||||
<field name="HorizontalVelMin" units="m/s" type="float" elements="1" defaultvalue="10"/>
|
||||
<!-- V_y, Minimum speed the autopilot will try to fly, for example when loitering -->
|
||||
<field name="StallSpeedClean" units="m/s" type="float" elements="1" defaultvalue="8"/>
|
||||
<!-- Vs1, i.e. stall speed in clean configuration- leave some safety margin -->
|
||||
<field name="StallSpeedDirty" units="m/s" type="float" elements="1" defaultvalue="8"/>
|
||||
<!-- Vs0, i.e. stall speed with flaps and landing gear deployed - leave some safety margin -->
|
||||
<field name="VerticalVelMax" units="m/s" type="float" elements="1" defaultvalue="10"/>
|
||||
<!-- maximum allowed climb or sink rate in guided flight-->
|
||||
|
||||
<field name="HeadingFeedForward" units="s" type="float" elements="1" defaultvalue="3.0"/>
|
||||
<field name="CourseFeedForward" units="s" type="float" elements="1" defaultvalue="3.0"/>
|
||||
<!-- how many seconds to plan the flight vector ahead when initiating necessary heading changes - increase for planes with sluggish response -->
|
||||
|
||||
<field name="HorizontalPosP" units="(m/s)/m" type="float" elements="1" defaultvalue="0.05"/>
|
||||
@ -25,7 +19,7 @@
|
||||
<!-- proportional coefficient for desired vertical speed in relation to altitude displacement-->
|
||||
|
||||
<!-- these coefficients control actual control outputs -->
|
||||
<field name="BearingPI" units="deg/deg" type="float" elements="3" elementnames="Kp,Ki,ILimit" defaultvalue="0.2, 0, 0"/>
|
||||
<field name="CoursePI" units="deg/deg" type="float" elements="3" elementnames="Kp,Ki,ILimit" defaultvalue="0.2, 0, 0"/>
|
||||
<!-- coefficients for desired bank angle in relation to ground bearing error - this controls heading -->
|
||||
|
||||
<field name="SpeedPI" units="deg / (m/s)" type="float" elements="3" elementnames="Kp,Ki,ILimit" defaultvalue="1.5, .15, 20"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<xml>
|
||||
<object name="FixedWingPathFollowerStatus" singleinstance="true" settings="false" category="Control">
|
||||
<description>Object Storing Debugging Information on PID internals</description>
|
||||
<field name="Error" units="" type="float" elementnames="Bearing,Speed,Power" />
|
||||
<field name="ErrorInt" units="" type="float" elementnames="Bearing,Speed,Power" />
|
||||
<field name="Command" units="" type="float" elementnames="Bearing,Speed,Power" />
|
||||
<field name="Error" units="" type="float" elementnames="Course,Speed,Power" />
|
||||
<field name="ErrorInt" units="" type="float" elementnames="Course,Speed,Power" />
|
||||
<field name="Command" units="" type="float" elementnames="Course,Speed,Power" />
|
||||
<field name="Errors" units="" type="uint8" elementnames="Wind,Stallspeed,Lowspeed,Highspeed,Overspeed,Lowpower,Highpower,Pitchcontrol" />
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
|
@ -3,6 +3,12 @@
|
||||
<description>Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand</description>
|
||||
<field name="AirframeType" units="" type="enum" elements="1" options="FixedWing,FixedWingElevon,FixedWingVtail,VTOL,HeliCP,QuadX,QuadP,Hexa,Octo,Custom,HexaX,OctoV,OctoCoaxP,OctoCoaxX,HexaCoax,Tri,GroundVehicleCar,GroundVehicleDifferential,GroundVehicleMotorcycle" defaultvalue="QuadX"/>
|
||||
<field name="GUIConfigData" units="bits" type="uint32" elements="4" defaultvalue="0"/>
|
||||
<field name="AirSpeedMax" units="m/s" type="float" elements="1" defaultvalue="30"/>
|
||||
<!-- Vne, i.e. maximum airspeed the airframe can handle - used by autopilot, actuator compensation. as well as possibly by INS for plausibility checks -->
|
||||
<field name="AirSpeedMin" units="m/s" type="float" elements="1" defaultvalue="10"/>
|
||||
<!-- Vs0, i.e stall speed - minimum speed the airframe will be able to fly - used by autopilot, actuator compensation, as well as possibly by INS for plausibility check
|
||||
TODO: currently not used by vtols, needs its default changed to 0 as soon as its used by vtols-->
|
||||
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user