给下列程序添加英文注释:if (latchedStopRotateController_.isPositionReached(&planner_util_, current_pose_)) { //publish an empty plan because we've reached our goal position std::vector<geometry_msgs::PoseStamped> local_plan; std::vector<geometry_msgs::PoseStamped> transformed_plan; publishGlobalPlan(transformed_plan); publishLocalPlan(local_plan); base_local_planner::LocalPlannerLimits limits = planner_util_.getCurrentLimits(); return latchedStopRotateController_.computeVelocityCommandsStopRotate( cmd_vel, limits.getAccLimits(), dp_->getSimPeriod(), &planner_util_, odom_helper_, current_pose_, boost::bind(&DWAPlanner::checkTrajectory, dp_, _1, _2, _3)); } else { bool isOk = dwaComputeVelocityCommands(current_pose_, cmd_vel); if (isOk) { publishGlobalPlan(transformed_plan); } else { ROS_WARN_NAMED("dwa_local_planner", "DWA planner failed to produce path."); std::vector<geometry_msgs::PoseStamped> empty_plan; publishGlobalPlan(empty_plan); } return isOk; }
时间: 2024-03-30 18:41:04 浏览: 78
// 判断是否到达目标位置
if (latchedStopRotateController_.isPositionReached(&planner_util_, current_pose_)) {
// 发布空路径,因为已经到达目标位置
std::vector<geometry_msgs::PoseStamped> local_plan;
std::vector<geometry_msgs::PoseStamped> transformed_plan;
publishGlobalPlan(transformed_plan);
publishLocalPlan(local_plan);
base_local_planner::LocalPlannerLimits limits = planner_util_.getCurrentLimits();
// 计算机器人下一步的速度指令
return latchedStopRotateController_.computeVelocityCommandsStopRotate(
cmd_vel, // 输出的速度指令
limits.getAccLimits(), // 加速度限制
dp_->getSimPeriod(), // 模拟时间步长
&planner_util_, // 规划器的实用工具
odom_helper_, // 里程计助手
current_pose_, // 当前机器人位姿
boost::bind(&DWAPlanner::checkTrajectory, dp_, _1, _2, _3) // 检查路径轨迹是否有效的回调函数
);
} else {
// 计算机器人下一步的速度指令
bool isOk = dwaComputeVelocityCommands(current_pose_, cmd_vel);
if (isOk) {
// 发布全局路径
publishGlobalPlan(transformed_plan);
} else {
// 输出警告信息并发布空路径
ROS_WARN_NAMED("dwa_local_planner", "DWA planner failed to produce path.");
std::vector<geometry_msgs::PoseStamped> empty_plan;
publishGlobalPlan(empty_plan);
}
return isOk;
}
阅读全文