ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

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 (
        stuff.. = 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

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:

beginner_tutorials::AddTwoInts srv;
srv.request.a = atoll(argv[1]);
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


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

Seen: 1,402 times

Last updated: Nov 20 '14