File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
micras_nav/include/micras/nav/actions Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -136,10 +136,11 @@ class TurnAction : public Action {
136136 }
137137
138138 const float radius_speed_ratio = curve_radius / linear_speed;
139- const float discriminant = std::pow (radius_speed_ratio, 2 .0F ) -
140- (2 .0F * (1 - std::cos (angle))) / (correction_factor * max_angular_acceleration);
139+ const float quadratic_term =
140+ 1 .0F / (std::pow (1 - std::cos (angle), 2 .0F ) * correction_factor * max_angular_acceleration);
141+ const float discriminant = std::pow (radius_speed_ratio, 2 .0F ) - 4 .0F * quadratic_term;
141142
142- return correction_factor * max_angular_acceleration * ( radius_speed_ratio - std::sqrt (discriminant));
143+ return - radius_speed_ratio - std::sqrt (discriminant) / ( 2 . 0F * quadratic_term );
143144 }
144145
145146 static constexpr float calculate_total_time (float angle, float max_angular_speed, float max_angular_acceleration) {
You can’t perform that action at this time.
0 commit comments