1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

A few comments in my code and some simplication to the fixedwingfollower to get

it compiling against my path planner.
This commit is contained in:
James Cotton 2012-06-06 09:12:36 -05:00
parent a28aac47b5
commit 463ad550e2
3 changed files with 14 additions and 19 deletions

View File

@ -244,14 +244,9 @@ static void updatePathVelocity()
VelocityActualData velocityActual;
VelocityActualGet(&velocityActual);
// look ahead fixedwingpathfollowerSettings.CourseFeedForward seconds
float cur[3] = {positionActual.North + (velocityActual.North * fixedwingpathfollowerSettings.CourseFeedForward),
positionActual.East + (velocityActual.East * fixedwingpathfollowerSettings.CourseFeedForward),
positionActual.Down + (velocityActual.Down * fixedwingpathfollowerSettings.CourseFeedForward)
};
struct path_status progress;
path_progress(pathDesired.Start, pathDesired.End, cur, &progress);
path_progress(pathDesired.Start, pathDesired.End, &positionActual.North, &progress);
float groundspeed;
float altitudeSetpoint;
@ -260,9 +255,9 @@ static void updatePathVelocity()
case PATHDESIRED_MODE_ENDPOINT:
default:
groundspeed = pathDesired.StartingVelocity + (pathDesired.EndingVelocity - pathDesired.StartingVelocity) *
bound(progress.fractional_progress,0,1);
bound(progress.fractional_progress,0,1);
altitudeSetpoint = pathDesired.Start[2] + (pathDesired.End[2] - pathDesired.Start[2]) *
bound(progress.fractional_progress,0,1);
bound(progress.fractional_progress,0,1);
break;
}
@ -354,7 +349,7 @@ static uint8_t updateFixedDesiredAttitude()
fixedwingpathfollowerSettings.AirSpeedMax);
// Airspeed error
speedError = airspeedDesired - ( airspeedActual );
speedError = airspeedDesired - airspeedActual;
// Vertical error
climbspeedDesired = bound (
velocityDesired.Down,

View File

@ -3,9 +3,9 @@
*
* @file vtolpathfollower.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief This module compared @ref PositionActuatl to @ref ActiveWaypoint
* and sets @ref AttitudeDesired. It only does this when the FlightMode field
* of @ref ManualControlCommand is Auto.
* @brief This module compared @ref PositionActual to @ref PathDesired
* and sets @ref Stabilization. It only does this when the FlightMode field
* of @ref FlightStatus is PathPlanner or RTH.
*
* @see The GNU Public License (GPL) Version 3
*
@ -27,12 +27,15 @@
*/
/**
* Input object: ActiveWaypoint
* Input object: FlightStatus
* Input object: PathDesired
* Input object: PositionActual
* Input object: ManualControlCommand
* Output object: AttitudeDesired
* Output object: StabilizationDesired
*
* This module will periodically update the value of the AttitudeDesired object.
* This module will periodically update the value of the @ref StabilizationDesired object based on
* @ref PathDesired and @PositionActual when the Flight Mode selected in @FlightStatus is supported
* by this module. Otherwise another module (e.g. @ref ManualControlCommand) is expected to be
* writing to @ref StabilizationDesired.
*
* The module executes in its own thread in this example.
*

View File

@ -10,9 +10,6 @@
<field name="VerticalVelMax" units="m/s" type="float" elements="1" defaultvalue="10"/>
<!-- maximum allowed climb or sink rate in guided flight-->
<field name="CourseFeedForward" units="s" type="float" elements="1" defaultvalue="3.0"/>
<!-- how many seconds to plan the flight vector ahead when initiating necessary course changes - increase for planes with sluggish response -->
<field name="HorizontalPosP" units="(m/s)/m" type="float" elements="1" defaultvalue="0.05"/>
<!-- proportional coefficient for correction vector in path vector field to get back on course - reduce for fast planes to prevent course oscillations -->
<field name="VerticalPosP" units="(m/s)/m" type="float" elements="1" defaultvalue="0.05"/>