#ifndef _SPACE_OBSTACLE_AREA_H_ #define _SPACE_OBSTACLE_AREA_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "obstacle/rigid_transform.h" #include "common/common.h" #include namespace obs { namespace obs_private_common { typedef struct { float x; float y; }Point; typedef struct { float x; float y; float theta; }Pose2D; typedef struct { float x; float y; float z; }Pose3D; typedef struct { std::vector poses; }Area; typedef struct { std::vector poses; }Path; struct Twist{ Twist() : translation(0), rotate(0), horizontal(0) {} float translation; float horizontal; float rotate; }; struct Obstacle { std::vector obstacle_pose; ros::Time stamp; }; } // namespace obs_private_common using namespace obs_private_common; class ObstacleIdentify { public: ObstacleIdentify(); ~ObstacleIdentify(); void updateFootPrint(); bool isObstacleInArea(const float& x, const float& y, const float& theta, float& distance); bool isClose(common::Point pp); void stop() { for (auto& s : subs_) { s.shutdown(); } on_ = false; } void start(); private: struct IgnoreParam { IgnoreParam() { x_upper = 0.0; x_lower = 0.0; y_upper = 0.0; y_lower = 0.0; angle_upper = 0.0; angle_lower = 0.0; } float x_upper; float x_lower; float y_upper; float y_lower; float angle_upper; float angle_lower; }; struct LaserParam { LaserParam() : min_range(0.0), max_range(1e10) {} float min_range; float max_range; float angle_increment; std::vector ignores; }; struct CameraParam { CameraParam() : filter_step(3), z_ceil(1e10), z_floor(-1e10), x_head(1e10), x_tail(-1e10), y_left(1e10), y_right(-1e10), pit_top(-1e10), pit_bot(-1e10) {} int filter_step; float z_ceil; float z_floor; float x_head; float x_tail; float y_left; float y_right; float pit_top; float pit_bot; std::vector ignores; }; struct CloseClose { CloseClose() : x(0.0), y(0.0), close_dist(0.0) {} float x; float y; float close_dist; }; ros::NodeHandle nh_; void __laserCallback(const sensor_msgs::LaserScanConstPtr& msg); void __cameraCallback(const sensor_msgs::PointCloud2ConstPtr& msg); void __addObs(std::vector& obs, const std::string sensor_name, ros::Time time); void __registerLaser(); void __registerCamera(); void __readConfig(); void __getPrintFoot(); std::vector __getParseObs(); bool __isIgnore(float x, float y, float angle, std::vector ignores); bool __poseInArea(Pose2D point,Area area); Pose2D __trasformBaseLink(Pose2D pose, const Eigen::Matrix& transform); Pose2D __localTransGlobal(Pose2D a, Pose2D b); std::vector subs_; ros::Publisher point_cloud_pub_, point_cloud3D_pub_; ros::Publisher dynamic_polygon_pub_; ros::Publisher static_polygon_pub_; std::vector laser_date_; std::vector close_closes_; std::map obs_; std::map camera_params_; std::map laser_params_; Area foot_; std::map> transforms_; bool debug_, debug_3d_, turn_off_, on_; float min_range_, max_range_; boost::mutex mutex_; }; } #endif