diff --git a/src/rm_nav/rm_simple_move/src/simple_move.cpp b/src/rm_nav/rm_simple_move/src/simple_move.cpp index c4f9993..d7e7bcc 100644 --- a/src/rm_nav/rm_simple_move/src/simple_move.cpp +++ b/src/rm_nav/rm_simple_move/src/simple_move.cpp @@ -132,13 +132,9 @@ namespace rm_simpal_move */ void RMSimpleMove::timer_callback() { - if (!has_goal_) { - return; - } - try { - // 获取当前位置 + // 获取当前位置(始终发布,不管有没有目标) auto trans = tf_buffer_.lookupTransform("map", "base_link", tf2::TimePointZero); AHRS_GetEulr(¤t_eulr_, trans.transform.rotation); @@ -152,6 +148,11 @@ namespace rm_simpal_move current_pose_msg.pose.orientation = trans.transform.rotation; current_pose_pub_->publish(current_pose_msg); + // 如果没有目标,只发布当前位置,不执行控制 + if (!has_goal_) { + return; + } + // 发布目标点 TF geometry_msgs::msg::TransformStamped goal_transform; goal_transform.header.stamp = this->get_clock()->now();