0
$\begingroup$

Rosanswers logo

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 ?


Originally posted by maxime on ROS Answers with karma: 27 on 2020-07-06

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by mgruhler with karma: 12390 on 2020-07-06

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by maxime on 2020-07-06:
It does perfectly answer it, thank you :)

Comment by mgruhler on 2020-07-07:
Happy to help!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.