fix: NAV 模式在收到目标时立即发送导航请求

问题: TF 查询失败导致 timer_callback 提前退出,publish_nav_goal() 未执行

修复: 将 NAV 模式的目标发送移到 nav_goal_callback 中
- 收到目标后立即发送 Action 请求,不依赖 TF
- 避免 TF 时间戳问题影响导航功能
- 测试成功:导航到 (4, -4) 完成

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Robofish 2026-03-05 02:30:48 +08:00
parent 6286274ff2
commit f82cbf86b2

View File

@ -398,6 +398,12 @@ namespace rm_simpal_move
RCLCPP_INFO(this->get_logger(), "收到新目标: mode=%s, x=%.2f, y=%.2f, angle=%.2f",
control_mode_ == 0 ? "PID" : "NAV",
msg->target_x, msg->target_y, msg->target_angle);
// 如果是 NAV 模式,立即发送导航目标
if (control_mode_ == 1) {
publish_nav_goal();
nav_goal_sent_ = true;
}
}
/**