Go to the documentation of this file.00001
00012 #ifndef FURNITURE_LAYER_H_
00013 #define FURNITURE_LAYER_H_
00014 #include <carl_navigation/BlockedCells.h>
00015 #include <costmap_2d/layer.h>
00016 #include <costmap_2d/layered_costmap.h>
00017 #include <costmap_2d/GenericPluginConfig.h>
00018 #include <dynamic_reconfigure/server.h>
00019 #include <nav_msgs/OccupancyGrid.h>
00020 #include <ros/ros.h>
00021 #include <rail_ceiling/GetAllObstacles.h>
00022 #include <rail_ceiling/Obstacles.h>
00023 #include <tf/transform_listener.h>
00024
00025 namespace furniture_layer_namespace
00026 {
00027
00028 class FurnitureLayer : public costmap_2d::Layer, public costmap_2d::Costmap2D
00029 {
00030 public:
00031 FurnitureLayer();
00032
00033 virtual void onInitialize();
00034 virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double *min_x, double *min_y, double *max_x, double *max_y);
00035 virtual void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
00036 bool isDiscretized()
00037 {
00038 return true;
00039 }
00040
00041 virtual void matchSize();
00042
00043 private:
00044 void reconfigureCB(costmap_2d::GenericPluginConfig &config, uint32_t level);
00045 dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig> *dsrv_;
00046
00052 void updateFurnitureCallback(const rail_ceiling::Obstacles::ConstPtr &obs);
00053
00060 void getInitialObstacles();
00061
00062 ros::NodeHandle n;
00063
00064 ros::Subscriber obstacleSubscriber;
00065 ros::Publisher localizationGridPublisher;
00066 ros::Publisher localObstaclesPublisher;
00067
00068 ros::ServiceClient initialObstaclesClient;
00069
00070 bool updateReceived;
00071 std::vector<rail_ceiling::Obstacle> navigationObstacles;
00072 std::vector<rail_ceiling::Obstacle> localizationObstacles;
00073
00074
00075 double prevMaxX;
00076 double prevMaxY;
00077 double prevMinX;
00078 double prevMinY;
00079 };
00080
00081
00082 class FurnitureLayerLocal : public costmap_2d::Layer, public costmap_2d::Costmap2D
00083 {
00084 public:
00085 FurnitureLayerLocal();
00086
00087 virtual void onInitialize();
00088 virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double *min_x, double *min_y, double *max_x, double *max_y);
00089 virtual void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
00090 bool isDiscretized()
00091 {
00092 return true;
00093 }
00094
00095 virtual void matchSize();
00096
00097 private:
00098 void reconfigureCB(costmap_2d::GenericPluginConfig &config, uint32_t level);
00099 dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig> *dsrv_;
00100
00106 void updateObstaclePointsCallback(const carl_navigation::BlockedCells::ConstPtr &obs);
00107
00108 ros::NodeHandle n;
00109
00110 ros::Subscriber obstaclePointsSubscriber;
00111
00112 std::vector<geometry_msgs::Point> obstaclePoints;
00113 std::vector<geometry_msgs::Point> transformedPoints;
00114
00115 tf::TransformListener tfListener;
00116
00117 double mark_x, mark_y;
00118
00119
00120 double prevMaxX;
00121 double prevMaxY;
00122 double prevMinX;
00123 double prevMinY;
00124 };
00125 }
00126 #endif