Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _CAMERA_INFO_MANAGER_H_
00039 #define _CAMERA_INFO_MANAGER_H_
00040
00041 #include <ros/ros.h>
00042 #include <boost/thread/mutex.hpp>
00043 #include <sensor_msgs/CameraInfo.h>
00044 #include <sensor_msgs/SetCameraInfo.h>
00045
00053 namespace camera_info_manager
00054 {
00055
00174 class CameraInfoManager
00175 {
00176 public:
00177
00178 CameraInfoManager(ros::NodeHandle nh,
00179 const std::string &cname="camera",
00180 const std::string &url="");
00181
00182 sensor_msgs::CameraInfo getCameraInfo(void);
00183 bool isCalibrated(void);
00184 bool loadCameraInfo(const std::string &url);
00185 std::string resolveURL(const std::string &url,
00186 const std::string &cname);
00187 bool setCameraName(const std::string &cname);
00188 bool validateURL(const std::string &url);
00189
00190 private:
00191
00192
00193 typedef enum
00194 {
00195
00196 URL_empty = 0,
00197 URL_file,
00198 URL_package,
00199
00200 URL_invalid,
00201 URL_flash,
00202 } url_type_t;
00203
00204
00205 std::string getPackageFileName(const std::string &url);
00206 bool loadCalibration(const std::string &url,
00207 const std::string &cname);
00208 bool loadCalibrationFile(const std::string &filename,
00209 const std::string &cname);
00210 url_type_t parseURL(const std::string &url);
00211 bool saveCalibration(const sensor_msgs::CameraInfo &new_info,
00212 const std::string &url,
00213 const std::string &cname);
00214 bool saveCalibrationFile(const sensor_msgs::CameraInfo &new_info,
00215 const std::string &filename,
00216 const std::string &cname);
00217 bool setCameraInfo(sensor_msgs::SetCameraInfo::Request &req,
00218 sensor_msgs::SetCameraInfo::Response &rsp);
00219
00228 boost::mutex mutex_;
00229
00230
00231 ros::NodeHandle nh_;
00232 ros::ServiceServer info_service_;
00233 std::string camera_name_;
00234 std::string url_;
00235 sensor_msgs::CameraInfo cam_info_;
00236 bool loaded_cam_info_;
00237
00238 };
00239
00240 };
00241
00242 #endif // _CAMERA_INFO_MANAGER_H_