@@ -79,6 +79,21 @@ namespace
7979 return dir*omega*delt;
8080 }
8181
82+ /* *
83+ * @brief Compute end points of the trochoid path
84+ *
85+ * @param delta_1 Turning direction of the starting trochoid
86+ * @param delta_2 Turning direction of the ending trochoid
87+ * @param tA Time value of the starting trochoid
88+ * @param tBeta Duration of first arc and line segment
89+ * @param T Total duration of path
90+ * @param phi0 Initial heading
91+ * @param radius Minimum turn radius in air-relative frame
92+ * @param wind_ratio Wind ratio
93+ * @param xf Relative target position
94+ * @param yf Relative target position
95+ * @param phif Target heading
96+ */
8297 void computeEndpointBSB (double delta_1, double delta_2, double tA, double tBeta, double T, double phi0, double radius, double wind_ratio, double &xf, double &yf, double &phif) {
8398 // state after first trochoid straight
8499 double x0 = 0.0 , y0 = 0.0 ;
@@ -102,6 +117,29 @@ namespace
102117 }
103118 }
104119
120+ /* *
121+ * @brief Check conditions for the BSB path type. trochoid_path is updated in case the path is shorter
122+ *
123+ * @param delta_1 Turning direction of the starting trochoid
124+ * @param delta_2 Turning direction of the ending trochoid
125+ * @param tA Time value of the starting trochoid
126+ * @param tB Time value of the ending trochoid
127+ * @param xt10 Constant defined in Eq. (20) in Techy (2009)
128+ * @param yt10 Constant defined in Eq. (21) in Techy (2009)
129+ * @param phi0 Initial heading
130+ * @param phit1 Initial heading in trochoid frame
131+ * @param xt20 Constaint defined in Eq. (22) in Techy (2009)
132+ * @param yt20 Constant defined in Eq. (23) in Techy (2009)
133+ * @param phit2 Target heading in trochoid frame
134+ * @param xf Relative target position
135+ * @param yf Relative target position
136+ * @param radius Minimum turn radius in air-relative frame
137+ * @param wind_ratio Wind ratio
138+ * @param periodic Whether the BSB path is periodic
139+ * @param trochoid_path Calculated trochoid path object
140+ * @return true Returns true if the condiitons are conistent
141+ * @return false Reutrns false if the computed path are degenerate
142+ */
105143 bool checkConditionsBSB (double delta_1, double delta_2, double tA, double tB, double xt10, double yt10, double phi0, double phit1, double xt20, double yt20, double phit2, double xf, double yf, double radius, double wind_ratio, bool periodic, TrochoidStateSpace::PathType &trochoid_path) {
106144 // check that tA, tB, and T are valid numbers
107145 if ( std::isnan (tA) || std::isnan (tB) ){
@@ -178,6 +216,23 @@ namespace
178216 }
179217 }
180218
219+ /* *
220+ * @brief Solve BSB Trochoid path. Closed form solution for delta_1==delta_2, or numerically sovled with Eq. 39 in Techy (2009)
221+ *
222+ * @param p0 Guess value of t_A for root solving
223+ * @param delta_1 Turning direction of the starting trochoid
224+ * @param delta_2 Turning direction of the ending trochoid
225+ * @param k Number of turns
226+ * @param xt10 Constant defined in Eq. (20) in Techy (2009)
227+ * @param yt10 Constant defined in Eq. (21) in Techy (2009)
228+ * @param phit1 Initial heading in trochoid frame
229+ * @param xt20 Constaint defined in Eq. (22) in Techy (2009)
230+ * @param yt20 Constant defined in Eq. (23) in Techy (2009)
231+ * @param phit2 Target heading in trochoid frame
232+ * @param radius Minimum turn radius in air-relative frame
233+ * @param wind_ratio Wind ratio
234+ * @return double
235+ */
181236 double fixedPointBSB ( double p0, double delta_1, double delta_2, double k, double xt10, double yt10, double phit1, double xt20, double yt20, double phit2, double radius, double wind_ratio )
182237 {
183238 double tol = 0.0001 ;
@@ -206,7 +261,22 @@ namespace
206261 }
207262
208263
209-
264+ /* *
265+ * @brief Solve for trochoid BSB paths
266+ *
267+ * @param x0 Start position x
268+ * @param y0 Start position y
269+ * @param phi0 Start heading
270+ * @param xf Target position x
271+ * @param yf Target position y
272+ * @param phif End heading
273+ * @param delta_1 Turning direction of starting arc
274+ * @param delta_2 Turning direction of ending arc
275+ * @param radius Minimum air-relative turning radius
276+ * @param wind_ratio Wind ratio
277+ * @param periodic Whether the path is periodic
278+ * @param path Solved trochoid path
279+ */
210280 void trochoidBSB (double x0, double y0, double phi0, double xf, double yf, double phif, double delta_1, double delta_2, double radius, double wind_ratio, bool periodic, TrochoidStateSpace::PathType &path)
211281 {
212282
@@ -274,6 +344,26 @@ namespace
274344 return ;
275345 }
276346
347+ /* *
348+ * @brief Check conditions for BBB Path types
349+ *
350+ * @param delta_1 Turning direction of starting trochoid
351+ * @param tA Time value of the starting trochoid
352+ * @param tB Time value of the ending trochoid
353+ * @param T Total duration of path
354+ * @param xt10 Constant defined in Eq. (20) in Techy (2009)
355+ * @param yt10 Constant defined in Eq. (21) in Techy (2009)
356+ * @param phit1 Initial heading in trochoid frame
357+ * @param xf Relative target position
358+ * @param yf Relative target position
359+ * @param phif Target heading
360+ * @param radius Minimum turn radius in air-relative frame
361+ * @param wind_ratio Wind ratio
362+ * @param periodic Whether the BSB path is periodic
363+ * @param trochoid_path Calculated trochoid path object
364+ * @return true Returns true if the condiitons are conistent
365+ * @return false Reutrns false if the computed path are degenerate
366+ */
277367 bool checkConditionsBBB ( double delta_1, double tA, double tB, double T, double xt10, double yt10, double phit1, double xf, double yf, double phif, double radius, double wind_ratio, bool periodic, TrochoidStateSpace::PathType &trochoid_path){
278368
279369 if ( std::isnan (tA) || std::isnan (tB) || std::isnan (T) ){
@@ -370,6 +460,23 @@ namespace
370460
371461 }
372462
463+ /* *
464+ * @brief Root solve for BBB path type. Implementation of Section V. in Techy (2009).
465+ *
466+ * @param p0 Guess value for tA
467+ * @param p1 Guess value for T
468+ * @param delta_1 Turning direction of start trochoid
469+ * @param k Number of turns
470+ * @param xt10 Constant defined in Eq. (A1)
471+ * @param yt10 Constant defined in Eq. (A2)
472+ * @param phit1 Constant defined in Eq. (A3)
473+ * @param xf Relative Target position x
474+ * @param yf Relative Target position y
475+ * @param phif Target heading
476+ * @param radius Minimum turn radius in air-relative frame
477+ * @param wind_ratio Wind ratio
478+ * @param pvecOut Result of roots solved as a vector
479+ */
373480 void fixedpointBBB (double p0, double p1, double delta_1, double k, double xt10, double yt10, double phit1, double xf, double yf, double phif, double radius, double wind_ratio, std::vector<double > &pvecOut) {
374481 // Implement TrochoidBBB
375482 pvecOut.resize (2 );
@@ -424,7 +531,22 @@ namespace
424531 pvecOut[1 ] = std::numeric_limits<double >::quiet_NaN ();
425532 return ;
426533 }
427-
534+
535+ /* *
536+ * @brief
537+ *
538+ * @param x0 Start position x
539+ * @param y0 Start position y
540+ * @param phit1 Start heading
541+ * @param xf Target position x
542+ * @param yf Target position y
543+ * @param phif End heading
544+ * @param delta_1 Turn direction of starting arc
545+ * @param radius minimum air-relative turning radius
546+ * @param wind_ratio wind ratio
547+ * @param periodic Whether the path is periodic
548+ * @param path Computed path object
549+ */
428550 void trochoidBBB (double x0, double y0, double phit1, double xf, double yf, double phif, double delta_1, double radius, double wind_ratio, bool periodic, TrochoidStateSpace::PathType &path) {
429551 double omega = (1 /radius);
430552 double t2pi = 2.0 * onepi * radius;
0 commit comments