Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ddynamic_reconfigure::DDynamicReconfigure Class Reference

The DDynamicReconfigure class allows to use ROS dynamic reconfigure without the need to write a custom cpf file, variables are registered and exposed at run time. Modification of the variables is done through a variable pointer or through a callback function. More...

#include <ddynamic_reconfigure.h>

Public Types

typedef boost::function< void()> UserCallbackType
 

Public Member Functions

virtual void clearUserCallback ()
 
 DDynamicReconfigure (const ros::NodeHandle &nh=ros::NodeHandle("~"), bool auto_update=true)
 
template<>
std::vector< std::unique_ptr< RegisteredParam< int > > > & getRegisteredVector ()
 
virtual void publishServicesTopics ()
 publishServicesTopics starts the server once all the needed variables are registered More...
 
virtual void PublishServicesTopics ()
 
template<typename T >
void registerEnumVariable (const std::string &name, T *variable, const boost::function< void(T value)> &callback, const std::string &description, std::map< std::string, T > enum_dict, const std::string &enum_description, const std::string &group)
 
template<typename T >
void registerEnumVariable (const std::string &name, T *variable, const boost::function< void(T)> &callback, const std::string &description, std::map< std::string, T > enum_dict={}, const std::string &enum_description="", const std::string &group="Default")
 
template<typename T >
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")
 
template<typename T >
void registerEnumVariable (const std::string &name, T current_value, const boost::function< void(T)> &callback, const std::string &description, std::map< std::string, T > enum_dict={}, const std::string &enum_description="", const std::string &group="Default")
 
virtual void RegisterVariable (bool *variable, std::string id)
 
template<typename T >
void registerVariable (const std::string &name, T *variable, const boost::function< void(T value)> &callback, const std::string &description="", T min=getMin< T >(), T max=getMax< T >(), const std::string &group="Default")
 registerVariable like the functions above, but with a callback to be called when the variable is changed from the dynamic_reconfigure API. More...
 
template<typename T >
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. When a change is made, it will be reflected in the variable directly More...
 
template<typename T >
void registerVariable (const std::string &name, T current_value, const boost::function< void(T value)> &callback, 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. When a change is made, the callback will be called with the new value. The variable itself is not modified when registered using this method. This method is useful for "dynamic reconfigure variables" that don't have a direct equivalent in the C++ code, such as vector.size(). More...
 
virtual void RegisterVariable (double *variable, std::string id, double min=-100, double max=100)
 
virtual void RegisterVariable (int *variable, std::string id, int min=-100, int max=100)
 
virtual void setUserCallback (const UserCallbackType &callback)
 setUserCallback An optional callback that will be called whenever a value is changed More...
 
virtual void updatePublishedInformation ()
 
virtual void updateRegisteredVariablesData ()
 updateRegisteredVariablesData - Method to be called to update the registered variable, incase the auto_update is not choosen More...
 
virtual ~DDynamicReconfigure ()
 

Protected Member Functions

virtual dynamic_reconfigure::Config generateConfig ()
 
virtual dynamic_reconfigure::ConfigDescription generateConfigDescription () const
 
template<typename T >
std::vector< std::unique_ptr< RegisteredParam< T > > > & getRegisteredVector ()
 
virtual bool setConfigCallback (dynamic_reconfigure::Reconfigure::Request &req, dynamic_reconfigure::Reconfigure::Response &rsp)
 
virtual void updateConfigData (const dynamic_reconfigure::Config &config)
 

Protected Attributes

bool advertised_
 
bool auto_update_
 
std::vector< std::string > config_groups_
 
ros::Publisher descr_pub_
 
dynamic_reconfigure::Config last_config_
 
std::atomic_bool new_config_avail_
 
ros::NodeHandle node_handle_
 setUserCallback Set a function to be called when parameters have changed More...
 
ros::Timer pub_config_timer_
 
std::vector< std::unique_ptr< RegisteredParam< bool > > > registered_bool_
 
std::vector< std::unique_ptr< RegisteredParam< double > > > registered_double_
 
std::vector< std::unique_ptr< RegisteredParam< int > > > registered_int_
 
std::vector< std::unique_ptr< RegisteredParam< std::string > > > registered_string_
 
ros::ServiceServer set_service_
 
ros::Publisher update_pub_
 
dynamic_reconfigure::Config updated_config_
 
UserCallbackType user_callback_
 

Detailed Description

The DDynamicReconfigure class allows to use ROS dynamic reconfigure without the need to write a custom cpf file, variables are registered and exposed at run time. Modification of the variables is done through a variable pointer or through a callback function.

Definition at line 51 of file ddynamic_reconfigure.h.

Member Typedef Documentation

◆ UserCallbackType

Definition at line 131 of file ddynamic_reconfigure.h.

Constructor & Destructor Documentation

◆ DDynamicReconfigure()

ddynamic_reconfigure::DDynamicReconfigure::DDynamicReconfigure ( const ros::NodeHandle nh = ros::NodeHandle("~"),
bool  auto_update = true 
)
Parameters
nhthe queue associated to this nh should spined() somewhere else
auto_update- Update the variable values immediately on change by service call. When it is true, it is not Thread Safe. In case it is set to False, updateRegisteredVariablesData method needs to be called to update the registered variables

Definition at line 5 of file ddynamic_reconfigure.cpp.

◆ ~DDynamicReconfigure()

ddynamic_reconfigure::DDynamicReconfigure::~DDynamicReconfigure ( )
virtual

Definition at line 13 of file ddynamic_reconfigure.cpp.

Member Function Documentation

◆ clearUserCallback()

void ddynamic_reconfigure::DDynamicReconfigure::clearUserCallback ( )
virtual

Definition at line 301 of file ddynamic_reconfigure.cpp.

◆ generateConfig()

dynamic_reconfigure::Config ddynamic_reconfigure::DDynamicReconfigure::generateConfig ( )
protectedvirtual

Definition at line 436 of file ddynamic_reconfigure.cpp.

◆ generateConfigDescription()

dynamic_reconfigure::ConfigDescription ddynamic_reconfigure::DDynamicReconfigure::generateConfigDescription ( ) const
protectedvirtual

Definition at line 321 of file ddynamic_reconfigure.cpp.

◆ getRegisteredVector() [1/2]

template<>
std::vector< std::unique_ptr< RegisteredParam< std::string > > > & ddynamic_reconfigure::DDynamicReconfigure::getRegisteredVector ( )

Definition at line 45 of file ddynamic_reconfigure.cpp.

◆ getRegisteredVector() [2/2]

template<typename T >
std::vector<std::unique_ptr<RegisteredParam<T> > >& ddynamic_reconfigure::DDynamicReconfigure::getRegisteredVector ( )
protected

◆ publishServicesTopics()

void ddynamic_reconfigure::DDynamicReconfigure::publishServicesTopics ( )
virtual

publishServicesTopics starts the server once all the needed variables are registered

Definition at line 20 of file ddynamic_reconfigure.cpp.

◆ PublishServicesTopics()

void ddynamic_reconfigure::DDynamicReconfigure::PublishServicesTopics ( )
virtual

Definition at line 486 of file ddynamic_reconfigure.cpp.

◆ registerEnumVariable() [1/4]

template<typename T >
void ddynamic_reconfigure::DDynamicReconfigure::registerEnumVariable ( const std::string &  name,
T *  variable,
const boost::function< void(T value)> &  callback,
const std::string &  description,
std::map< std::string, T >  enum_dict,
const std::string &  enum_description,
const std::string &  group 
)

Definition at line 99 of file ddynamic_reconfigure.cpp.

◆ registerEnumVariable() [2/4]

template<typename T >
void ddynamic_reconfigure::DDynamicReconfigure::registerEnumVariable ( const std::string &  name,
T *  variable,
const boost::function< void(T)> &  callback,
const std::string &  description,
std::map< std::string, T >  enum_dict = {},
const std::string &  enum_description = "",
const std::string &  group = "Default" 
)

◆ registerEnumVariable() [3/4]

template<typename T >
void ddynamic_reconfigure::DDynamicReconfigure::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 at line 78 of file ddynamic_reconfigure.cpp.

◆ registerEnumVariable() [4/4]

template<typename T >
void ddynamic_reconfigure::DDynamicReconfigure::registerEnumVariable ( const std::string &  name,
current_value,
const boost::function< void(T)> &  callback,
const std::string &  description,
std::map< std::string, T >  enum_dict = {},
const std::string &  enum_description = "",
const std::string &  group = "Default" 
)

Definition at line 126 of file ddynamic_reconfigure.cpp.

◆ RegisterVariable() [1/3]

void ddynamic_reconfigure::DDynamicReconfigure::RegisterVariable ( bool *  variable,
std::string  id 
)
virtual

Definition at line 316 of file ddynamic_reconfigure.cpp.

◆ registerVariable() [1/3]

template<typename T >
void ddynamic_reconfigure::DDynamicReconfigure::registerVariable ( const std::string &  name,
T *  variable,
const boost::function< void(T value)> &  callback,
const std::string &  description = "",
min = getMin<T>(),
max = getMax<T>(),
const std::string &  group = "Default" 
)

registerVariable like the functions above, but with a callback to be called when the variable is changed from the dynamic_reconfigure API.

Definition at line 88 of file ddynamic_reconfigure.cpp.

◆ registerVariable() [2/3]

template<typename T >
void ddynamic_reconfigure::DDynamicReconfigure::registerVariable ( const std::string &  name,
T *  variable,
const std::string &  description = "",
min = getMin<T>(),
max = getMax<T>(),
const std::string &  group = "Default" 
)

registerVariable register a variable to be modified via the dynamic_reconfigure API. When a change is made, it will be reflected in the variable directly

Deprecated:
In the future this method will be merged with the registerVariable that takes a pointer and a callback, but with the callback being optional

Definition at line 70 of file ddynamic_reconfigure.cpp.

◆ registerVariable() [3/3]

template<typename T >
void ddynamic_reconfigure::DDynamicReconfigure::registerVariable ( const std::string &  name,
current_value,
const boost::function< void(T value)> &  callback,
const std::string &  description = "",
min = getMin<T>(),
max = getMax<T>(),
const std::string &  group = "Default" 
)

registerVariable register a variable to be modified via the dynamic_reconfigure API. When a change is made, the callback will be called with the new value. The variable itself is not modified when registered using this method. This method is useful for "dynamic reconfigure variables" that don't have a direct equivalent in the C++ code, such as vector.size().

Definition at line 114 of file ddynamic_reconfigure.cpp.

◆ RegisterVariable() [2/3]

void ddynamic_reconfigure::DDynamicReconfigure::RegisterVariable ( double *  variable,
std::string  id,
double  min = -100,
double  max = 100 
)
virtual

Deprecated functions. For backwards compatibility, cannot be a template for legacy reasons

Definition at line 306 of file ddynamic_reconfigure.cpp.

◆ RegisterVariable() [3/3]

void ddynamic_reconfigure::DDynamicReconfigure::RegisterVariable ( int *  variable,
std::string  id,
int  min = -100,
int  max = 100 
)
virtual

Definition at line 311 of file ddynamic_reconfigure.cpp.

◆ setConfigCallback()

bool ddynamic_reconfigure::DDynamicReconfigure::setConfigCallback ( dynamic_reconfigure::Reconfigure::Request &  req,
dynamic_reconfigure::Reconfigure::Response &  rsp 
)
protectedvirtual

Definition at line 184 of file ddynamic_reconfigure.cpp.

◆ setUserCallback()

void ddynamic_reconfigure::DDynamicReconfigure::setUserCallback ( const UserCallbackType callback)
virtual

setUserCallback An optional callback that will be called whenever a value is changed

Definition at line 296 of file ddynamic_reconfigure.cpp.

◆ updateConfigData()

void ddynamic_reconfigure::DDynamicReconfigure::updateConfigData ( const dynamic_reconfigure::Config &  config)
protectedvirtual

Definition at line 264 of file ddynamic_reconfigure.cpp.

◆ updatePublishedInformation()

void ddynamic_reconfigure::DDynamicReconfigure::updatePublishedInformation ( )
virtual

Definition at line 154 of file ddynamic_reconfigure.cpp.

◆ updateRegisteredVariablesData()

void ddynamic_reconfigure::DDynamicReconfigure::updateRegisteredVariablesData ( )
virtual

updateRegisteredVariablesData - Method to be called to update the registered variable, incase the auto_update is not choosen

Definition at line 491 of file ddynamic_reconfigure.cpp.

Member Data Documentation

◆ advertised_

bool ddynamic_reconfigure::DDynamicReconfigure::advertised_
protected

Definition at line 183 of file ddynamic_reconfigure.h.

◆ auto_update_

bool ddynamic_reconfigure::DDynamicReconfigure::auto_update_
protected

Definition at line 184 of file ddynamic_reconfigure.h.

◆ config_groups_

std::vector<std::string> ddynamic_reconfigure::DDynamicReconfigure::config_groups_
protected

Definition at line 193 of file ddynamic_reconfigure.h.

◆ descr_pub_

ros::Publisher ddynamic_reconfigure::DDynamicReconfigure::descr_pub_
protected

Definition at line 181 of file ddynamic_reconfigure.h.

◆ last_config_

dynamic_reconfigure::Config ddynamic_reconfigure::DDynamicReconfigure::last_config_
protected

Definition at line 198 of file ddynamic_reconfigure.h.

◆ new_config_avail_

std::atomic_bool ddynamic_reconfigure::DDynamicReconfigure::new_config_avail_
protected

Definition at line 186 of file ddynamic_reconfigure.h.

◆ node_handle_

ros::NodeHandle ddynamic_reconfigure::DDynamicReconfigure::node_handle_
protected

setUserCallback Set a function to be called when parameters have changed

Definition at line 178 of file ddynamic_reconfigure.h.

◆ pub_config_timer_

ros::Timer ddynamic_reconfigure::DDynamicReconfigure::pub_config_timer_
protected

Definition at line 197 of file ddynamic_reconfigure.h.

◆ registered_bool_

std::vector<std::unique_ptr<RegisteredParam<bool> > > ddynamic_reconfigure::DDynamicReconfigure::registered_bool_
protected

Definition at line 191 of file ddynamic_reconfigure.h.

◆ registered_double_

std::vector<std::unique_ptr<RegisteredParam<double> > > ddynamic_reconfigure::DDynamicReconfigure::registered_double_
protected

Definition at line 190 of file ddynamic_reconfigure.h.

◆ registered_int_

std::vector<std::unique_ptr<RegisteredParam<int> > > ddynamic_reconfigure::DDynamicReconfigure::registered_int_
protected

Definition at line 189 of file ddynamic_reconfigure.h.

◆ registered_string_

std::vector<std::unique_ptr<RegisteredParam<std::string> > > ddynamic_reconfigure::DDynamicReconfigure::registered_string_
protected

Definition at line 192 of file ddynamic_reconfigure.h.

◆ set_service_

ros::ServiceServer ddynamic_reconfigure::DDynamicReconfigure::set_service_
protected

Definition at line 179 of file ddynamic_reconfigure.h.

◆ update_pub_

ros::Publisher ddynamic_reconfigure::DDynamicReconfigure::update_pub_
protected

Definition at line 180 of file ddynamic_reconfigure.h.

◆ updated_config_

dynamic_reconfigure::Config ddynamic_reconfigure::DDynamicReconfigure::updated_config_
protected

Definition at line 199 of file ddynamic_reconfigure.h.

◆ user_callback_

UserCallbackType ddynamic_reconfigure::DDynamicReconfigure::user_callback_
protected

Definition at line 195 of file ddynamic_reconfigure.h.


The documentation for this class was generated from the following files:


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