ddynamic_reconfigure.h
Go to the documentation of this file.
1 
31 #ifndef _DDYNAMIC_RECONFIGURE_
32 #define _DDYNAMIC_RECONFIGURE_
33 
34 #include <dynamic_reconfigure/server.h>
37 #include <ros/ros.h>
38 #include <ros/callback_queue.h>
39 #include <ros/spinner.h>
40 #include <atomic>
41 
43 {
52 {
53 public:
61  DDynamicReconfigure(const ros::NodeHandle &nh = ros::NodeHandle("~"), bool auto_update = true);
62 
63  virtual ~DDynamicReconfigure();
64 
72  template <typename T>
73  void registerVariable(const std::string &name, T *variable,
74  const std::string &description = "", T min = getMin<T>(),
75  T max = getMax<T>(), const std::string &group = "Default");
76 
77  template <typename T>
78  void registerEnumVariable(const std::string &name, T *variable,
79  const std::string &description = "",
80  std::map<std::string, T> enum_dict = {},
81  const std::string &enum_description = "",
82  const std::string &group = "Default");
88  template <typename T>
89  void registerVariable(const std::string &name, T *variable,
90  const boost::function<void(T value)> &callback,
91  const std::string &description = "", T min = getMin<T>(),
92  T max = getMax<T>(), const std::string &group = "Default");
93 
94  template <typename T>
95  void registerEnumVariable(const std::string &name, T *variable,
96  const boost::function<void(T)> &callback,
97  const std::string &description,
98  std::map<std::string, T> enum_dict = {},
99  const std::string &enum_description = "",
100  const std::string &group = "Default");
101 
109  template <typename T>
110  void registerVariable(const std::string &name, T current_value,
111  const boost::function<void(T value)> &callback,
112  const std::string &description = "", T min = getMin<T>(),
113  T max = getMax<T>(), const std::string &group = "Default");
114 
115  template <typename T>
116  void registerEnumVariable(const std::string &name, T current_value,
117  const boost::function<void(T)> &callback,
118  const std::string &description,
119  std::map<std::string, T> enum_dict = {},
120  const std::string &enum_description = "",
121  const std::string &group = "Default");
122 
127  virtual void publishServicesTopics();
128 
129  virtual void updatePublishedInformation();
130 
131  typedef boost::function<void()> UserCallbackType;
132 
137  virtual void setUserCallback(const UserCallbackType &callback);
138 
139  virtual void clearUserCallback();
140 
141 
146  virtual void RegisterVariable(double *variable, std::string id, double min = -100,
147  double max = 100);
148 
149  virtual void RegisterVariable(int *variable, std::string id, int min = -100, int max = 100);
150 
151  virtual void RegisterVariable(bool *variable, std::string id);
152 
153  virtual void PublishServicesTopics();
154 
159  virtual void updateRegisteredVariablesData();
160 
161 protected:
162  template <typename T>
163  std::vector<std::unique_ptr<RegisteredParam<T>>> &getRegisteredVector();
164 
165  virtual dynamic_reconfigure::ConfigDescription generateConfigDescription() const;
166 
167  virtual dynamic_reconfigure::Config generateConfig();
168 
169  virtual bool setConfigCallback(dynamic_reconfigure::Reconfigure::Request &req,
170  dynamic_reconfigure::Reconfigure::Response &rsp);
171 
172  virtual void updateConfigData(const dynamic_reconfigure::Config &config);
173 
182 
185 
186  std::atomic_bool new_config_avail_;
187 
188  // Registered variables
189  std::vector<std::unique_ptr<RegisteredParam<int>>> registered_int_;
190  std::vector<std::unique_ptr<RegisteredParam<double>>> registered_double_;
191  std::vector<std::unique_ptr<RegisteredParam<bool>>> registered_bool_;
192  std::vector<std::unique_ptr<RegisteredParam<std::string>>> registered_string_;
193  std::vector<std::string> config_groups_;
194 
196 
198  dynamic_reconfigure::Config last_config_;
199  dynamic_reconfigure::Config updated_config_;
200 };
201 
203 }
204 
205 #endif
ddynamic_reconfigure::DDynamicReconfigure::generateConfigDescription
virtual dynamic_reconfigure::ConfigDescription generateConfigDescription() const
Definition: ddynamic_reconfigure.cpp:321
min
int min(int a, int b)
registered_param.h
ros::Publisher
ddynamic_reconfigure::DDynamicReconfigure::node_handle_
ros::NodeHandle node_handle_
setUserCallback Set a function to be called when parameters have changed
Definition: ddynamic_reconfigure.h:178
spinner.h
ddynamic_reconfigure::DDynamicReconfigure::getRegisteredVector
std::vector< std::unique_ptr< RegisteredParam< T > > > & getRegisteredVector()
boost::shared_ptr
ddynamic_reconfigure::DDynamicReconfigurePtr
boost::shared_ptr< DDynamicReconfigure > DDynamicReconfigurePtr
Definition: ddynamic_reconfigure.h:202
ddynamic_reconfigure::DDynamicReconfigure::new_config_avail_
std::atomic_bool new_config_avail_
Definition: ddynamic_reconfigure.h:186
ddynamic_reconfigure::DDynamicReconfigure::config_groups_
std::vector< std::string > config_groups_
Definition: ddynamic_reconfigure.h:193
ros.h
ddynamic_reconfigure::DDynamicReconfigure::setConfigCallback
virtual bool setConfigCallback(dynamic_reconfigure::Reconfigure::Request &req, dynamic_reconfigure::Reconfigure::Response &rsp)
Definition: ddynamic_reconfigure.cpp:184
ddynamic_reconfigure
Definition: ddynamic_reconfigure.h:42
ddynamic_reconfigure::DDynamicReconfigure::advertised_
bool advertised_
Definition: ddynamic_reconfigure.h:183
ddynamic_reconfigure::DDynamicReconfigure::set_service_
ros::ServiceServer set_service_
Definition: ddynamic_reconfigure.h:179
ddynamic_reconfigure::DDynamicReconfigure::clearUserCallback
virtual void clearUserCallback()
Definition: ddynamic_reconfigure.cpp:301
ddynamic_reconfigure::DDynamicReconfigure::updateConfigData
virtual void updateConfigData(const dynamic_reconfigure::Config &config)
Definition: ddynamic_reconfigure.cpp:264
ddynamic_reconfigure::DDynamicReconfigure::registerEnumVariable
void registerEnumVariable(const std::string &name, T *variable, const std::string &description="", std::map< std::string, T > enum_dict={}, const std::string &enum_description="", const std::string &group="Default")
Definition: ddynamic_reconfigure.cpp:78
ddynamic_reconfigure::DDynamicReconfigure::registered_double_
std::vector< std::unique_ptr< RegisteredParam< double > > > registered_double_
Definition: ddynamic_reconfigure.h:190
ddynamic_reconfigure::DDynamicReconfigure::last_config_
dynamic_reconfigure::Config last_config_
Definition: ddynamic_reconfigure.h:198
ddynamic_reconfigure::DDynamicReconfigure::registered_bool_
std::vector< std::unique_ptr< RegisteredParam< bool > > > registered_bool_
Definition: ddynamic_reconfigure.h:191
ros::ServiceServer
ddynamic_reconfigure::DDynamicReconfigure::PublishServicesTopics
virtual void PublishServicesTopics()
Definition: ddynamic_reconfigure.cpp:486
ddynamic_reconfigure::DDynamicReconfigure::registerVariable
void registerVariable(const std::string &name, T *variable, const std::string &description="", T min=getMin< T >(), T max=getMax< T >(), const std::string &group="Default")
registerVariable register a variable to be modified via the dynamic_reconfigure API....
Definition: ddynamic_reconfigure.cpp:70
ddynamic_reconfigure::DDynamicReconfigure::updateRegisteredVariablesData
virtual void updateRegisteredVariablesData()
updateRegisteredVariablesData - Method to be called to update the registered variable,...
Definition: ddynamic_reconfigure.cpp:491
ddynamic_reconfigure::DDynamicReconfigure::setUserCallback
virtual void setUserCallback(const UserCallbackType &callback)
setUserCallback An optional callback that will be called whenever a value is changed
Definition: ddynamic_reconfigure.cpp:296
ddynamic_reconfigure::DDynamicReconfigure::~DDynamicReconfigure
virtual ~DDynamicReconfigure()
Definition: ddynamic_reconfigure.cpp:13
ddynamic_reconfigure_utils.h
ddynamic_reconfigure::DDynamicReconfigure::generateConfig
virtual dynamic_reconfigure::Config generateConfig()
Definition: ddynamic_reconfigure.cpp:436
callback_queue.h
ddynamic_reconfigure::DDynamicReconfigure::descr_pub_
ros::Publisher descr_pub_
Definition: ddynamic_reconfigure.h:181
ddynamic_reconfigure::DDynamicReconfigure::RegisterVariable
virtual void RegisterVariable(double *variable, std::string id, double min=-100, double max=100)
Definition: ddynamic_reconfigure.cpp:306
ddynamic_reconfigure::DDynamicReconfigure::UserCallbackType
boost::function< void()> UserCallbackType
Definition: ddynamic_reconfigure.h:131
ddynamic_reconfigure::DDynamicReconfigure
The DDynamicReconfigure class allows to use ROS dynamic reconfigure without the need to write a custo...
Definition: ddynamic_reconfigure.h:51
ddynamic_reconfigure::DDynamicReconfigure::pub_config_timer_
ros::Timer pub_config_timer_
Definition: ddynamic_reconfigure.h:197
ddynamic_reconfigure::DDynamicReconfigure::publishServicesTopics
virtual void publishServicesTopics()
publishServicesTopics starts the server once all the needed variables are registered
Definition: ddynamic_reconfigure.cpp:20
ddynamic_reconfigure::DDynamicReconfigure::updated_config_
dynamic_reconfigure::Config updated_config_
Definition: ddynamic_reconfigure.h:199
ddynamic_reconfigure::DDynamicReconfigure::auto_update_
bool auto_update_
Definition: ddynamic_reconfigure.h:184
ddynamic_reconfigure::DDynamicReconfigure::user_callback_
UserCallbackType user_callback_
Definition: ddynamic_reconfigure.h:195
ddynamic_reconfigure::DDynamicReconfigure::DDynamicReconfigure
DDynamicReconfigure(const ros::NodeHandle &nh=ros::NodeHandle("~"), bool auto_update=true)
Definition: ddynamic_reconfigure.cpp:5
ddynamic_reconfigure::DDynamicReconfigure::registered_string_
std::vector< std::unique_ptr< RegisteredParam< std::string > > > registered_string_
Definition: ddynamic_reconfigure.h:192
ddynamic_reconfigure::DDynamicReconfigure::updatePublishedInformation
virtual void updatePublishedInformation()
Definition: ddynamic_reconfigure.cpp:154
ros::Timer
ddynamic_reconfigure::DDynamicReconfigure::registered_int_
std::vector< std::unique_ptr< RegisteredParam< int > > > registered_int_
Definition: ddynamic_reconfigure.h:189
ros::NodeHandle
ddynamic_reconfigure::DDynamicReconfigure::update_pub_
ros::Publisher update_pub_
Definition: ddynamic_reconfigure.h:180


ddynamic_reconfigure
Author(s): Hilario Tome
autogenerated on Wed Mar 2 2022 00:09:57