给下列程序添加注释: bool DWAPlannerROS::isGoalReached() { if (! isInitialized()) { ROS_ERROR("This planner has not been initialized, please call initialize() before using this planner"); return false; } if ( ! costmap_ros_->getRobotPose(current_pose_)) { ROS_ERROR("Could not get robot pose"); return false; } if(latchedStopRotateController_.isGoalReached(&planner_util_, odom_helper_, current_pose_)) { ROS_INFO("Goal reached"); return true; } else { return false; } }
时间: 2024-03-31 20:31:50 浏览: 140
// 判断是否到达目标点的函数
bool DWAPlannerROS::isGoalReached() {
// 判断规划器是否被初始化,如果没有则输出错误信息并返回false
if (! isInitialized()) {
ROS_ERROR("This planner has not been initialized, please call initialize() before using this planner");
return false;
}
// 获取机器人当前位置,如果获取失败则输出错误信息并返回false
if ( ! costmap_ros_->getRobotPose(current_pose_)) {
ROS_ERROR("Could not get robot pose");
return false;
}
// 判断是否到达目标点,如果到达则输出提示信息并返回true,否则返回false
if(latchedStopRotateController_.isGoalReached(&planner_util_, odom_helper_, current_pose_)) {
ROS_INFO("Goal reached");
return true;
} else {
return false;
}
}
阅读全文