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

ROS service with bool as request and bool as response

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

maxime gravatar image

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

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
1

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

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.

my_pkg/MyBoolSrv:

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

Comments

1

It does perfectly answer it, thank you :)

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

Happy to help!

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

Question Tools

1 follower

Stats

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

Seen: 2,240 times

Last updated: Jul 06 '20