This commit is contained in:
acki
2025-05-30 08:26:37 -04:00
parent 6f5220738b
commit 14046bce71
2 changed files with 10 additions and 2 deletions

View File

@@ -95,7 +95,7 @@ namespace Modelec
bool EnemyOnPath(const modelec_interfaces::msg::OdometryPos msg);
bool Replan(bool force = true);
bool Replan(bool force = false);
void SetTeamId(int id);

View File

@@ -587,7 +587,15 @@ namespace Modelec
if (EnemyOnPath(*msg))
{
RCLCPP_INFO(node_->get_logger(), "Enemy is blocking the path, replanning...");
Replan();
if (!Replan())
{
RCLCPP_WARN(node_->get_logger(), "Replanning failed, stopping odometry...");
std_msgs::msg::Bool start_odo_msg;
start_odo_msg.data = false;
start_odo_pub_->publish(start_odo_msg);
last_was_close_enemy_ = true;
}
}
}