32 #ifndef PIPELINEPLANNER_H 33 #define PIPELINEPLANNER_H 36 #include <geometry_msgs/PoseStamped.h> 37 #include <geometry_msgs/PoseArray.h> 38 #include <geometry_msgs/Pose.h> 39 #include <geometry_msgs/Point.h> 40 #include <nav_msgs/Path.h> 44 #include <nav_msgs/GetPlan.h> 45 #include <dynamic_reconfigure/server.h> 51 #include <pipeline_planner/PipelinePlannerConfig.h> 52 #include <pipeline_planner/RobotPosition.h> 53 #include <pipeline_planner/SegmentInfo.h> 54 #include <std_msgs/UInt32.h> 55 #include <std_msgs/Float32.h> 56 #include <std_msgs/Bool.h> 57 #include <pipeline_planner/GetReadStatus.h> 58 #include <pipeline_planner/GetRobotStatus.h> 59 #include <pipeline_planner/GetCheckpoints.h> 60 #include <pipeline_planner/GetNumofCheckpoints.h> 61 #include <pipeline_planner/InquireSegments.h> 62 #include <pipeline_planner/ReceiveCheckpoints.h> 63 #include <pipeline_planner/SetARadius.h> 64 #include <pipeline_planner/SetARightshift.h> 66 #include <move_base_msgs/MoveBaseAction.h> 67 #include <boost/thread.hpp> 113 bool ReceiveCheckpoints(pipeline_planner::ReceiveCheckpoints::Request &req,pipeline_planner::ReceiveCheckpoints::Response &res);
150 void setTorchArea(
bool use_torch,
float torch_area_x,
float torch_area_y){
165 const geometry_msgs::PoseStamped&
goal,
166 std::vector<geometry_msgs::PoseStamped>& plan);
175 void reconfigureCB(pipeline_planner::PipelinePlannerConfig &config,uint32_t level);
183 bool getReadStatus(pipeline_planner::GetReadStatus::Request &req,pipeline_planner::GetReadStatus::Response &res){
194 bool getRobotStatus(pipeline_planner::GetRobotStatus::Request &req,pipeline_planner::GetRobotStatus::Response &res){
205 bool getCheckpoints(pipeline_planner::GetCheckpoints::Request &req,pipeline_planner::GetCheckpoints::Response &res){
208 res.checkpoints.resize(size);
228 bool getNumofCheckpoints(pipeline_planner::GetNumofCheckpoints::Request &req,pipeline_planner::GetNumofCheckpoints::Response &res){
240 bool InquireSegments(pipeline_planner::InquireSegments::Request &req,pipeline_planner::InquireSegments::Response &res);
257 bool SetARadius(pipeline_planner::SetARadius::Request &req,pipeline_planner::SetARadius::Response &res);
270 bool SetARightshift(pipeline_planner::SetARightshift::Request &req,pipeline_planner::SetARightshift::Response &res);
296 bool InPipeSegment(
const geometry_msgs::PoseStamped& pose,
double radius,
double start_edge_radius,
double end_edge_radius,
double tolerance,
int index);
306 const geometry_msgs::PoseStamped& start,
307 const geometry_msgs::PoseStamped& goal);
315 bool hasNoCross(
const int endpoint,
const std::vector<geometry_msgs::PoseStamped> check_points);
350 bool VeilCostmap(
const std::vector<int> segids,
const int startindex,
351 const int goalindex,
const geometry_msgs::PoseStamped& start);
361 bool ConnectPoints(
const geometry_msgs::PoseStamped& start,
const geometry_msgs::PoseStamped& goal,
362 const std::vector<int> segids,std::vector<geometry_msgs::PoseStamped>& plan);
372 const geometry_msgs::PoseStamped end_point,
373 std::vector<geometry_msgs::PoseStamped>& plan);
377 dynamic_reconfigure::Server<pipeline_planner::PipelinePlannerConfig> *
dsrv_;
405 bool whereInaPipeSegment(
const geometry_msgs::Pose pose,
const int id,
const double radius,
const double sradius,
const double eradius,
int&
part,
double &
dist,
double tolerance);
411 void publishPlan(
const std::vector<geometry_msgs::PoseStamped>& path);
426 void calcPipeline(
const int numcheckpoints,
const double *stonex,
const double *stoney,
const bool isClose,
const double *radii,
const double *sradii,
const double *eradii,
const double origin_x,
const double origin_y,
const unsigned int costsizex,
const unsigned int costsizey,
const double resolution,
int *data);
432 void callbackgoal(
const move_base_msgs::MoveBaseActionGoal::ConstPtr& goal);
450 void TimeDisplay(
const bool time_display,
const double duration);
470 const geometry_msgs::PoseStamped& goal,
471 geometry_msgs::PoseStamped& local_goal,
int& err);
490 const double sx,
const double sy,
491 const double ex,
const double ey,
492 double& bx,
double& by);
586 const int goalindex,
const geometry_msgs::PoseStamped& start);
void makePipeline()
To make a pipeline and publish it as a topic Pipeline is constructed from check_points_. Validity of checkpoints_ must be checked in advance. Publication data values 0:in the pipeline, 100:out of the pipeline.
std::vector< pipeline_planner::SegmentInfo > segment_infos_
bool ReceiveCheckpoints(pipeline_planner::ReceiveCheckpoints::Request &req, pipeline_planner::ReceiveCheckpoints::Response &res)
Reception of checkpoints.
bool DistanceFromCentre_cuda(int endpoint)
Calculation of cell's distance from pipe centre.
void initialize(std::string name, costmap_2d::Costmap2DROS *costmap_ros)
Initialisation function for the Planner.
bool VeilCostmap_cuda(const std::vector< int > segids, const int startindex, const int goalindex, const geometry_msgs::PoseStamped &start)
To veil costmap other than that in pipeline segments.
ros::Publisher pub_status_
bool InitSegInfo()
Initialisation of segment info.
void TimeDisplay(const bool time_display, const double duration)
Display consumed time on makePlan function.
bool getRobotStatus(pipeline_planner::GetRobotStatus::Request &req, pipeline_planner::GetRobotStatus::Response &res)
Get the status of a robot.
int CrossTorchArea(const double tx, const double ty, const double sx, const double sy, const double ex, const double ey, double &bx, double &by)
Whether the line segment crosses the torch area boundary or not.
ros::ServiceServer set_a_radius_srv_
void setLethal(unsigned char lethal_cost)
void callbackgoal(const move_base_msgs::MoveBaseActionGoal::ConstPtr &goal)
Callback function for reception of actionlib goal.
nav_msgs::OccupancyGrid pipeline_
bool isBehindInaSegment(int idx, const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal)
Whether the goal point is behind the start point in a pipe segment.
void setNumThread(float num_threads)
void setStraight(bool use_straight)
void informRobotPose()
loop for informing the robot position by a thread
ros::ServiceServer set_a_rightshift_srv_
std_msgs::UInt32 robot_status_
ros::ServiceServer receive_checkpoints_srv_
ros::ServiceServer read_state_srv_
ros::ServiceServer get_checkpoints_srv_
std_msgs::Float32 consumed_time_
void callbackRobotPose(const geometry_msgs::Pose::ConstPtr &pose)
Callback function for reception of robot position.
unsigned char lethal_cost_
void publishPlan(const std::vector< geometry_msgs::PoseStamped > &path)
To publish a path.
ros::Publisher pub_result_
bool hasNoCross(const int endpoint, const std::vector< geometry_msgs::PoseStamped > check_points)
To check whether a sequence of checkpoints has a crossing or not.
Provides a global planner that will make a route along check points gained from topic. This planner uses global_planner.
ros::ServiceServer robot_state_srv_
ros::Publisher pub_robot_position_
std::string gained_frame_id_
navfn::NavfnROS * navfn_planner_
void reconfigureCB(pipeline_planner::PipelinePlannerConfig &config, uint32_t level)
Callback function for dynamic reconfiguration.
bool DrawOpenSegment(const geometry_msgs::PoseStamped init_point, const geometry_msgs::PoseStamped end_point, std::vector< geometry_msgs::PoseStamped > &plan)
To substitute the plan along two points.
bool InquireSegments(pipeline_planner::InquireSegments::Request &req, pipeline_planner::InquireSegments::Response &res)
Inquiring segments information.
costmap_2d::Costmap2D * navfn_costmap_
bool knowRobotPosition(const geometry_msgs::Pose pose, int &ID, double &distance)
To know the position of a robot in the pipeline.
bool ConnectPoints(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal, const std::vector< int > segids, std::vector< geometry_msgs::PoseStamped > &plan)
To substitute plan by connecting start point, checkpoints and goal point.
void setPipeRadius(float radius)
substitute pipe_radius_ value when it is called from dynamic reconfigure
boost::thread * thread_robot_position_
ros::Publisher pub_initialised_
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.
ros::Publisher pub_pipeline_
PipelinePlanner()
Constructor for the PipelinePlanner.
ros::ServiceServer inquire_segments_srv_
void ThreadNumberAdjusment(bool debug)
dynamic_reconfigure::Server< pipeline_planner::PipelinePlannerConfig > * dsrv_
void PublishCheckpointsResult(std_msgs::UInt32 result)
Callback function for subscription of checkpoints data from topic.
geometry_msgs::Pose robot_position_
costmap_2d::Costmap2D * costmap_
int costCheck(int endpoint)
To check received checkpoints whether it has a problem on costmap or not.
bool getReadStatus(pipeline_planner::GetReadStatus::Request &req, pipeline_planner::GetReadStatus::Response &res)
Get the status of reading checkpoints.
void setCharge(bool charge)
ros::Subscriber sub_movebase_goal_
std_msgs::UInt32 read_status_
void calcPipeline(const int numcheckpoints, const double *stonex, const double *stoney, const bool isClose, const double *radii, const double *sradii, const double *eradii, const double origin_x, const double origin_y, const unsigned int costsizex, const unsigned int costsizey, const double resolution, int *data)
To calculate the pipeline without GPU.
bool getNumofCheckpoints(pipeline_planner::GetNumofCheckpoints::Request &req, pipeline_planner::GetNumofCheckpoints::Response &res)
Get the status of reading checkpoints.
ros::ServiceServer get_numof_checkpoints_srv_
std::vector< geometry_msgs::PoseStamped > check_points_
void setTorchArea(bool use_torch, float torch_area_x, float torch_area_y)
std::vector< double > segment_lengths_
bool InPipeSegment(const geometry_msgs::PoseStamped &pose, double radius, double start_edge_radius, double end_edge_radius, double tolerance, int index)
Verification of whether the position is in the pipeline segment or not.
bool SetARadius(pipeline_planner::SetARadius::Request &req, pipeline_planner::SetARadius::Response &res)
Service to set a pipeline segment radius.
bool VeilCostmap(const std::vector< int > segids, const int startindex, const int goalindex, const geometry_msgs::PoseStamped &start)
To veil costmap other than that in pipeline segments.
bool DistanceFromCentre(int endpoint)
Calculation of cell's distance from pipe centre.
bool getCheckpoints(pipeline_planner::GetCheckpoints::Request &req, pipeline_planner::GetCheckpoints::Response &res)
Get check points.
bool whereInaPipeSegment(const geometry_msgs::Pose pose, const int id, const double radius, const double sradius, const double eradius, int &part, double &dist, double tolerance)
To know the position of a robot in a pipe segment.
void setTimeDisplay(bool time_display)
double TakeSegmentRadius(const double contained_radius)
Taking pipline radius in a given pipeline segment.
bool TakeLocalGoal(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal, geometry_msgs::PoseStamped &local_goal, int &err)
To make local goal on torch model.
boost::mutex mutex_robot_position_
void setWeight(float centre_weight)
bool SetARightshift(pipeline_planner::SetARightshift::Request &req, pipeline_planner::SetARightshift::Response &res)
Service to set a right shift value for a pipeline segment.
ros::Subscriber sub_robot_pose_
std::vector< double > dist_from_pipe_centre_
~PipelinePlanner()
Destructor for the planner.