Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 911 Bytes

File metadata and controls

44 lines (33 loc) · 911 Bytes

Creating a Client

Example

#include <adap_parameter/server.h>
#include <ros/ros.h>

adap_parameter::Server *srv = NULL;

bool
tuneCB(adap_parameter::Tune::Request &req, adap_parameter::Tune::Response &res)
{
    static long count = 0;
    if(count++ > 100) exit(EXIT_SUCCESS);

    adap_parameter::Feedback::Request fb;
    fb.feedback.resize(1);
    fb.feedback[0].data = req.parameters[0].data;
    srv->sendFeedback(fb);

    return true;
}

int
main(int argc, char **argv)
{
    ros::init(argc, argv, "test_client");
    srv = new adap_parameter::Server(&tuneCB);

    adap_parameter::Server::Tunables t = {
        {{"param_name"}}, {{"goal_name", 0.2}}
    };

    srv->connect(t);
    ros::spin();
    return 0;
}

basic.cpp is a similar file with three parameters that can be used with the graphing script. To run it, ./graph.py -r client_basic