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

ROS service with bool as request and bool as response

asked 2020-07-06 07:27:34 -0600

maxime gravatar image

updated 2020-07-06 07:28:37 -0600

I don't want to use std_srvs::SetBoolRequest or any stuff from mavros. I just want to use bare boolean. My callback function would be :

bool Command::arming_service(bool request, bool response) {
   // whatever 
   return false;

How can I do that ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-07-06 08:27:02 -0600

mgruhler gravatar image

You can't if you intend to use a ROS service. This is how services are designed.

You can create your own service type, if you want, only containing booleans.


bool input
bool output

But you'll still have the respective function signature as

bool Command::arming_service(my_pkg::MyBoolSrv::Request request, my_pkg::MyBoolSrv::Response response) {
   // whatever with request.input and response.output
   return false;

If this doesn't answer your question, please provide more details on your use case and what you actually want to do.

edit flag offensive delete link more



It does perfectly answer it, thank you :)

maxime gravatar image maxime  ( 2020-07-06 13:06:02 -0600 )edit

Happy to help!

mgruhler gravatar image mgruhler  ( 2020-07-07 02:10:51 -0600 )edit

Question Tools

1 follower


Asked: 2020-07-06 07:27:34 -0600

Seen: 2,034 times

Last updated: Jul 06 '20