Ask Your Question
0

pass arguments with called service

asked 2014-11-20 09:56:37 -0600

irgendeinGastname gravatar image

Hey, in my code I call a service that calls another service

bool srvCallback_my_switcher(cob_srvs::Trigger::Request &req, cob_srvs::Trigger::Response &res)

{   
    if (client.call(srv))
    {
        srv.request;
        stuff..

    res.success.data = true;
    return true;
}

is there a possibility to call the service srv with an argument for example a bool variable? I would like the called service to differ whether variable is true or false.

Kindly guide :))

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-11-20 10:15:30 -0600

Torsten gravatar image

updated 2014-11-20 10:21:43 -0600

You should pass the variable you need by assign srv.request.[VariableName] = [true, false];, like you did in the response. Please also look at this tutorial:

http://wiki.ros.org/ROS/Tutorials/Wri...

beginner_tutorials::AddTwoInts srv;
srv.request.a = atoll(argv[1]);
...
client.call(srv)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-11-20 09:56:37 -0600

Seen: 640 times

Last updated: Nov 20 '14