45 CarrotPlanner::CarrotPlanner()
46 : costmap_ros_(NULL), initialized_(false){}
66 ROS_WARN(
"This planner has already been initialized... doing nothing");
72 ROS_ERROR(
"The planner has not been initialized, please call initialize() to use the planner");
78 if(footprint.size() < 3)
83 return footprint_cost;
88 const geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& plan){
91 ROS_ERROR(
"The planner has not been initialized, please call initialize() to use the planner");
95 ROS_DEBUG(
"Got a start: %.2f, %.2f, and a goal: %.2f, %.2f", start.pose.position.x, start.pose.position.y, goal.pose.position.x, goal.pose.position.y);
101 ROS_ERROR(
"This planner as configured will only accept goals in the %s frame, but a goal was sent in the %s frame.",
109 poseStampedMsgToTF(goal,goal_tf);
110 poseStampedMsgToTF(start,start_tf);
112 double useless_pitch, useless_roll, goal_yaw, start_yaw;
113 start_tf.getBasis().getEulerYPR(start_yaw, useless_pitch, useless_roll);
114 goal_tf.getBasis().getEulerYPR(goal_yaw, useless_pitch, useless_roll);
117 double goal_x = goal.pose.position.x;
118 double goal_y = goal.pose.position.y;
119 double start_x = start.pose.position.x;
120 double start_y = start.pose.position.y;
122 double diff_x = goal_x - start_x;
123 double diff_y = goal_y - start_y;
126 double target_x = goal_x;
127 double target_y = goal_y;
128 double target_yaw = goal_yaw;
132 double dScale = 0.01;
140 target_yaw = start_yaw;
141 ROS_WARN(
"The carrot planner could not find a valid plan for this goal");
144 target_x = start_x + scale * diff_x;
145 target_y = start_y + scale * diff_y;
148 double footprint_cost =
footprintCost(target_x, target_y, target_yaw);
149 if(footprint_cost >= 0)
156 plan.push_back(start);
157 geometry_msgs::PoseStamped new_goal = goal;
160 new_goal.pose.position.x = target_x;
161 new_goal.pose.position.y = target_y;
163 new_goal.pose.orientation.x = goal_quat.x();
164 new_goal.pose.orientation.y = goal_quat.y();
165 new_goal.pose.orientation.z = goal_quat.z();
166 new_goal.pose.orientation.w = goal_quat.w();
168 plan.push_back(new_goal);
double min_dist_from_robot_
virtual double footprintCost(const geometry_msgs::Point &position, const std::vector< geometry_msgs::Point > &footprint, double inscribed_radius, double circumscribed_radius)=0
costmap_2d::Costmap2DROS * costmap_ros_
std::string getGlobalFrameID()
PLUGINLIB_EXPORT_CLASS(BAGReader, nodelet::Nodelet)
base_local_planner::WorldModel * world_model_
The world model that the controller will use.
static Quaternion createQuaternionFromYaw(double yaw)
costmap_2d::Costmap2D * costmap_
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
bool makePlan(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal, std::vector< geometry_msgs::PoseStamped > &plan)
Given a goal pose in the world, compute a plan.
Provides a simple global planner that will compute a valid goal point for the local planner by walkin...
def normalize_angle(angle)
void initialize(std::string name, costmap_2d::Costmap2DROS *costmap_ros)
Initialization function for the CarrotPlanner.
double footprintCost(double x_i, double y_i, double theta_i)
Checks the legality of the robot footprint at a position and orientation using the world model...
CarrotPlanner()
Constructor for the CarrotPlanner.
double getResolution() const
std::vector< geometry_msgs::Point > getRobotFootprint()