ICAROUS
|
#include <TrajGen.h>
Static Public Member Functions | |
static Triple< double, double, double > | getStoredParameters (const Plan &p) |
static void | addParams (Plan &p, double bankAngle, double gsAccel, double vsAccel) |
static bool | turnCanBeInscribed (const Plan &lpc, int i, const Position &BOT, const Position &EOT) |
static Plan | markVsChanges (const Plan &lpc) |
static Plan | generateTurnTCPs (const Plan &kpc, double bankAngle) |
static Plan | generateTurnTCPs (const Plan &lpc, double default_bank_angle, bool continueGen) |
static void | generateTurnTcpAt (Plan &traj, int ixNp2, double default_bankAngle, bool continueGen) |
static void | generateTurnTcp (Plan &traj, int ixNp2, double R, bool bankUsed, bool continueGen) |
static double | neededTurnLegDistance (const Plan &p, int ix, double radius) |
static double | neededLegLengthBankAngle (const Plan &p, int ix, double bankAngle) |
static std::pair< int, double > | movePointsWithinTurn (Plan &traj, int ixBOT, int ixNp2, int ixEOT, double gsIn) |
static Plan | generateTurnTCPsRadius (const Plan &lpc) |
static Plan | generateTurnTCPsRadius (const Plan &lpc, bool continueGen) |
static void | generateGsTCPsAt (Plan &traj, int i, double gsAccel, bool repairGs) |
static bool | adjustGsInsideAccel (Plan &traj, int ixBGS, double aBGS, double distToEGS) |
static int | generateGsToZero (Plan &traj, int i, double a, double targetGs) |
static void | adjustGsInsideAccelToEGS (Plan &traj, int ixBGS, double aBGS, int ixEGS) |
static bool | attemptRepair2 (Plan &kpc, int ixBGS, int ixEGS, double maxGsAccel) |
static TcpData | makeBGS (const TcpData &tcp1, double a, bool isAltPreserve) |
static TcpData | makeEGS () |
static Plan | generateGsTCPs (const Plan &fp, double maxGsAccel, bool repairGs) |
static void | generateGsTCP (Plan &traj, int i, double maxGsAccel, bool repairGs) |
static Plan | generateVsTCPs (const Plan &kpc, double maxVsAccel, bool continueGen, bool repairVs_zeroGs) |
static Plan | generateVsTCPs (const Plan &kpc, double maxVsAccel) |
static int | generateVsTCP (Plan &traj, int i, double vsAccel, bool continueGen, bool repairVs_zeroGs) |
static bool | fixAlts (Plan &traj, int bindex, int eindex, double vs1, double accel) |
static double | calcRadius (const Plan &p, int ix, double bank) |
static Plan | linearRepairShortTurnLegs (const Plan &fp, double bank, bool addMiddle) |
static Plan | makeMarkedVsConstant (const Plan &kpc) |
static Plan | repairPlan (const Plan &lpc, bool repairTurn, bool repairVs, double bankAngle, double vsAccel) |
static Plan | makeKinematicPlan (const Plan &fp, double bankAngle, double gsAccel, double vsAccel, bool repairTurn, bool repairVs, bool repairGs) |
static Plan | makeKinematicPlan (const Plan &fp, double bankAngle, double gsAccel, double vsAccel) |
static Plan | makeVsKinematicPlan (const Plan &p, double vsAccel) |
static Plan | genDirect2 (const Plan &lpc, const Position &so, const Velocity &vo, double to, double bankAngle) |
static Plan | genDirectToLinear (const Plan &fp, const Position &so, const Velocity &vo, double to, double bankAngle, double timeBeforeTurn) |
static Plan | buildDirectTo (const NavPoint &s, const Velocity &v, const Plan &base, double bankAngle) |
static Plan | makeLinearPlan (const Plan &fp) |
static void | setVerbose (bool b) |
static void | printError (const std::string &s) |
Static Public Attributes | |
static const double | MIN_MARK_LEG_TIME = Units::from("s",60) |
static const double | minorVfactor = 0.01 |
static const double | maxVs = Units::from("fpm",10000) |
static const double | maxAlt = Units::from("ft",60000) |
static const std::string | turnFail = "<TrajGen.turnGenError>" |
static const std::string | gsFail = "<TrajGen.gsGenError>" |
static const std::string | vsFail = "<TrajGen.vsGenError>" |
Static Private Member Functions | |
static double | directToContinueTime (const Plan &lpc, const Position &so, const Velocity &vo, double to, double bankAngle) |
Static Private Attributes | |
static bool | verbose = false |
Trajectory generation functionality. This class translates Linear plans into Kinematic plans. The translation back to a Linear plan from a Kinematic plan is accomplished using reversion methods defined in PlanUtil (See PlanUtil.revertAllTCPS).
Note: It is very easy to create a linear plan that is infeasible, that is, it contains a segment where there is insufficient time or distance to achieve the acceleration implicit in it. If TrajGen.makeKinematicPlan fails to generate a Kinematic plan, an error message is added to the plan. There are "repair" methods available that modify the linear plan that often turn it into a feasible plan (See PlanUtil.repairShortVsLegs, PlanUtil.fixBadTurns)
|
static |
Store accel magnitude values used to generate this kinematic plan in a plan's note field. Negative values will be ignored.
p | plan to modify |
bankAngle | bank angle in radians, negative for none |
gsAccel | gs accel in m/s, negative for none |
vsAccel | vs accel in m/s, negative for none |
Store accel values in a plan's note field
p | plan to modify |
bankAngle | bank angle in radians, negative for none |
gsAccel | gs accel in m/s, negative for none |
vsAccel | vs accel in m/s, negative for none |
|
static |
Adjust ground speed of all points that will fall within distance to new EGS (distToEGS) This is necessary because points between a newly added BGS – EGS region will have time based on the previous non-accelerated section.
traj | the plan file of interest |
ixBGS | index of BGS (that has just been added, but EGS has not yet been added!) |
aBGS | signed acceleration value |
distToEGS | distance from BGS to new EGS point |
Note: It is necessary to adjust by distance and not time. The times will change, so the EGS should added after this function is called.
remove all points that will fall within distance to new EGS (distToEGS)
traj | the plan file of interest |
ixBGS | index of BGS |
aBGS | acceleration value |
distToEGS | distance from BGS to new EGS point |
|
static |
Adjust ground speed of all points that will fall within distance to new EGS (distToEGS)
traj | the plan file of interest |
ixBGS | index of BGS |
aBGS | signed acceleration value |
distToEGS | distance from BGS to new EGS point |
Note: this function used where EGS has already been added.
|
static |
Construct a (hopefully) feasible linear plan that describes a path from s to the goal point. If this fails, it reurns a simple direct plan.
|
static |
calculate radius at vertex ix, If a radius has been set use it, otherwise use bank angle and GS to calculate value
p | Plan |
ix | index of vertex point |
bank | bank angle |
|
staticprivate |
Attempts to compute (heuristic) the amount of time to continue current velocity before starting direct to turn. (in 2-D)
lpc | Plan trying to connect to at point zero. |
so | current position |
vo | current velocity |
to | current time |
bankAngle | max bank angle |
|
static |
This method makes all of the vertical speed out of bindex to be vs1. It also smoothes the velocity profile according to the "accel" parameter.
Note: this is essential to making the BVS-EVS pair consistent
traj | trajectory of interest |
bindex | start of smoothing region |
eindex | end of smoothing region |
vs1 | velocity to use for smoothing |
accel | acceleration in this BGS EGS region |
|
static |
*** UNUSED ***
lpc | a linear plan that needs to be connected to, preferable at point 0 |
so | current position |
vo | current velocity |
to | current time |
bankAngle | turn bank angle |
lpc | a linear plan that needs to be connected to, preferable at point 0 |
so | current position |
vo | current velocity |
to | current time |
bankAngle | turn bank angle |
|
static |
Constructs a new linear plan that connects current state to existing linear plan lpc (in 2-D).
fp | a linear plan that needs to be connected to at point 0 |
so | current position |
vo | current velocity |
to | current time |
bankAngle | turn bank angle |
timeBeforeTurn | delay time before continuing turn. (can call directToContinueTime for an estimate) |
lpc | a linear plan that needs to be connected to, preferable at point 0 |
so | current position |
vo | current velocity |
to | current time |
bankAngle | turn bank angle |
Generates ground speed TCPs (in forward direction)
fp | plan to be processed |
maxGsAccel | ground speed acceleration (non-negative) |
repairGs | if segment is too short, repair by skipping over it (i.e. achieve max possible accel) |
|
static |
Create a BGS-EGS pair starting at index "i". The speed into and out of EGS will be "targetGs" Note: targetGS is often chosen to be gsOut(i+1) so that there is continuity at "i+1" after this method is called at "i"
traj | trajectory |
i | index where BGS is created |
gsAccel | unsigned acceleration value |
targetGs | target ground speed (usually gsOut(i+1) – calculated earlier) |
timeOffset | create BGS this much time after time(i), it can be zero |
Note: This method will skip over points until the targetGs is obtained.
|
static |
generate an BGS-EGS pair with the EGS at point i
traj | trajectory |
i | point with GSOut = 0 |
a | absolute acceleration |
targetGs | should be zero are almost zero |
|
static |
Generate turn at vertex "ixNP2" with radius R
traj | trajectory under construction |
ixNp2 | index of np2 in plan |
R | unsigned radius |
bankUsed | true if default bank angle was used to compute R |
continueGen | continue generation, even with problems |
|
static |
Generate turn at vertex "ixNP2". If there is a stored radius use that value, otherwise compute radius from default_bankAngle and speed
traj | traj |
ixNp2 | turn vertex – should not be in a turn already |
dafault_bankAngle | default banks angle used to compute radius |
continueGen | if true continue turn generation in the presence of errors |
|
static |
Kinematic generator that adds turn TCPs. This defers ground speed changes until after the turn. It assumes legs are long enough to support the turns. bank angle must be nonnegative!!!!!
lpc | linear plan |
default_bank_angle | the default bank angle, if a radius is not present in the plan. |
continueGen | if true, do not terminate generation if an error message is produced |
Kinematic generator that adds turn TCPs. This defers ground speed changes until after the turn. It assumes legs are long enough to support the turns.
lpc | linear plan |
Kinematic generator that adds turn TCPs. This defers ground speed changes until after the turn. It assumes legs are long enough to support the turns.
lpc | linear plan |
continueGen | continue generation, even with problems |
|
static |
Generate a BVS EVS pair at index i if deltaVs is large enough
traj | trajectory |
i | index |
vsAccel | vertical acceleration |
continueGen | if true continue generation even if errors are encountered, results in a partial kinematic plan |
t1 = previous point's time (previous EVS) t2 = np2.time() = end time of the linear segment where the vertical speed change occurred nextVsChangeTm = time of the next vertical change (i.e. where the next TCP will appear) vs1 vertical speed into point at time t2 vs2 vertical speed out of point at time t2
vs1 vs2 t1 -------------------------------- t2 ------------------------------ nextVsChangeTm ^ "i" ^ | | tbegin tend
|
static |
Generate Vertical acceleration TCPs It assumes that all horizontal passes have been completed.
kpc | kinematic plan with final horizontal path |
maxVsAccel | vertical speed acceleration (positive) |
continueGen | true means continue generation even with problems |
Generate Vertical acceleration TCPs It assumes that all horizontal passes have been completed.
kpc | kinematic plan with final horizontal path |
maxVsAccel | vertical speed acceleration (positive) |
|
static |
Repair function for a linear plan This can eliminate short legs. This function look for two sequential turns with a very short leg segment between them. It collapses the two turns into one or no turns
fp | linear plan to be repaired |
bank | bank angle |
addMiddle | if true, it adds a middle point when it deletes two points (one turn left) |
Note: if addMiddle is false, point info and named waypoint may be lost
Create a BGS point from a previous point (that is using its TCP info in tcp1)
tcp1 | |
a | |
timeOffset | |
isAltPreserve |
|
static |
The resulting PlanCore will be "clean" in that it will have all original points, with no history of deleted points. Also all TCPs should reference points in a feasible plan. If the trajectory is modified, it will have added, modified, or deleted points. If the conversion fails, the resulting plan will have one or more error messages (and may have a point labeled as "TCP_generation_failure_point").
fp | input plan (is linearized if not already so) |
bankAngle | maximum allowed (and default) bank angle for turns |
gsAccel | maximum allowed (and default) ground speed acceleration (m/s^2) |
vsAccel | maximum allowed (and default) vertical speed acceleration (m/s^2) |
|
static |
TODO (helps me find this method)
The resulting Plan will be "clean" in that it will have all original points, with no history of deleted points. Also all TCPs should reference points in a feasible plan. If the trajectory is modified, it will have added, modified, or deleted points. If the conversion fails, the resulting plan will have one or more error messages (and may have a point labeled as "TCP_generation_failure_point"). Note: This method seeks to preserve ground speeds of legs. The time at a waypoint is assumed to be not important compared to the original ground speed. Note. If a turn vertex NavPoint has a non-zero "radius", then that value is used rather than "bankAngle"
fp | input plan (is linearized if not already so) |
bankAngle | maximum allowed (and default) bank angle for turns |
gsAccel | maximum allowed (and default) ground speed acceleration (m/s^2) |
vsAccel | maximum allowed (and default) vertical speed acceleration (m/s^2) |
repairTurn | attempt to repair infeasible turns as a preprocessing step |
repairGs | attempt to repair infeasible ground speed accelerations |
repairVs | attempt to repair infeasible vertical speed accelerations as a preprocessing step |
TODO
fp | input plan (is linearized if not already so) |
bankAngle | maximum allowed (and default) bank angle for turns |
gsAccel | maximum allowed (and default) ground speed acceleration (m/s^2) |
vsAccel | maximum allowed (and default) vertical speed acceleration (m/s^2) |
minVsChangeRecognized | minimum vs change that will register as "non-constant" (m/s) |
repairTurn | attempt to repair infeasible turns as a preprocessing step |
repairGs | attempt to repair infeasible gs accelerations as a preprocessing step |
repairVs | attempt to repair infeasible vs accelerations as a preprocessing step |
constantGS | if true, produces a constant ground speed kinematic plan with gs being average of linear plan |
Returns a PlanCore version of the given plan. If it was a kinematic plan, this will attempt to regress the TCPs to their original source points (if the proper metadata is available). If this is already a PlanCore, return a copy.
fp | plan |
Returns a PlanCore version of the given plan. If it was a kinematic plan, this will attempt to regress the TCPs to their original source points (if the proper metadata is available). If this is already a PlanCore, return a copy.
Penultimate Kinematic generation pass. Repairs altitudes so that only VSC points have vertical speed changes. Averages vertical speeds between alt preserved points by modifying altitudes on points between them.
kpc | kinematic plan |
This assumes a plan that has altitude preserve points marked. Generate the vertical profile (only) for VsTCPs in this plan.
p | input plan (need not be linear) |
vsAccel | vertical acceleration |
This takes a Plan lpc and returns a plan that has all points with vertical changes as "AltPreserve" points, with all other points being "Original" points. Beginning and end points are always marked.
lpc | source plan |
vsAccel | vertical acceleration |
This takes a plancore lpc and returns a kinematic plan core that has all points with vertical changes as "AltPreserve" points, with all other points being "Original" points. Beginning and end points are always marked.
lpc | source plan |
|
static |
Re-aligns points that are within a newly generated turn at j
|
static |
Calculates the minimum leg distance that can handle a specified radius
p | the Plan (i.e. trajectory) |
ix | vertex index |
radius | radius of turn |
p | the Plan (i.e. trajectory) |
ix | vertex index |
radius | radius of turn |
|
static |
Method to repair an infeasible linear plan where there are segments that are too short to achieve specified acceleration.
lpc | linear plan |
repairTurn | true, to attempt repair of infeasible turns |
repairVs | true, to attempt repair of infeasible vertical speed segments |
bankAngle | bank angle |
vsAccel | vertical speed acceleration |
|
static |
Returns true if turn at i can be inscribed in the available leg space. Note that it will check for collinear points using prevTrackChange and nextTrackChange
lpc | source plan |
i | vertex to be tested |
BOT | Beginning of turn |
EOT | End of turn |