@@ -89,23 +89,34 @@ class SingleTrackModel : public DynamicModel {
8989 return acceleration_limits_.lat_acc_max ;
9090 }
9191
92+ /* *
93+ * @brief Calculates maximum possible lateral evasive acceleration away from center line of a lane
94+ * assuming single track vehicle dynamics
95+ *
96+ * @param v velocity of vehicle in global coordinate system
97+ * @param theta orientation of vehicle in global coordinate system
98+ * @param tangent_angle angle of center line in global coordinate system, assumed to be constant over time
99+ * @param a_total_max maximum possible acceleration of vehicle into direction of orientation
100+ * @param on_left_of_center_line to calculate evasive lateral maximum acceleration, flag indicates on which side
101+ * of center line the vehicle is
102+ * @return double maximum possible lateral evasive acceleration
103+ */
92104 double CalculateLatAccelerationMaxAtFrenetAngle (const double &v, const double & theta,
93105 const double & tangent_angle,
94- const double a_long_max ,
106+ const double a_total_max ,
95107 bool on_left_of_center_line) const {
96108 const auto max_acc_lat_dyn = GetLatAccelerationMax ();
97109 const double delta_max = std::atan2 (max_acc_lat_dyn * wheel_base_, v * v);
98110 double delta_max_evasive;
99111 const double abs_angle_diff = std::abs (bark::geometry::SignedAngleDiff (theta, tangent_angle));
100- const double evasive_sign = abs_angle_diff < bark::geometry::B_PI_2;
101112 if ((on_left_of_center_line && abs_angle_diff < bark::geometry::B_PI_2) ||
102113 (!on_left_of_center_line && abs_angle_diff > bark::geometry::B_PI_2)) {
103114 delta_max_evasive = delta_max;
104115 } else {
105116 delta_max_evasive = delta_max;
106117 }
107118 const double max_lat_acc_from_steering = v*v*sin (delta_max_evasive)/wheel_base_*cos (tangent_angle+theta);
108- const double max_lat_acc_from_long_acc = std::abs (a_long_max )*(sin (tangent_angle-theta));
119+ const double max_lat_acc_from_long_acc = std::abs (a_total_max )*(sin (tangent_angle-theta));
109120 const double max_lat_acc = max_lat_acc_from_long_acc-max_lat_acc_from_steering;
110121 return std::abs (max_lat_acc);
111122 }
0 commit comments