54 #include "sensor_msgs/SetCameraInfo.h" 55 #include "sensor_msgs/CameraInfo.h" 56 #include "visp_camera_calibration/CalibPoint.h" 70 point_correspondence_callback);
82 vpCalibration calib_all_points;
83 calib_all_points.clearPoint();
85 for(std::vector<visp_camera_calibration::CalibPoint>::const_iterator i = point_correspondence->points.begin();
86 i != point_correspondence->points.end();
89 vpImagePoint ip(i->i,i->j);
90 calib_all_points.addPoint(i->X,i->Y,i->Z,ip);
97 std::vector<double> dev;
98 std::vector<double> dev_dist;
100 ROS_INFO(
"called service calibrate");
101 vpCameraParameters cam;
103 double px = cam.get_px();
104 double py = cam.get_px();
105 double u0 = req.sample_width/2;
106 double v0 = req.sample_height/2;
109 cam.initPersProjWithoutDistortion(px, py, u0, v0);
110 vpCalibration::setLambda(lambda);
112 vpCalibration::computeCalibrationMulti(vpCalibration::vpCalibrationMethodType(req.method),
calibrations_, cam, error,
false);
114 for(std::vector<vpCalibration>::iterator i=
calibrations_.begin();
119 double deviation_dist;
122 i->computeStdDeviation(deviation,deviation_dist);
123 dev.push_back(deviation);
124 dev_dist.push_back(deviation_dist);
127 case vpCalibration::CALIB_LAGRANGE_VIRTUAL_VS:
128 case vpCalibration::CALIB_VIRTUAL_VS:
129 res.stdDevErrs = dev;
131 case vpCalibration::CALIB_LAGRANGE_VIRTUAL_VS_DIST:
132 case vpCalibration::CALIB_VIRTUAL_VS_DIST:
133 res.stdDevErrs= dev_dist;
139 sensor_msgs::SetCameraInfo set_camera_info_comm;
145 ROS_INFO(
"set_camera_info service called successfully");
147 ROS_ERROR(
"Failed to call service set_camera_info");
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
ros::Subscriber point_correspondence_subscriber_
ros::ServiceServer calibrate_service_
std::vector< vpCalibration > calibrations_
sensor_msgs::CameraInfo toSensorMsgsCameraInfo(vpCameraParameters &cam_info, unsigned int cam_image_width, unsigned int cam_image_height)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
unsigned long queue_size_
bool call(MReq &req, MRes &res)
bool calibrateCallback(visp_camera_calibration::calibrate::Request &req, visp_camera_calibration::calibrate::Response &res)
service performing the calibration from all previously computed calibration objects.
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
std::string point_correspondence_topic
std::string calibrate_service
boost::function< bool(visp_camera_calibration::calibrate::Request &, visp_camera_calibration::calibrate::Response &res)> calibrate_service_callback_t
service type declaration for calibrate service
std::string set_camera_info_bis_service
ros::ServiceClient set_camera_info_bis_service_
boost::function< void(const visp_camera_calibration::CalibPointArray::ConstPtr &)> point_correspondence_subscriber_callback_t
subscriber type declaration for raw_image topic subscriber
#define ROS_INFO_STREAM(args)
ros::ServiceClient set_camera_info_service_
std::string set_camera_info_service
void pointCorrespondenceCallback(const visp_camera_calibration::CalibPointArray::ConstPtr &point_correspondence)
callback corresponding to the point_correspondence topic. Adds the obtained calibration pairs objects...