DoorDetectorActionsConfig.h
Go to the documentation of this file.
00001 //#line 2 "/opt/ros/electric/stacks/driver_common/dynamic_reconfigure/templates/ConfigType.h"
00002 // *********************************************************
00003 // 
00004 // File autogenerated for the iri_door_detector package 
00005 // by the dynamic_reconfigure package.
00006 // Please do not edit.
00007 // 
00008 // ********************************************************/
00009 
00010 /***********************************************************
00011  * Software License Agreement (BSD License)
00012  *
00013  *  Copyright (c) 2008, Willow Garage, Inc.
00014  *  All rights reserved.
00015  *
00016  *  Redistribution and use in source and binary forms, with or without
00017  *  modification, are permitted provided that the following conditions
00018  *  are met:
00019  *
00020  *   * Redistributions of source code must retain the above copyright
00021  *     notice, this list of conditions and the following disclaimer.
00022  *   * Redistributions in binary form must reproduce the above
00023  *     copyright notice, this list of conditions and the following
00024  *     disclaimer in the documentation and/or other materials provided
00025  *     with the distribution.
00026  *   * Neither the name of the Willow Garage nor the names of its
00027  *     contributors may be used to endorse or promote products derived
00028  *     from this software without specific prior written permission.
00029  *
00030  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00031  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00032  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00033  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00034  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00035  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00036  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00037  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00038  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00039  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00040  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00041  *  POSSIBILITY OF SUCH DAMAGE.
00042  ***********************************************************/
00043 
00044 // Author: Blaise Gassend
00045 
00046 
00047 #ifndef __iri_door_detector__DOORDETECTORACTIONSCONFIG_H__
00048 #define __iri_door_detector__DOORDETECTORACTIONSCONFIG_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 iri_door_detector
00058 {
00059   class DoorDetectorActionsConfigStatics;
00060   
00061   class DoorDetectorActionsConfig
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(DoorDetectorActionsConfig &config, const DoorDetectorActionsConfig &max, const DoorDetectorActionsConfig &min) const = 0;
00078       virtual void calcLevel(uint32_t &level, const DoorDetectorActionsConfig &config1, const DoorDetectorActionsConfig &config2) const = 0;
00079       virtual void fromServer(const ros::NodeHandle &nh, DoorDetectorActionsConfig &config) const = 0;
00080       virtual void toServer(const ros::NodeHandle &nh, const DoorDetectorActionsConfig &config) const = 0;
00081       virtual bool fromMessage(const dynamic_reconfigure::Config &msg, DoorDetectorActionsConfig &config) const = 0;
00082       virtual void toMessage(dynamic_reconfigure::Config &msg, const DoorDetectorActionsConfig &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 DoorDetectorActionsConfig::* f) :
00094         AbstractParamDescription(name, type, level, description, edit_method),
00095         field(f)
00096       {}
00097 
00098       T (DoorDetectorActionsConfig::* field);
00099 
00100       virtual void clamp(DoorDetectorActionsConfig &config, const DoorDetectorActionsConfig &max, const DoorDetectorActionsConfig &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 DoorDetectorActionsConfig &config1, const DoorDetectorActionsConfig &config2) const
00110       {
00111         if (config1.*field != config2.*field)
00112           comb_level |= level;
00113       }
00114 
00115       virtual void fromServer(const ros::NodeHandle &nh, DoorDetectorActionsConfig &config) const
00116       {
00117         nh.getParam(name, config.*field);
00118       }
00119 
00120       virtual void toServer(const ros::NodeHandle &nh, const DoorDetectorActionsConfig &config) const
00121       {
00122         nh.setParam(name, config.*field);
00123       }
00124 
00125       virtual bool fromMessage(const dynamic_reconfigure::Config &msg, DoorDetectorActionsConfig &config) const
00126       {
00127         return dynamic_reconfigure::ConfigTools::getParameter(msg, name, config.*field);
00128       }
00129 
00130       virtual void toMessage(dynamic_reconfigure::Config &msg, const DoorDetectorActionsConfig &config) const
00131       {
00132         dynamic_reconfigure::ConfigTools::appendParameter(msg, name, config.*field);
00133       }
00134     };
00135 
00136 //#line 42 "../cfg/door_detector_actions_alg_config.cfg"
00137       double base_distance_before_closed_door;
00138 //#line 43 "../cfg/door_detector_actions_alg_config.cfg"
00139       double base_distance_after_open_door;
00140 //#line 44 "../cfg/door_detector_actions_alg_config.cfg"
00141       double arm_distance_before_closed_door;
00142 //#line 45 "../cfg/door_detector_actions_alg_config.cfg"
00143       double z_arm_offset;
00144 //#line 46 "../cfg/door_detector_actions_alg_config.cfg"
00145       double y_offset;
00146 //#line 47 "../cfg/door_detector_actions_alg_config.cfg"
00147       bool no_simulator;
00148 //#line 138 "/opt/ros/electric/stacks/driver_common/dynamic_reconfigure/templates/ConfigType.h"
00149 
00150     bool __fromMessage__(dynamic_reconfigure::Config &msg)
00151     {
00152       const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00153       int count = 0;
00154       for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00155         if ((*i)->fromMessage(msg, *this))
00156           count++;
00157       if (count != dynamic_reconfigure::ConfigTools::size(msg))
00158       {
00159         ROS_ERROR("DoorDetectorActionsConfig::__fromMessage__ called with an unexpected parameter.");
00160         ROS_ERROR("Booleans:");
00161         for (unsigned int i = 0; i < msg.bools.size(); i++)
00162           ROS_ERROR("  %s", msg.bools[i].name.c_str());
00163         ROS_ERROR("Integers:");
00164         for (unsigned int i = 0; i < msg.ints.size(); i++)
00165           ROS_ERROR("  %s", msg.ints[i].name.c_str());
00166         ROS_ERROR("Doubles:");
00167         for (unsigned int i = 0; i < msg.doubles.size(); i++)
00168           ROS_ERROR("  %s", msg.doubles[i].name.c_str());
00169         ROS_ERROR("Strings:");
00170         for (unsigned int i = 0; i < msg.strs.size(); i++)
00171           ROS_ERROR("  %s", msg.strs[i].name.c_str());
00172         // @todo Check that there are no duplicates. Make this error more
00173         // explicit.
00174         return false;
00175       }
00176       return true;
00177     }
00178 
00179     // This version of __toMessage__ is used during initialization of
00180     // statics when __getParamDescriptions__ can't be called yet.
00181     void __toMessage__(dynamic_reconfigure::Config &msg, const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__) const
00182     {
00183       dynamic_reconfigure::ConfigTools::clear(msg);
00184       for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00185         (*i)->toMessage(msg, *this);
00186     }
00187     
00188     void __toMessage__(dynamic_reconfigure::Config &msg) const
00189     {
00190       const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00191       __toMessage__(msg, __param_descriptions__);
00192     }
00193     
00194     void __toServer__(const ros::NodeHandle &nh) const
00195     {
00196       const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00197       for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00198         (*i)->toServer(nh, *this);
00199     }
00200 
00201     void __fromServer__(const ros::NodeHandle &nh)
00202     {
00203       const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00204       for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00205         (*i)->fromServer(nh, *this);
00206     }
00207 
00208     void __clamp__()
00209     {
00210       const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00211       const DoorDetectorActionsConfig &__max__ = __getMax__();
00212       const DoorDetectorActionsConfig &__min__ = __getMin__();
00213       for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00214         (*i)->clamp(*this, __max__, __min__);
00215     }
00216 
00217     uint32_t __level__(const DoorDetectorActionsConfig &config) const
00218     {
00219       const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__();
00220       uint32_t level = 0;
00221       for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00222         (*i)->calcLevel(level, config, *this);
00223       return level;
00224     }
00225     
00226     static const dynamic_reconfigure::ConfigDescription &__getDescriptionMessage__();
00227     static const DoorDetectorActionsConfig &__getDefault__();
00228     static const DoorDetectorActionsConfig &__getMax__();
00229     static const DoorDetectorActionsConfig &__getMin__();
00230     static const std::vector<AbstractParamDescriptionConstPtr> &__getParamDescriptions__();
00231     
00232   private:
00233     static const DoorDetectorActionsConfigStatics *__get_statics__();
00234   };
00235   
00236   template <> // Max and min are ignored for strings.
00237   inline void DoorDetectorActionsConfig::ParamDescription<std::string>::clamp(DoorDetectorActionsConfig &config, const DoorDetectorActionsConfig &max, const DoorDetectorActionsConfig &min) const
00238   {
00239     return;
00240   }
00241 
00242   class DoorDetectorActionsConfigStatics
00243   {
00244     friend class DoorDetectorActionsConfig;
00245     
00246     DoorDetectorActionsConfigStatics()
00247     {
00248 //#line 42 "../cfg/door_detector_actions_alg_config.cfg"
00249       __min__.base_distance_before_closed_door = 0.1;
00250 //#line 42 "../cfg/door_detector_actions_alg_config.cfg"
00251       __max__.base_distance_before_closed_door = 3.0;
00252 //#line 42 "../cfg/door_detector_actions_alg_config.cfg"
00253       __default__.base_distance_before_closed_door = 0.36;
00254 //#line 42 "../cfg/door_detector_actions_alg_config.cfg"
00255       __param_descriptions__.push_back(DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr(new DoorDetectorActionsConfig::ParamDescription<double>("base_distance_before_closed_door", "double", 0, "Required distance to avoid collision with a closed door", "", &DoorDetectorActionsConfig::base_distance_before_closed_door)));
00256 //#line 43 "../cfg/door_detector_actions_alg_config.cfg"
00257       __min__.base_distance_after_open_door = 0.1;
00258 //#line 43 "../cfg/door_detector_actions_alg_config.cfg"
00259       __max__.base_distance_after_open_door = 3.0;
00260 //#line 43 "../cfg/door_detector_actions_alg_config.cfg"
00261       __default__.base_distance_after_open_door = 1.0;
00262 //#line 43 "../cfg/door_detector_actions_alg_config.cfg"
00263       __param_descriptions__.push_back(DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr(new DoorDetectorActionsConfig::ParamDescription<double>("base_distance_after_open_door", "double", 0, "Required distance to avoid collision with an open door", "", &DoorDetectorActionsConfig::base_distance_after_open_door)));
00264 //#line 44 "../cfg/door_detector_actions_alg_config.cfg"
00265       __min__.arm_distance_before_closed_door = 0.01;
00266 //#line 44 "../cfg/door_detector_actions_alg_config.cfg"
00267       __max__.arm_distance_before_closed_door = 1.0;
00268 //#line 44 "../cfg/door_detector_actions_alg_config.cfg"
00269       __default__.arm_distance_before_closed_door = 0.25;
00270 //#line 44 "../cfg/door_detector_actions_alg_config.cfg"
00271       __param_descriptions__.push_back(DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr(new DoorDetectorActionsConfig::ParamDescription<double>("arm_distance_before_closed_door", "double", 0, "Required distance to avoid collision with a closed door", "", &DoorDetectorActionsConfig::arm_distance_before_closed_door)));
00272 //#line 45 "../cfg/door_detector_actions_alg_config.cfg"
00273       __min__.z_arm_offset = -1.0;
00274 //#line 45 "../cfg/door_detector_actions_alg_config.cfg"
00275       __max__.z_arm_offset = 1.0;
00276 //#line 45 "../cfg/door_detector_actions_alg_config.cfg"
00277       __default__.z_arm_offset = 0.04;
00278 //#line 45 "../cfg/door_detector_actions_alg_config.cfg"
00279       __param_descriptions__.push_back(DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr(new DoorDetectorActionsConfig::ParamDescription<double>("z_arm_offset", "double", 0, "Z-axis Arm offset to adjust target pose", "", &DoorDetectorActionsConfig::z_arm_offset)));
00280 //#line 46 "../cfg/door_detector_actions_alg_config.cfg"
00281       __min__.y_offset = -1.0;
00282 //#line 46 "../cfg/door_detector_actions_alg_config.cfg"
00283       __max__.y_offset = 1.0;
00284 //#line 46 "../cfg/door_detector_actions_alg_config.cfg"
00285       __default__.y_offset = 0.0;
00286 //#line 46 "../cfg/door_detector_actions_alg_config.cfg"
00287       __param_descriptions__.push_back(DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr(new DoorDetectorActionsConfig::ParamDescription<double>("y_offset", "double", 0, "Y-axis offset to adjust target pose", "", &DoorDetectorActionsConfig::y_offset)));
00288 //#line 47 "../cfg/door_detector_actions_alg_config.cfg"
00289       __min__.no_simulator = 0;
00290 //#line 47 "../cfg/door_detector_actions_alg_config.cfg"
00291       __max__.no_simulator = 1;
00292 //#line 47 "../cfg/door_detector_actions_alg_config.cfg"
00293       __default__.no_simulator = 1;
00294 //#line 47 "../cfg/door_detector_actions_alg_config.cfg"
00295       __param_descriptions__.push_back(DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr(new DoorDetectorActionsConfig::ParamDescription<bool>("no_simulator", "bool", 0, "Run without simulation", "", &DoorDetectorActionsConfig::no_simulator)));
00296 //#line 239 "/opt/ros/electric/stacks/driver_common/dynamic_reconfigure/templates/ConfigType.h"
00297     
00298       for (std::vector<DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); i++)
00299         __description_message__.parameters.push_back(**i);
00300       __max__.__toMessage__(__description_message__.max, __param_descriptions__); 
00301       __min__.__toMessage__(__description_message__.min, __param_descriptions__); 
00302       __default__.__toMessage__(__description_message__.dflt, __param_descriptions__); 
00303     }
00304     std::vector<DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr> __param_descriptions__;
00305     DoorDetectorActionsConfig __max__;
00306     DoorDetectorActionsConfig __min__;
00307     DoorDetectorActionsConfig __default__;
00308     dynamic_reconfigure::ConfigDescription __description_message__;
00309     static const DoorDetectorActionsConfigStatics *get_instance()
00310     {
00311       // Split this off in a separate function because I know that
00312       // instance will get initialized the first time get_instance is
00313       // called, and I am guaranteeing that get_instance gets called at
00314       // most once.
00315       static DoorDetectorActionsConfigStatics instance;
00316       return &instance;
00317     }
00318   };
00319 
00320   inline const dynamic_reconfigure::ConfigDescription &DoorDetectorActionsConfig::__getDescriptionMessage__() 
00321   {
00322     return __get_statics__()->__description_message__;
00323   }
00324 
00325   inline const DoorDetectorActionsConfig &DoorDetectorActionsConfig::__getDefault__()
00326   {
00327     return __get_statics__()->__default__;
00328   }
00329   
00330   inline const DoorDetectorActionsConfig &DoorDetectorActionsConfig::__getMax__()
00331   {
00332     return __get_statics__()->__max__;
00333   }
00334   
00335   inline const DoorDetectorActionsConfig &DoorDetectorActionsConfig::__getMin__()
00336   {
00337     return __get_statics__()->__min__;
00338   }
00339   
00340   inline const std::vector<DoorDetectorActionsConfig::AbstractParamDescriptionConstPtr> &DoorDetectorActionsConfig::__getParamDescriptions__()
00341   {
00342     return __get_statics__()->__param_descriptions__;
00343   }
00344 
00345   inline const DoorDetectorActionsConfigStatics *DoorDetectorActionsConfig::__get_statics__()
00346   {
00347     const static DoorDetectorActionsConfigStatics *statics;
00348   
00349     if (statics) // Common case
00350       return statics;
00351 
00352     boost::mutex::scoped_lock lock(dynamic_reconfigure::__init_mutex__);
00353 
00354     if (statics) // In case we lost a race.
00355       return statics;
00356 
00357     statics = DoorDetectorActionsConfigStatics::get_instance();
00358     
00359     return statics;
00360   }
00361 
00362 
00363 }
00364 
00365 #endif // __DOORDETECTORACTIONSRECONFIGURATOR_H__


iri_door_detector
Author(s): Jose Rodriguez
autogenerated on Fri Dec 6 2013 23:57:16