Sets up services for quickly changing the gains for a control_toolbox::Pid Pid object. More...
#include <pid_gains_setter.h>
Public Member Functions | |
PidGainsSetter & | add (Pid *pid) |
Adds a Pid object. | |
void | advertise (const std::string &ns) |
Advertises the "set_gains" service, initializing the PidGainsSetter. | |
void | advertise (const ros::NodeHandle &n) |
Advertises the "set_gains" service, initializing the PidGainsSetter. | |
PidGainsSetter () | |
bool | setGains (control_toolbox::SetPidGains::Request &req, control_toolbox::SetPidGains::Response &resp) |
~PidGainsSetter () | |
Private Attributes | |
ros::NodeHandle | node_ |
std::vector< Pid * > | pids_ |
ros::ServiceServer | serve_set_gains_ |
Sets up services for quickly changing the gains for a control_toolbox::Pid Pid object.
The PidGainsSetter class provides services for changing the gains of Pid objects over ROS. It advertise the "set_gains" service in the NodeHandle's namespace, with a type of control_toolbox/SetPidGains.
To use the object, add pids to the gains setter and then call advertise(). The PidGainsSetter will then update the gains of all the Pid objects when you call the set_gains service. (If you wish to have Pids with different gains, then you should use multiple PidGainsSetter objects).
ros::NodeHandle node; control_toolbox::Pid a, b, c; control_toolbox::PidGainsSetter pid_gains_setter; pid_gains_setter.add(&a); pid_gains_setter.add(&b).add(&c); pid_gains_setter.advertise(node);
ROS API
Definition at line 73 of file pid_gains_setter.h.
control_toolbox::PidGainsSetter::PidGainsSetter | ( | ) | [inline] |
Definition at line 44 of file pid_gains_setter.h.
control_toolbox::PidGainsSetter::~PidGainsSetter | ( | ) |
Definition at line 33 of file pid_gains_setter.cpp.
PidGainsSetter & control_toolbox::PidGainsSetter::add | ( | Pid * | pid | ) |
Adds a Pid object.
Adds a Pid object to be modified when new gains are set over the service.
Definition at line 38 of file pid_gains_setter.cpp.
void control_toolbox::PidGainsSetter::advertise | ( | const std::string & | ns | ) | [inline] |
Advertises the "set_gains" service, initializing the PidGainsSetter.
Definition at line 62 of file pid_gains_setter.h.
void control_toolbox::PidGainsSetter::advertise | ( | const ros::NodeHandle & | n | ) |
Advertises the "set_gains" service, initializing the PidGainsSetter.
Definition at line 45 of file pid_gains_setter.cpp.
bool control_toolbox::PidGainsSetter::setGains | ( | control_toolbox::SetPidGains::Request & | req, | |
control_toolbox::SetPidGains::Response & | resp | |||
) |
Definition at line 51 of file pid_gains_setter.cpp.
ros::NodeHandle control_toolbox::PidGainsSetter::node_ [private] |
Definition at line 68 of file pid_gains_setter.h.
std::vector<Pid*> control_toolbox::PidGainsSetter::pids_ [private] |
Definition at line 70 of file pid_gains_setter.h.
ros::ServiceServer control_toolbox::PidGainsSetter::serve_set_gains_ [private] |
Definition at line 69 of file pid_gains_setter.h.