ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS dynamic_reconfigure::Client::setConfiguration could not set configuration

asked 2022-07-12 18:17:13 -0500

hck007 gravatar image

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;
}
edit retag flag offensive close merge delete

Comments

1

I met this warning once, and I found the reason coming from the server name not matched.

RyanChen.YLC gravatar image RyanChen.YLC  ( 2022-07-12 19:07:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-07-13 08:30:33 -0500

Mike Scheutzow gravatar image

I think you are confused about the difference between dynamic_reconfigure::Server and dynamic_reconfigure::Client (and the wiki page could use some improvement describing this.)

You should use Server to create a dynamic parameter, which typically is a parameter in the namespace of the current ros node. Creating the server instance will cause a ros service named ".../set_parameters" to be created.

You use Client to set or monitor a dynamic parameter for some other ros node. Client assumes the set_parameters service has already been created by that other ros node.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-07-12 18:17:13 -0500

Seen: 121 times

Last updated: Jul 13 '22