mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-1058 uncrustify
This commit is contained in:
parent
f226b23c24
commit
01d963affd
@ -358,7 +358,7 @@ static void updateFixedAttitude(float *attitude)
|
||||
stabDesired.Pitch = attitude[1];
|
||||
stabDesired.Yaw = attitude[2];
|
||||
stabDesired.Throttle = attitude[3];
|
||||
stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE;
|
||||
stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE;
|
||||
stabDesired.StabilizationMode.fields.Pitch = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE;
|
||||
stabDesired.StabilizationMode.fields.Yaw = STABILIZATIONDESIRED_STABILIZATIONMODE_RATE;
|
||||
StabilizationDesiredSet(&stabDesired);
|
||||
@ -494,9 +494,9 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
speedErrorToPowerCommandComponent;
|
||||
|
||||
// Output internal state to telemetry
|
||||
fixedwingpathfollowerStatus.Error.fields.Power = descentspeedError;
|
||||
fixedwingpathfollowerStatus.Error.fields.Power = descentspeedError;
|
||||
fixedwingpathfollowerStatus.ErrorInt.fields.Power = powerIntegral;
|
||||
fixedwingpathfollowerStatus.Command.fields.Power = powerCommand;
|
||||
fixedwingpathfollowerStatus.Command.fields.Power = powerCommand;
|
||||
|
||||
// set throttle
|
||||
stabDesired.Throttle = bound(fixedwingpathfollowerSettings.ThrottleLimit.fields.Neutral + powerCommand,
|
||||
@ -519,7 +519,7 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
velocityState.Down < 0 && // we ARE going up
|
||||
descentspeedDesired > 0 && // we WANT to go down
|
||||
airspeedError < 0 && // we are too fast already
|
||||
fixedwingpathfollowerSettings.Safetymargins.fields.Highpower > 0.5f) { // alarm switched on
|
||||
fixedwingpathfollowerSettings.Safetymargins.fields.Highpower > 0.5f) { // alarm switched on
|
||||
fixedwingpathfollowerStatus.Errors.fields.Highpower = 1;
|
||||
result = 0;
|
||||
}
|
||||
@ -547,9 +547,9 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
+ airspeedErrorInt * fixedwingpathfollowerSettings.SpeedPI.fields.Ki
|
||||
) + verticalSpeedToPitchCommandComponent;
|
||||
|
||||
fixedwingpathfollowerStatus.Error.fields.Speed = airspeedError;
|
||||
fixedwingpathfollowerStatus.Error.fields.Speed = airspeedError;
|
||||
fixedwingpathfollowerStatus.ErrorInt.fields.Speed = airspeedErrorInt;
|
||||
fixedwingpathfollowerStatus.Command.fields.Speed = pitchCommand;
|
||||
fixedwingpathfollowerStatus.Command.fields.Speed = pitchCommand;
|
||||
|
||||
stabDesired.Pitch = bound(fixedwingpathfollowerSettings.PitchLimit.fields.Neutral + pitchCommand,
|
||||
fixedwingpathfollowerSettings.PitchLimit.fields.Min,
|
||||
@ -561,7 +561,7 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
velocityState.Down > 0 && // we ARE going down
|
||||
descentspeedDesired < 0 && // we WANT to go up
|
||||
airspeedError < 0 && // we are too fast already
|
||||
fixedwingpathfollowerSettings.Safetymargins.fields.Pitchcontrol > 0.5f) { // alarm switched on
|
||||
fixedwingpathfollowerSettings.Safetymargins.fields.Pitchcontrol > 0.5f) { // alarm switched on
|
||||
fixedwingpathfollowerStatus.Errors.fields.Pitchcontrol = 1;
|
||||
result = 0;
|
||||
}
|
||||
@ -614,9 +614,9 @@ static uint8_t updateFixedDesiredAttitude()
|
||||
courseCommand = (courseError * fixedwingpathfollowerSettings.CoursePI.fields.Kp +
|
||||
courseIntegral);
|
||||
|
||||
fixedwingpathfollowerStatus.Error.fields.Course = courseError;
|
||||
fixedwingpathfollowerStatus.Error.fields.Course = courseError;
|
||||
fixedwingpathfollowerStatus.ErrorInt.fields.Course = courseIntegral;
|
||||
fixedwingpathfollowerStatus.Command.fields.Course = courseCommand;
|
||||
fixedwingpathfollowerStatus.Command.fields.Course = courseCommand;
|
||||
|
||||
stabDesired.Roll = bound(fixedwingpathfollowerSettings.RollLimit.fields.Neutral +
|
||||
courseCommand,
|
||||
|
@ -686,17 +686,17 @@ static void updateStabilizationDesired(ManualControlCommandData *cmd, ManualCont
|
||||
}
|
||||
|
||||
// TOOD: Add assumption about order of stabilization desired and manual control stabilization mode fields having same order
|
||||
stabilization.StabilizationMode.fields.Roll = stab_settings[0];
|
||||
stabilization.StabilizationMode.fields.Roll = stab_settings[0];
|
||||
stabilization.StabilizationMode.fields.Pitch = stab_settings[1];
|
||||
stabilization.StabilizationMode.fields.Yaw = stab_settings[2];
|
||||
stabilization.StabilizationMode.fields.Yaw = stab_settings[2];
|
||||
|
||||
stabilization.Roll =
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_NONE) ? cmd->Roll :
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_RATE) ? cmd->Roll * stabSettings.ManualRate.fields.Roll:
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_RATE) ? cmd->Roll * stabSettings.ManualRate.fields.Roll :
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_WEAKLEVELING) ?
|
||||
cmd->Roll * stabSettings.ManualRate.fields.Roll :
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE) ? cmd->Roll * stabSettings.RollMax :
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_AXISLOCK) ? cmd->Roll * stabSettings.ManualRate.fields.Roll:
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_AXISLOCK) ? cmd->Roll * stabSettings.ManualRate.fields.Roll :
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_VIRTUALBAR) ? cmd->Roll :
|
||||
(stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_RELAYRATE) ?
|
||||
cmd->Roll * stabSettings.ManualRate.fields.Roll :
|
||||
@ -757,11 +757,11 @@ static void updatePathDesired(__attribute__((unused)) ManualControlCommandData *
|
||||
pathDesired.Start.fields.North = 0;
|
||||
pathDesired.Start.fields.East = 0;
|
||||
pathDesired.Start.fields.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset;
|
||||
pathDesired.End.fields.North = 0;
|
||||
pathDesired.End.fields.East = 0;
|
||||
pathDesired.End.fields.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset;
|
||||
pathDesired.StartingVelocity = 1;
|
||||
pathDesired.EndingVelocity = 0;
|
||||
pathDesired.End.fields.North = 0;
|
||||
pathDesired.End.fields.East = 0;
|
||||
pathDesired.End.fields.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset;
|
||||
pathDesired.StartingVelocity = 1;
|
||||
pathDesired.EndingVelocity = 0;
|
||||
pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT;
|
||||
PathDesiredSet(&pathDesired);
|
||||
} else if (changed) {
|
||||
@ -772,13 +772,13 @@ static void updatePathDesired(__attribute__((unused)) ManualControlCommandData *
|
||||
PathDesiredData pathDesired;
|
||||
PathDesiredGet(&pathDesired);
|
||||
pathDesired.Start.fields.North = positionState.North;
|
||||
pathDesired.Start.fields.East = positionState.East;
|
||||
pathDesired.Start.fields.Down = positionState.Down;
|
||||
pathDesired.End.fields.North = positionState.North;
|
||||
pathDesired.End.fields.East = positionState.East;
|
||||
pathDesired.End.fields.Down = positionState.Down;
|
||||
pathDesired.StartingVelocity = 1;
|
||||
pathDesired.EndingVelocity = 0;
|
||||
pathDesired.Start.fields.East = positionState.East;
|
||||
pathDesired.Start.fields.Down = positionState.Down;
|
||||
pathDesired.End.fields.North = positionState.North;
|
||||
pathDesired.End.fields.East = positionState.East;
|
||||
pathDesired.End.fields.Down = positionState.Down;
|
||||
pathDesired.StartingVelocity = 1;
|
||||
pathDesired.EndingVelocity = 0;
|
||||
pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT;
|
||||
PathDesiredSet(&pathDesired);
|
||||
/* Disable this section, until such time as proper discussion can be had about how to implement it for all types of crafts.
|
||||
@ -816,11 +816,11 @@ static void updateLandDesired(__attribute__((unused)) ManualControlCommandData *
|
||||
pathDesired.Start.fields.North = positionState.North;
|
||||
pathDesired.Start.fields.East = positionState.East;
|
||||
pathDesired.Start.fields.Down = positionState.Down;
|
||||
pathDesired.End.fields.North = positionState.North;
|
||||
pathDesired.End.fields.East = positionState.East;
|
||||
pathDesired.End.fields.Down = positionState.Down;
|
||||
pathDesired.StartingVelocity = 1;
|
||||
pathDesired.EndingVelocity = 0;
|
||||
pathDesired.End.fields.North = positionState.North;
|
||||
pathDesired.End.fields.East = positionState.East;
|
||||
pathDesired.End.fields.Down = positionState.Down;
|
||||
pathDesired.StartingVelocity = 1;
|
||||
pathDesired.EndingVelocity = 0;
|
||||
pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT;
|
||||
}
|
||||
pathDesired.End.fields.Down = positionState.Down + 5;
|
||||
|
@ -227,9 +227,9 @@ void updatePathDesired(__attribute__((unused)) UAVObjEvent *ev)
|
||||
WaypointInstGet(waypointActiveData.Index, &waypointData);
|
||||
PathActionInstGet(waypointData.Action, &pathActionData);
|
||||
|
||||
pathDesired.End.fields.North = waypointData.Position.fields.North;
|
||||
pathDesired.End.fields.East = waypointData.Position.fields.East;
|
||||
pathDesired.End.fields.Down = waypointData.Position.fields.Down;
|
||||
pathDesired.End.fields.North = waypointData.Position.fields.North;
|
||||
pathDesired.End.fields.East = waypointData.Position.fields.East;
|
||||
pathDesired.End.fields.Down = waypointData.Position.fields.Down;
|
||||
pathDesired.EndingVelocity = waypointData.Velocity;
|
||||
pathDesired.Mode = pathActionData.Mode;
|
||||
pathDesired.ModeParameters[0] = pathActionData.ModeParameters[0];
|
||||
@ -247,18 +247,18 @@ void updatePathDesired(__attribute__((unused)) UAVObjEvent *ev)
|
||||
pathDesired.Start[PATHDESIRED_START_EAST] = waypoint.Position[WAYPOINT_POSITION_EAST];
|
||||
pathDesired.Start[PATHDESIRED_START_DOWN] = waypoint.Position[WAYPOINT_POSITION_DOWN];*/
|
||||
pathDesired.Start.fields.North = positionState.North;
|
||||
pathDesired.Start.fields.East = positionState.East;
|
||||
pathDesired.Start.fields.Down = positionState.Down;
|
||||
pathDesired.StartingVelocity = pathDesired.EndingVelocity;
|
||||
pathDesired.Start.fields.East = positionState.East;
|
||||
pathDesired.Start.fields.Down = positionState.Down;
|
||||
pathDesired.StartingVelocity = pathDesired.EndingVelocity;
|
||||
} else {
|
||||
// Get previous waypoint as start point
|
||||
WaypointData waypointPrev;
|
||||
WaypointInstGet(waypointActive.Index - 1, &waypointPrev);
|
||||
|
||||
pathDesired.Start.fields.North = waypointPrev.Position.fields.North;
|
||||
pathDesired.Start.fields.East = waypointPrev.Position.fields.East;
|
||||
pathDesired.Start.fields.Down = waypointPrev.Position.fields.Down;
|
||||
pathDesired.StartingVelocity = waypointPrev.Velocity;
|
||||
pathDesired.Start.fields.East = waypointPrev.Position.fields.East;
|
||||
pathDesired.Start.fields.Down = waypointPrev.Position.fields.Down;
|
||||
pathDesired.StartingVelocity = waypointPrev.Velocity;
|
||||
}
|
||||
PathDesiredSet(&pathDesired);
|
||||
}
|
||||
|
@ -446,14 +446,14 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv)
|
||||
AttitudeSettingsGet(&attitudeSettings);
|
||||
|
||||
// Indicates not to expend cycles on rotation
|
||||
if (attitudeSettings.BoardRotation.fields.Roll== 0 && attitudeSettings.BoardRotation.fields.Pitch == 0 &&
|
||||
if (attitudeSettings.BoardRotation.fields.Roll == 0 && attitudeSettings.BoardRotation.fields.Pitch == 0 &&
|
||||
attitudeSettings.BoardRotation.fields.Yaw == 0) {
|
||||
rotate = 0;
|
||||
} else {
|
||||
float rotationQuat[4];
|
||||
const float rpy[3] = { attitudeSettings.BoardRotation.fields.Roll,
|
||||
attitudeSettings.BoardRotation.fields.Pitch ,
|
||||
attitudeSettings.BoardRotation.fields.Yaw};
|
||||
attitudeSettings.BoardRotation.fields.Pitch,
|
||||
attitudeSettings.BoardRotation.fields.Yaw };
|
||||
RPY2Quaternion(rpy, rotationQuat);
|
||||
Quaternion2R(rotationQuat, R);
|
||||
rotate = 1;
|
||||
|
@ -70,9 +70,9 @@ int stabilization_relay_rate(float error, float *output, int axis, bool reinit)
|
||||
|
||||
// On first run initialize estimates to something reasonable
|
||||
if (reinit) {
|
||||
rateRelayRunning[axis] = false;
|
||||
relay.Period.data[axis] = 200;
|
||||
relay.Gain.data[axis] = 0;
|
||||
rateRelayRunning[axis] = false;
|
||||
relay.Period.data[axis] = 200;
|
||||
relay.Gain.data[axis] = 0;
|
||||
|
||||
accum_sin = 0;
|
||||
accum_cos = 0;
|
||||
@ -124,9 +124,9 @@ int stabilization_relay_rate(float error, float *output, int axis, bool reinit)
|
||||
accum_cos = 0;
|
||||
|
||||
if (rateRelayRunning[axis] == false) {
|
||||
rateRelayRunning[axis] = true;
|
||||
relay.Period.data[axis] = 200;
|
||||
relay.Gain.data[axis] = 0;
|
||||
rateRelayRunning[axis] = true;
|
||||
relay.Period.data[axis] = 200;
|
||||
relay.Gain.data[axis] = 0;
|
||||
} else {
|
||||
// Low pass filter each amplitude and period
|
||||
relay.Gain.data[axis] = relay.Gain.data[axis] * AMPLITUDE_ALPHA + this_gain * (1 - AMPLITUDE_ALPHA);
|
||||
|
@ -503,7 +503,7 @@ static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
||||
lowThrottleZeroIntegral = settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE;
|
||||
|
||||
// Whether to suppress (zero) the StabilizationDesired output for each axis while disarmed or throttle is low
|
||||
lowThrottleZeroAxis[ROLL] = settings.LowThrottleZeroAxis.fields.Roll== STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE;
|
||||
lowThrottleZeroAxis[ROLL] = settings.LowThrottleZeroAxis.fields.Roll == STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE;
|
||||
lowThrottleZeroAxis[PITCH] = settings.LowThrottleZeroAxis.fields.Pitch == STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE;
|
||||
lowThrottleZeroAxis[YAW] = settings.LowThrottleZeroAxis.fields.Yaw == STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE;
|
||||
|
||||
|
@ -673,7 +673,7 @@ static void updateVtolDesiredAttitude(bool yaw_attitude)
|
||||
stabDesired.Throttle = manualControl.Throttle;
|
||||
}
|
||||
|
||||
stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE;
|
||||
stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE;
|
||||
stabDesired.StabilizationMode.fields.Pitch = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE;
|
||||
if (yaw_attitude) {
|
||||
stabDesired.StabilizationMode.fields.Yaw = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE;
|
||||
|
@ -125,12 +125,12 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo *info)
|
||||
// Append field
|
||||
// Check if it a named set and creates structures accordingly
|
||||
if (info->fields[n]->numElements > 1) {
|
||||
if(info->fields[n]->elementNames[0].compare(QString("0")) != 0){
|
||||
if (info->fields[n]->elementNames[0].compare(QString("0")) != 0) {
|
||||
QString unionTypeName = QString("%1%2Data").arg(info->name).arg(info->fields[n]->name);
|
||||
QString unionType = QString("typedef union {\n");
|
||||
QString unionType = QString("typedef union {\n");
|
||||
unionType.append(QString(" %1 data[%2];\n").arg(type).arg(info->fields[n]->numElements));
|
||||
unionType.append(QString(" struct __attribute__ ((__packed__)) {\n"));
|
||||
for(int f =0; f < info->fields[n]->elementNames.count(); f++){
|
||||
for (int f = 0; f < info->fields[n]->elementNames.count(); f++) {
|
||||
unionType.append(QString(" %1 %2;\n").arg(type).arg(info->fields[n]->elementNames[f]));
|
||||
}
|
||||
unionType.append(QString(" } fields;\n"));
|
||||
@ -140,10 +140,9 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo *info)
|
||||
|
||||
fields.append(QString(" %1 %2;\n").arg(unionTypeName)
|
||||
.arg(info->fields[n]->name));
|
||||
|
||||
} else {
|
||||
fields.append(QString(" %1 %2[%3];\n").arg(type)
|
||||
.arg(info->fields[n]->name).arg(info->fields[n]->numElements));
|
||||
fields.append(QString(" %1 %2[%3];\n").arg(type)
|
||||
.arg(info->fields[n]->name).arg(info->fields[n]->numElements));
|
||||
}
|
||||
} else {
|
||||
fields.append(QString(" %1 %2;\n").arg(type).arg(info->fields[n]->name));
|
||||
@ -227,7 +226,7 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo *info)
|
||||
// Initialize all fields in the array
|
||||
for (int idx = 0; idx < info->fields[n]->numElements; ++idx) {
|
||||
QString optIdentifier;
|
||||
if(info->fields[n]->elementNames[0].compare(QString("0")) != 0){
|
||||
if (info->fields[n]->elementNames[0].compare(QString("0")) != 0) {
|
||||
optIdentifier = QString(".data");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user