20 #ifndef INSPECTION_INSPECTION_H_
21 #define INSPECTION_INSPECTION_H_
24 #include <nodelet/nodelet.h>
25 #include <pluginlib/class_list_macros.h>
29 #include <tf2_ros/transform_listener.h>
30 #include <tf2_geometry_msgs/tf2_geometry_msgs.h>
33 #include <ff_util/ff_nodelet.h>
34 #include <ff_util/ff_action.h>
35 #include <ff_util/ff_service.h>
36 #include <ff_util/ff_fsm.h>
37 #include <ff_util/config_server.h>
38 #include <ff_util/config_client.h>
39 #include <msg_conversions/msg_conversions.h>
40 #include <config_reader/config_reader.h>
41 #include <ff_util/ff_flight.h>
42 #include <isaac_util/isaac_names.h>
43 #include <inspection/camera_projection.h>
46 #include <sensor_msgs/PointCloud.h>
47 #include <sensor_msgs/PointCloud2.h>
48 #include <sensor_msgs/point_cloud_conversion.h>
51 #include <visualization_msgs/MarkerArray.h>
52 #include <ff_msgs/Zone.h>
53 #include <geometry_msgs/PoseArray.h>
56 #include <ff_msgs/SetState.h>
57 #include <ff_msgs/GetZones.h>
58 #include <ff_msgs/GetMap.h>
61 #include <ff_msgs/MotionAction.h>
62 #include <ff_msgs/DockAction.h>
63 #include <isaac_msgs/ImageInspectionAction.h>
64 #include <isaac_msgs/InspectionAction.h>
67 #include <Eigen/Dense>
77 namespace inspection {
96 Inspection(ros::NodeHandle* nh, ff_util::ConfigServer* cfg);
101 bool RemoveInspectionPose();
103 geometry_msgs::PoseArray GetCurrentInspectionPose();
104 bool NextInspectionPose();
105 bool RedoInspectionPose();
106 geometry_msgs::PoseArray GetInspectionPoses();
108 int GetCurrentCounter() {
return inspection_counter_ + 1;}
109 int GetSurveySize() {
return points_.size();}
112 double GetDistanceToTarget();
115 bool GenerateAnomalySurvey(geometry_msgs::PoseArray &points_anomaly);
116 bool GenerateGeometrySurvey(geometry_msgs::PoseArray &points_geometry);
117 bool GeneratePanoramaSurvey(geometry_msgs::PoseArray &points_panorama);
118 bool GenerateVolumetricSurvey(geometry_msgs::PoseArray &points_volume);
122 void ConnectedCallback();
124 void CheckZonesTimeoutCallback();
126 void CheckMapTimeoutCallback();
129 bool TransformList(geometry_msgs::PoseArray points_in, geometry_msgs::PoseArray &points_out,
130 Eigen::Affine3d target_transform);
133 bool VisibilityConstraint(geometry_msgs::PoseArray &points, Eigen::Affine3d target_transform);
134 bool PointInsideCuboid(geometry_msgs::Point
const& x,
135 geometry_msgs::Vector3
const& cubemin,
136 geometry_msgs::Vector3
const& cubemax);
137 bool ZonesConstraint(geometry_msgs::PoseArray &points);
138 bool ObstaclesConstraint(geometry_msgs::PoseArray &points);
141 void DrawPoseMarkers(geometry_msgs::PoseArray &points,
142 ros::Publisher &publisher);
144 void DrawCameraFrustum();
147 bool GenerateSortedList(geometry_msgs::PoseArray &points);
150 ff_util::FreeFlyerServiceClient<ff_msgs::GetZones> client_z_;
151 ff_util::FreeFlyerServiceClient<ff_msgs::GetMap> client_o_;
153 tf2_ros::Buffer tf_buffer_;
154 std::shared_ptr<tf2_ros::TransformListener> tf_listener_;
158 int inspection_counter_;
160 geometry_msgs::PoseArray goal_;
161 std::vector<geometry_msgs::PoseArray> points_;
162 Eigen::Quaterniond target_to_cam_rot_;
165 std::string curr_camera_;
166 std::map<std::string, CameraView> cameras_;
169 ff_util::ConfigServer *cfg_;
170 config_reader::ConfigReader cfg_cam_;
173 double horizontal_fov_;
174 double aspect_ratio_;
175 double target_size_x_;
176 double target_size_y_;
177 std::string depth_cam_;
191 ros::Publisher pub_targets_;
192 ros::Publisher pub_markers_;
193 ros::Publisher pub_cam_;
198 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
203 #endif // INSPECTION_INSPECTION_H_