48 RCLCPP_INFO_STREAM(
getLogger(),
"[CbAbsoluteRotate] Absolute yaw Angle:" << goal_angle);
60 plannerSwitcher->setDefaultPlanners();
67 auto currentPoseMsg = p->toPoseMsg();
70 goal.pose.header.frame_id = referenceFrame;
73 auto targetAngle = goal_angle * M_PI / 180.0;
74 goal.pose.pose.position = currentPoseMsg.position;
76 q.setRPY(0, 0, targetAngle);
77 goal.pose.pose.orientation = tf2::toMsg(q);
80 if (odomTracker_ !=
nullptr)
83 odomTracker_->pushPath(pathname);
84 odomTracker_->setStartPoint(p->toPoseStampedMsg());
85 odomTracker_->setCurrentMotionGoal(goal.pose);
94 "[" <<
getName() <<
"] current pose yaw: " << tf2::getYaw(currentPoseMsg.orientation));
97 "[" <<
getName() <<
"] goal pose yaw: " << tf2::getYaw(goal.pose.pose.orientation));
105 std::string nodename =
"/controller_server";
107 auto parameters_client =
108 std::make_shared<rclcpp::AsyncParametersClient>(this->
getNode(), nodename);
111 log,
"[" <<
getName() <<
"] using a parameter client to update some controller parameters: "
112 << nodename <<
". Waiting service.");
113 parameters_client->wait_for_service();
115 RCLCPP_INFO_STREAM(log,
"[" <<
getName() <<
"] Service found: " << nodename <<
".");
117 std::string localPlannerName;
118 std::vector<rclcpp::Parameter> parameters;
121 rclcpp::Parameter yaw_goal_tolerance(
"goal_checker.yaw_goal_tolerance");
123 rclcpp::Parameter max_vel_theta, min_vel_theta;
129 if (isPureSpinningPlanner)
131 localPlannerName =
"PureSpinningLocalPlanner";
132 max_vel_theta = rclcpp::Parameter(localPlannerName +
".max_angular_z_speed");
133 min_vel_theta = rclcpp::Parameter(localPlannerName +
".min_vel_theta");
135 else if (isRosBasePlanner)
137 localPlannerName =
"FollowPath";
138 max_vel_theta = rclcpp::Parameter(localPlannerName +
".max_vel_theta");
139 min_vel_theta = rclcpp::Parameter(localPlannerName +
".min_vel_theta");
147 auto fut = parameters_client->get_parameters(
148 {localPlannerName +
".yaw_goal_tolerance"},
149 [&](
auto futureParameters)
151 auto params = futureParameters.get();
158 yaw_goal_tolerance = rclcpp::Parameter(
"goal_checker.yaw_goal_tolerance", *
yawGoalTolerance);
159 parameters.push_back(yaw_goal_tolerance);
168 if (isRosBasePlanner)
174 auto fut = parameters_client->get_parameters(
175 {localPlannerName +
".max_vel_theta"},
176 [&](
auto futureParameters)
178 auto params = futureParameters.get();
186 max_vel_theta = rclcpp::Parameter(localPlannerName +
".max_vel_theta", *
maxVelTheta);
187 min_vel_theta = rclcpp::Parameter(localPlannerName +
".min_vel_theta", -*
maxVelTheta);
188 parameters.push_back(max_vel_theta);
189 parameters.push_back(min_vel_theta);
192 log,
"[" <<
getName() <<
"] updating max vel theta local planner to: " << *
maxVelTheta
195 log,
"[" <<
getName() <<
"] updating min vel theta local planner to: " << -*
maxVelTheta
203 yaw_goal_tolerance = rclcpp::Parameter(
"goal_checker.yaw_goal_tolerance",
oldYawTolerance);
205 log,
"[" <<
getName() <<
"] restoring yaw tolerance local planner from: "
211 if (isRosBasePlanner)
213 max_vel_theta = rclcpp::Parameter(localPlannerName +
".max_vel_theta",
oldMaxVelTheta);
214 min_vel_theta = rclcpp::Parameter(localPlannerName +
".max_vel_theta",
oldMinVelTheta);
217 parameters.push_back(max_vel_theta);
218 parameters.push_back(min_vel_theta);
220 log,
"[" <<
getName() <<
"] restoring max vel theta local planner from: " << *
maxVelTheta
223 log,
"[" <<
getName() <<
"] restoring min vel theta local planner from: " << -(*
maxVelTheta)
228 if (parameters.size())
230 std::stringstream ss;
231 ss <<
"Executing asynchronous request. Parameters to update: " << std::endl;
232 for (
auto & p : parameters)
234 ss << p.get_name() <<
" - " << p.value_to_string() << std::endl;
237 RCLCPP_INFO_STREAM(
getLogger(),
"[CbAbsoluteRotate] " << ss.str());
239 auto futureResults = parameters_client->set_parameters(parameters);
242 for (
auto & res : futureResults.get())
245 getLogger(),
"[" <<
getName() <<
"] parameter result: " << parameters[i].get_name() <<
"="
246 << parameters[i].as_string() <<
". Result: " << res.successful);
250 RCLCPP_INFO_STREAM(log,
"[" <<
getName() <<
"] parameters updated");
254 RCLCPP_INFO_STREAM(log,
"[" <<
getName() <<
"] skipping parameters update");