16 if (yaw_goal_tolerance >= 0)
24 dynamic_reconfigure::ReconfigureRequest srv_req;
25 dynamic_reconfigure::ReconfigureResponse srv_resp;
26 dynamic_reconfigure::Config conf;
29 std::string nodename =
"/move_base";
30 std::string localPlannerName;
31 dynamic_reconfigure::DoubleParameter yaw_goal_tolerance;
32 yaw_goal_tolerance.name =
"yaw_goal_tolerance";
34 dynamic_reconfigure::DoubleParameter max_vel_theta;
35 dynamic_reconfigure::DoubleParameter min_vel_theta;
39 if (isPureSpinningPlanner)
41 localPlannerName =
"PureSpinningLocalPlanner";
42 max_vel_theta.name =
"max_angular_z_speed";
43 min_vel_theta.name =
"min_vel_theta";
45 else if (isRosBasePlanner)
47 localPlannerName =
"TrajectoryPlannerROS";
48 max_vel_theta.name =
"max_vel_theta";
49 min_vel_theta.name =
"min_vel_theta";
57 nh.getParam(nodename +
"/" + localPlannerName +
"/yaw_goal_tolerance",
oldYawTolerance);
59 conf.doubles.push_back(yaw_goal_tolerance);
60 ROS_INFO(
"[CbAbsoluteRotate] updating yaw tolerance local planner to: %lf, from previous value: %lf ",
70 nh.getParam(nodename +
"/" + localPlannerName +
"/max_vel_theta",
oldMaxVelTheta);
74 conf.doubles.push_back(max_vel_theta);
75 conf.doubles.push_back(min_vel_theta);
76 ROS_INFO(
"[CbAbsoluteRotate] updating max vel theta local planner to: %lf, from previous value: %lf ",
78 ROS_INFO(
"[CbAbsoluteRotate] updating min vel theta local planner to: %lf, from previous value: %lf ",
87 conf.doubles.push_back(yaw_goal_tolerance);
88 ROS_INFO(
"[CbAbsoluteRotate] restoring yaw tolerance local planner from: %lf, to previous value: %lf ",
100 conf.doubles.push_back(max_vel_theta);
101 conf.doubles.push_back(min_vel_theta);
102 ROS_INFO(
"[CbAbsoluteRotate] restoring max vel theta local planner from: %lf, to previous value: %lf ",
104 ROS_INFO(
"[CbAbsoluteRotate] restoring min vel theta local planner from: %lf, to previous value: %lf ",
109 srv_req.config = conf;
113 std::string servername = nodename +
"/" + localPlannerName +
"/set_parameters";
114 res = ros::service::call(servername, srv_req, srv_resp);
115 ROS_INFO_STREAM(
"[CbAbsoluteRotate] dynamic configure call [" << servername <<
"]: " << res);
119 ros::Duration(0.1).sleep();
120 ROS_INFO(
"[CbAbsoluteRotate] Failed, retrtying call");
158 plannerSwitcher->setDefaultPlanners();
164 auto currentPoseMsg = p->toPoseMsg();
166 ClMoveBaseZ::Goal goal;
167 goal.target_pose.header.frame_id = referenceFrame;
168 goal.target_pose.header.stamp = ros::Time::now();
170 auto currentAngle = tf::getYaw(currentPoseMsg.orientation);
171 auto targetAngle = goal_angle * M_PI / 180.0;
172 goal.target_pose.pose.position = currentPoseMsg.position;
173 goal.target_pose.pose.orientation = tf::createQuaternionMsgFromYaw(targetAngle);
176 if (odomTracker_ !=
nullptr)
178 odomTracker_->
pushPath(
"PureSpinningToAbsoluteGoalOrientation");
179 odomTracker_->setStartPoint(p->toPoseStampedMsg());
183 ROS_INFO_STREAM(
"[CbAbsoluteRotate] current pose: " << currentPoseMsg);
184 ROS_INFO_STREAM(
"[CbAbsoluteRotate] goal pose: " << goal.target_pose.pose);
virtual void onExit() override
virtual void onEntry() override
boost::optional< SpiningPlanner > spinningPlanner
void updateTemporalBehaviorParameters(bool undo)
boost::optional< float > yawGoalTolerance
boost::optional< float > maxVelTheta
boost::optional< float > absoluteGoalAngleDegree
ClMoveBaseZ * moveBaseClient_
void setPureSpinningPlanner()
const std::string & getReferenceFrame() const
This class track the required distance of the cord based on the external localization system.
void pushPath(std::string newPathTagName="")
ISmaccState * getCurrentState()
TComponent * getComponent()
bool param(std::string param_name, T ¶m_val, const T &default_val) const
void sendGoal(Goal &goal)