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
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef __image_rotate__IMAGEROTATECONFIG_H__
00048 #define __image_rotate__IMAGEROTATECONFIG_H__
00049
00050 #include <dynamic_reconfigure/config_tools.h>
00051 #include <limits>
00052 #include <ros/node_handle.h>
00053 #include <dynamic_reconfigure/ConfigDescription.h>
00054 #include <dynamic_reconfigure/ParamDescription.h>
00055 #include <dynamic_reconfigure/config_init_mutex.h>
00056
00057 namespace image_rotate
00058 {
00059 class ImageRotateConfigStatics;
00060
00061 class ImageRotateConfig
00062 {
00063 public:
00064 class AbstractParamDescription : public dynamic_reconfigure::ParamDescription
00065 {
00066 public:
00067 AbstractParamDescription(std::string n, std::string t, uint32_t l,
00068 std::string d, std::string e)
00069 {
00070 name = n;
00071 type = t;
00072 level = l;
00073 description = d;
00074 edit_method = e;
00075 }
00076
00077 virtual void clamp(ImageRotateConfig &config, const ImageRotateConfig &max, const ImageRotateConfig &min) const = 0;
00078 virtual void calcLevel(uint32_t &level, const ImageRotateConfig &config1, const ImageRotateConfig &config2) const = 0;
00079 virtual void fromServer(const ros::NodeHandle &nh, ImageRotateConfig &config) const = 0;
00080 virtual void toServer(const ros::NodeHandle &nh, const ImageRotateConfig &config) const = 0;
00081 virtual bool fromMessage(const dynamic_reconfigure::Config &msg, ImageRotateConfig &config) const = 0;
00082 virtual void toMessage(dynamic_reconfigure::Config &msg, const ImageRotateConfig &config) const = 0;
00083 };
00084
00085 typedef boost::shared_ptr<AbstractParamDescription> AbstractParamDescriptionPtr;
00086 typedef boost::shared_ptr<const AbstractParamDescription> AbstractParamDescriptionConstPtr;
00087
00088 template <class T>
00089 class ParamDescription : public AbstractParamDescription
00090 {
00091 public:
00092 ParamDescription(std::string name, std::string type, uint32_t level,
00093 std::string description, std::string edit_method, T ImageRotateConfig::* f) :
00094 AbstractParamDescription(name, type, level, description, edit_method),
00095 field(f)
00096 {}
00097
00098 T (ImageRotateConfig::* field);
00099
00100 virtual void clamp(ImageRotateConfig &config, const ImageRotateConfig &max, const ImageRotateConfig &min) const
00101 {
00102 if (config.*field > max.*field)
00103 config.*field = max.*field;
00104
00105 if (config.*field < min.*field)
00106 config.*field = min.*field;
00107 }
00108
00109 virtual void calcLevel(uint32_t &comb_level, const ImageRotateConfig &config1, const ImageRotateConfig &config2) const
00110 {
00111 if (config1.*field != config2.*field)
00112 comb_level |= level;
00113 }
00114
00115 virtual void fromServer(const ros::NodeHandle &nh, ImageRotateConfig &config) const
00116 {
00117 nh.getParam(name, config.*field);
00118 }
00119
00120 virtual void toServer(const ros::NodeHandle &nh, const ImageRotateConfig &config) const
00121 {
00122 nh.setParam(name, config.*field);
00123 }
00124
00125 virtual bool fromMessage(const dynamic_reconfigure::Config &msg, ImageRotateConfig &config) const
00126 {
00127 return dynamic_reconfigure::ConfigTools::getParameter(msg, name, config.*field);
00128 }
00129
00130 virtual void toMessage(dynamic_reconfigure::Config &msg, const ImageRotateConfig &config) const
00131 {
00132 dynamic_reconfigure::ConfigTools::appendParameter(msg, name, config.*field);
00133 }
00134 };
00135
00136
00137 std::string target_frame_id;
00138
00139 double target_x;
00140
00141 double target_y;
00142
00143 double target_z;
00144
00145 std::string source_frame_id;
00146
00147 double source_x;
00148
00149 double source_y;
00150
00151 double source_z;
00152
00153 std::string output_frame_id;
00154
00155 std::string input_frame_id;
00156
00157 bool use_camera_info;
00158
00159 double max_angular_rate;
00160
00161 double output_image_size;
00162
00163
00164 bool __fromMessage__(dynamic_reconfigure::Config &msg)
00165 {
00166 const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00167 int count = 0;
00168 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00169 if ((*i)->fromMessage(msg, *this))
00170 count++;
00171 if (count != dynamic_reconfigure::ConfigTools::size(msg))
00172 {
00173 ROS_ERROR("ImageRotateConfig::__fromMessage__ called with an unexpected parameter.");
00174 ROS_ERROR("Booleans:");
00175 for (unsigned int i = 0; i < msg.bools.size(); i++)
00176 ROS_ERROR(" %s", msg.bools[i].name.c_str());
00177 ROS_ERROR("Integers:");
00178 for (unsigned int i = 0; i < msg.ints.size(); i++)
00179 ROS_ERROR(" %s", msg.ints[i].name.c_str());
00180 ROS_ERROR("Doubles:");
00181 for (unsigned int i = 0; i < msg.doubles.size(); i++)
00182 ROS_ERROR(" %s", msg.doubles[i].name.c_str());
00183 ROS_ERROR("Strings:");
00184 for (unsigned int i = 0; i < msg.strs.size(); i++)
00185 ROS_ERROR(" %s", msg.strs[i].name.c_str());
00186
00187
00188 return false;
00189 }
00190 return true;
00191 }
00192
00193
00194
00195 void __toMessage__(dynamic_reconfigure::Config &msg, const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__) const
00196 {
00197 dynamic_reconfigure::ConfigTools::clear(msg);
00198 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00199 (*i)->toMessage(msg, *this);
00200 }
00201
00202 void __toMessage__(dynamic_reconfigure::Config &msg) const
00203 {
00204 const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00205 __toMessage__(msg, __param_descriptions__);
00206 }
00207
00208 void __toServer__(const ros::NodeHandle &nh) const
00209 {
00210 const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00211 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00212 (*i)->toServer(nh, *this);
00213 }
00214
00215 void __fromServer__(const ros::NodeHandle &nh)
00216 {
00217 const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00218 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00219 (*i)->fromServer(nh, *this);
00220 }
00221
00222 void __clamp__()
00223 {
00224 const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00225 const ImageRotateConfig &__max__ = __getMax__();
00226 const ImageRotateConfig &__min__ = __getMin__();
00227 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00228 (*i)->clamp(*this, __max__, __min__);
00229 }
00230
00231 uint32_t __level__(const ImageRotateConfig &config) const
00232 {
00233 const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00234 uint32_t level = 0;
00235 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00236 (*i)->calcLevel(level, config, *this);
00237 return level;
00238 }
00239
00240 static const dynamic_reconfigure::ConfigDescription &__getDescriptionMessage__();
00241 static const ImageRotateConfig &__getDefault__();
00242 static const ImageRotateConfig &__getMax__();
00243 static const ImageRotateConfig &__getMin__();
00244 static const std::vector<AbstractParamDescriptionConstPtr> &__getParamDescriptions__();
00245
00246 private:
00247 static const ImageRotateConfigStatics *__get_statics__();
00248 };
00249
00250 template <>
00251 inline void ImageRotateConfig::ParamDescription<std::string>::clamp(ImageRotateConfig &config, const ImageRotateConfig &max, const ImageRotateConfig &min) const
00252 {
00253 return;
00254 }
00255
00256 class ImageRotateConfigStatics
00257 {
00258 friend class ImageRotateConfig;
00259
00260 ImageRotateConfigStatics()
00261 {
00262
00263 __min__.target_frame_id = "";
00264
00265 __max__.target_frame_id = "";
00266
00267 __default__.target_frame_id = "base_link";
00268
00269 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("target_frame_id", "str", 0, "Frame in which the target vector is specified. Empty means the input frame.", "", &ImageRotateConfig::target_frame_id)));
00270
00271 __min__.target_x = -10.0;
00272
00273 __max__.target_x = 10.0;
00274
00275 __default__.target_x = 0.0;
00276
00277 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_x", "double", 0, "X coordinate of the target vector", "", &ImageRotateConfig::target_x)));
00278
00279 __min__.target_y = -10.0;
00280
00281 __max__.target_y = 10.0;
00282
00283 __default__.target_y = 0.0;
00284
00285 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_y", "double", 0, "Y coordinate of the target vector", "", &ImageRotateConfig::target_y)));
00286
00287 __min__.target_z = -10.0;
00288
00289 __max__.target_z = 10.0;
00290
00291 __default__.target_z = 1.0;
00292
00293 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_z", "double", 0, "Z coordinate of the target vector", "", &ImageRotateConfig::target_z)));
00294
00295 __min__.source_frame_id = "";
00296
00297 __max__.source_frame_id = "";
00298
00299 __default__.source_frame_id = "";
00300
00301 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("source_frame_id", "str", 0, "Frame in which the source vector is specified. Empty means the input frame.", "", &ImageRotateConfig::source_frame_id)));
00302
00303 __min__.source_x = -10.0;
00304
00305 __max__.source_x = 10.0;
00306
00307 __default__.source_x = 0.0;
00308
00309 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_x", "double", 0, "X coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_x)));
00310
00311 __min__.source_y = -10.0;
00312
00313 __max__.source_y = 10.0;
00314
00315 __default__.source_y = -1.0;
00316
00317 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_y", "double", 0, "Y coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_y)));
00318
00319 __min__.source_z = -10.0;
00320
00321 __max__.source_z = 10.0;
00322
00323 __default__.source_z = 0.0;
00324
00325 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_z", "double", 0, "Z coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_z)));
00326
00327 __min__.output_frame_id = "";
00328
00329 __max__.output_frame_id = "";
00330
00331 __default__.output_frame_id = "";
00332
00333 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("output_frame_id", "str", 0, "Frame to publish for the image's new orientation. Empty means add '_rotated' suffix to the image frame.", "", &ImageRotateConfig::output_frame_id)));
00334
00335 __min__.input_frame_id = "";
00336
00337 __max__.input_frame_id = "";
00338
00339 __default__.input_frame_id = "";
00340
00341 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("input_frame_id", "str", 0, "Frame to use for the original camera image. Empty means that the frame in the image or camera_info should be used depending on use_camera_info.", "", &ImageRotateConfig::input_frame_id)));
00342
00343 __min__.use_camera_info = 0;
00344
00345 __max__.use_camera_info = 1;
00346
00347 __default__.use_camera_info = 1;
00348
00349 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<bool>("use_camera_info", "bool", 0, "Indicates that the camera_info topic should be subscribed to to get the default input_frame_id. Otherwise the frame from the image message will be used.", "", &ImageRotateConfig::use_camera_info)));
00350
00351 __min__.max_angular_rate = 0.0;
00352
00353 __max__.max_angular_rate = 100.0;
00354
00355 __default__.max_angular_rate = 10.0;
00356
00357 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("max_angular_rate", "double", 0, "Limits the rate at which the image can rotate (rad/s). Zero means no limit.", "", &ImageRotateConfig::max_angular_rate)));
00358
00359 __min__.output_image_size = 0.0;
00360
00361 __max__.output_image_size = 3.0;
00362
00363 __default__.output_image_size = 2.0;
00364
00365 __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("output_image_size", "double", 0, "Size of the output image as a function of the input image size. Can be varied continuously between the following special settings: 0 ensures no black ever appears, 1 is small image dimension, 2 is large image dimension, 3 is image diagonal.", "", &ImageRotateConfig::output_image_size)));
00366
00367
00368 for (std::vector<ImageRotateConfig::AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00369 __description_message__.parameters.push_back(**i);
00370 __max__.__toMessage__(__description_message__.max, __param_descriptions__);
00371 __min__.__toMessage__(__description_message__.min, __param_descriptions__);
00372 __default__.__toMessage__(__description_message__.dflt, __param_descriptions__);
00373 }
00374 std::vector<ImageRotateConfig::AbstractParamDescriptionConstPtr> __param_descriptions__;
00375 ImageRotateConfig __max__;
00376 ImageRotateConfig __min__;
00377 ImageRotateConfig __default__;
00378 dynamic_reconfigure::ConfigDescription __description_message__;
00379 static const ImageRotateConfigStatics *get_instance()
00380 {
00381
00382
00383
00384
00385 static ImageRotateConfigStatics instance;
00386 return &instance;
00387 }
00388 };
00389
00390 inline const dynamic_reconfigure::ConfigDescription &ImageRotateConfig::__getDescriptionMessage__()
00391 {
00392 return __get_statics__()->__description_message__;
00393 }
00394
00395 inline const ImageRotateConfig &ImageRotateConfig::__getDefault__()
00396 {
00397 return __get_statics__()->__default__;
00398 }
00399
00400 inline const ImageRotateConfig &ImageRotateConfig::__getMax__()
00401 {
00402 return __get_statics__()->__max__;
00403 }
00404
00405 inline const ImageRotateConfig &ImageRotateConfig::__getMin__()
00406 {
00407 return __get_statics__()->__min__;
00408 }
00409
00410 inline const std::vector<ImageRotateConfig::AbstractParamDescriptionConstPtr> &ImageRotateConfig::__getParamDescriptions__()
00411 {
00412 return __get_statics__()->__param_descriptions__;
00413 }
00414
00415 inline const ImageRotateConfigStatics *ImageRotateConfig::__get_statics__()
00416 {
00417 const static ImageRotateConfigStatics *statics;
00418
00419 if (statics)
00420 return statics;
00421
00422 boost::mutex::scoped_lock lock(dynamic_reconfigure::__init_mutex__);
00423
00424 if (statics)
00425 return statics;
00426
00427 statics = ImageRotateConfigStatics::get_instance();
00428
00429 return statics;
00430 }
00431
00432
00433 }
00434
00435 #endif // __IMAGEROTATERECONFIGURATOR_H__