ROS dynamic_reconfigure::Client::setConfiguration could not set configuration
I'm writing a simple client dynamic_reconfigure.If the batch_size
is equal to 20, then client should reset one parameter in config to 0.0. However, while running the node, the node throws the error [ WARN] [1657666570.407288065]: Could not set configuration
. Below is my code.
void adjuster_callback(const hc::HcNodeConfig& data) {
std::cout << "this is a callback function" << std::endl;
}
int main(int argc, char ** argv) {
int batch_size = 0;
ros::init(argc, argv, "adjuster");
hc::HcNodeConfig config;
dynamic_reconfigure::Client<hc::HcNodeConfig> client("hc", adjuster_callback);
ros::Duration d(2);
client.getDefaultConfiguration(config, d);
ros::Rate loop_rate(10);
while (ros::ok()) {
batch_size += 1;
if (batch_size == 10) {
config.angle = 0.0;
client.setConfiguration(config);
batch_size = 0;
}
ros::spinOnce();
loop_rate.sleep();
}
return 0;
}
I met this warning once, and I found the reason coming from the server name not matched.