53 #include <visp/vpCalibration.h> 54 #include <visp/vpHomogeneousMatrix.h> 61 ROS_DEBUG(
"new cMo: [%f,%f,%f -- %f,%f,%f,%f]", trans->translation.x,trans->translation.y,trans->translation.z,trans->rotation.x,trans->rotation.y,trans->rotation.z,trans->rotation.w);
62 vpHomogeneousMatrix cMo;
69 ROS_DEBUG(
"new wMe: [%f,%f,%f -- %f,%f,%f,%f]", trans->translation.x,trans->translation.y,trans->translation.z,trans->rotation.x,trans->rotation.y,trans->rotation.z,trans->rotation.w);
70 vpHomogeneousMatrix wMe;
76 visp_hand2eye_calibration::compute_effector_camera::Request &req,
77 visp_hand2eye_calibration::compute_effector_camera::Response &res)
81 ROS_ERROR(
"transformation vectors have different sizes or contain too few elements");
86 vpHomogeneousMatrix eMc;
87 #if VISP_VERSION_INT > (2<<16 | 6<<8 | 1) 92 geometry_msgs::Transform trans;
95 res.effector_camera = trans;
100 visp_hand2eye_calibration::compute_effector_camera_quick::Request &req,
101 visp_hand2eye_calibration::compute_effector_camera_quick::Response &res)
103 visp_hand2eye_calibration::TransformArray camera_object = req.camera_object;
104 visp_hand2eye_calibration::TransformArray world_effector = req.world_effector;
105 std::vector<vpHomogeneousMatrix> cMo_vec;
106 std::vector<vpHomogeneousMatrix> wMe_vec;
107 for(
unsigned int i=0;i<camera_object.transforms.size();i++){
111 if (camera_object.transforms.size() != world_effector.transforms.size() || world_effector.transforms.size() < 2)
113 ROS_ERROR(
"transformation vectors have different sizes or contain too few elements");
118 vpHomogeneousMatrix eMc;
119 #if VISP_VERSION_INT > (2<<16 | 6<<8 | 1) 120 vpCalibration::calibrationTsai(cMo_vec, wMe_vec, eMc);
122 vpCalibration::calibrationTsai(cMo_vec.size(),&(cMo_vec[0]),&(wMe_vec[0]),eMc);
124 geometry_msgs::Transform trans;
126 res.effector_camera = trans;
131 visp_hand2eye_calibration::reset::Response &res)
157 compute_effector_camera_callback);
160 compute_effector_camera_quick_callback);
173 camera_object_callback);
175 world_effector_callback);
std::string camera_object_topic
ros::Subscriber camera_object_subscriber_
Calibrator node implementing a quick compute service, a compute service and 2 subscribers to world_ef...
vpHomogeneousMatrix toVispHomogeneousMatrix(const geometry_msgs::Transform &trans)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void start(const ros::V_string &topics, double duration)
ros::ServiceServer reset_service_
ros::ServiceServer compute_effector_camera_service_
std::vector< vpHomogeneousMatrix > cMo_vec_
std::string getName(void *handle)
std::string compute_effector_camera_service
std::vector< vpHomogeneousMatrix > wMe_vec_
void worldEffectorCallback(const geometry_msgs::Transform::ConstPtr &trans)
callback corresponding to the world->effector topic.
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
std::string reset_service
boost::function< void(const geometry_msgs::Transform::ConstPtr &)> camera_object_subscriber_callback_t
subscriber type declaration for camera->object topic subscriber
bool resetCallback(visp_hand2eye_calibration::reset::Request &req, visp_hand2eye_calibration::reset::Response &res)
service reseting the acumulated data
ROSCPP_DECL void spin(Spinner &spinner)
ros::Subscriber world_effector_subscriber_
Calibrator()
advertises services and subscribes to topics
std::string world_effector_topic
std::vector< std::string > V_string
boost::function< bool(visp_hand2eye_calibration::compute_effector_camera::Request &, visp_hand2eye_calibration::compute_effector_camera::Response &res)> compute_effector_camera_service_callback_t
service type declaration for effector->camera computation service
image_proc::AdvertisementChecker check_inputs_
boost::function< bool(visp_hand2eye_calibration::compute_effector_camera_quick::Request &, visp_hand2eye_calibration::compute_effector_camera_quick::Response &res)> compute_effector_camera_quick_service_callback_t
service type declaration for quick effector->camera computation service
void cameraObjectCallback(const geometry_msgs::Transform::ConstPtr &trans)
callback corresponding to the camera->object topic.
bool computeEffectorCameraCallback(visp_hand2eye_calibration::compute_effector_camera::Request &req, visp_hand2eye_calibration::compute_effector_camera::Response &res)
service computing world->effector transformation from accumulated data.
geometry_msgs::Transform toGeometryMsgsTransform(const vpHomogeneousMatrix &mat)
boost::function< void(const geometry_msgs::Transform::ConstPtr &trans)> world_effector_subscriber_t
subscriber type declaration for world->effector topic subscriber
boost::function< bool(visp_hand2eye_calibration::reset::Request &, visp_hand2eye_calibration::reset::Response &res)> reset_service_callback_t
service type declaration for reset service
bool computeEffectorCameraQuickCallback(visp_hand2eye_calibration::compute_effector_camera_quick::Request &req, visp_hand2eye_calibration::compute_effector_camera_quick::Response &res)
service computing world->effector transformation from parameter-passed data.
std::string compute_effector_camera_quick_service
ros::ServiceServer compute_effector_camera_quick_service_
void spin()
spins the ros node