node.hpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2016 Delft Robotics B.V.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "camera_pose_calibration.hpp"
00018 
00019 #include <opencv2/opencv.hpp>
00020 
00021 #include <camera_pose_calibration/CalibrateFile.h>
00022 #include <camera_pose_calibration/CalibrateCall.h>
00023 #include <camera_pose_calibration/CalibrateTopic.h>
00024 #include <visualization_msgs/Marker.h>
00025 
00026 #include <pcl_ros/point_cloud.h>
00027 #include <tf/transform_listener.h>
00028 #include <tf/transform_broadcaster.h>
00029 #include <image_transport/image_transport.h>
00030 #include <ros/ros.h>
00031 
00032 
00033 namespace camera_pose_calibration {
00034 
00035 class CameraPoseCalibrationNode {
00036 public:
00037         CameraPoseCalibrationNode();
00038 
00039 protected:
00041         ros::NodeHandle node_handle;
00042 
00044         image_transport::ImageTransport image_transport;
00045 
00047         image_transport::Publisher detected_pattern_publisher;
00048 
00050         tf::TransformListener transform_listener;
00051 
00053         tf::TransformBroadcaster transform_broadcaster;
00054 
00056         ros::Publisher cloud_publisher;
00057 
00059         ros::Publisher target_cloud_publisher;
00060 
00062         ros::Publisher transformed_target_cloud_publisher;
00063 
00065         ros::Publisher source_cloud_publisher;
00066 
00068         ros::Publisher projected_source_cloud_publisher;
00069 
00071         ros::Publisher calibration_plane_marker_publisher;
00072 
00074         ros::ServiceServer calibrate_server_call;
00075 
00077         ros::ServiceServer calibrate_server_topic;
00078 
00080         ros::ServiceServer calibrate_server_file;
00081 
00083         ros::Timer tf_timer;
00084 
00086         tf::StampedTransform calibration_transform;
00087 
00089         bool publish_transform;
00090 
00092         double publish_rate;
00093 
00095         bool calibrated;
00096 
00098         void parseInput();
00099 
00101         visualization_msgs::Marker createCalibrationPlaneMarker(pcl::PointCloud<pcl::PointXYZ>::ConstPtr points, uint8_t pattern_width, uint8_t pattern_height);
00102 
00104         void onTfTimeout(ros::TimerEvent const &);
00105 
00107         bool calibrate(
00108                 sensor_msgs::Image const & sensor_msgs_image,
00109                 sensor_msgs::PointCloud2 const & sensor_msgs_cloud,
00110                 std::string const & tag_frame,
00111                 std::string const & target_frame,
00112                 double const & point_cloud_scale_x,
00113                 double const & point_cloud_scale_y,
00114                 camera_pose_calibration::PatternParameters const & pattern,
00115                 geometry_msgs::Transform & transform
00116         );
00117 
00119         bool onCalibrateFile(camera_pose_calibration::CalibrateFile::Request & req, camera_pose_calibration::CalibrateFile::Response & res);
00120 
00122         bool onCalibrateTopic(camera_pose_calibration::CalibrateTopic::Request & req, camera_pose_calibration::CalibrateTopic::Response & res);
00123 
00125         bool onCalibrateCall(camera_pose_calibration::CalibrateCall::Request & req, camera_pose_calibration::CalibrateCall::Response & res);
00126 };
00127 
00128 }


camera_pose_calibration
Author(s): Hans Gaiser , Jeff van Egmond , Maarten de Vries , Mihai Morariu , Ronald Ensing
autogenerated on Thu Jun 6 2019 20:34:08