Skip to content

Commit 47d3c7a

Browse files
committed
robot rotates in-place if the yaw error is beyond 45 degrees (#36)
1 parent bd5dcf4 commit 47d3c7a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/NeoLocalPlanner.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,14 @@ geometry_msgs::msg::TwistStamped NeoLocalPlanner::computeVelocityCommands(
762762
control_yawrate = fmin(control_yawrate, m_last_cmd_vel.angular.z + acc_lim_theta * dt);
763763
control_yawrate = fmax(control_yawrate, m_last_cmd_vel.angular.z - acc_lim_theta * dt);
764764

765+
// Avoiding arc trajectories and keeping the robot inside the global plan
766+
if (abs(yaw_error) > M_PI / 6 && !is_goal_target) {
767+
control_vel_x = 0;
768+
control_vel_y = 0;
769+
RCLCPP_INFO_THROTTLE(
770+
logger_, *clock_, 2000.0, "Changing the course of navigation");
771+
}
772+
765773
// fill return data
766774
if (m_robot_direction == -1.0) {
767775
cmd_vel.linear.x = fmax(

0 commit comments

Comments
 (0)