-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wrappers for common operation signatures to rtt_std_srvs #123
Add wrappers for common operation signatures to rtt_std_srvs #123
Conversation
…s to rtt_std_srvs (fix #101) With this patch it is possible to create ROS service servers for some common operation signatures out of the box, without the need to write custom wrappers or to add extra operations with the ROS specific callback signature. Supported service types and associated signatures: std_srvs/Empty: - bool empty() // The service call fails if empty() returns false! // Use std_srvs/Trigger if the result should be returned as the response. - void empty() std_srvs/SetBool: - bool setBool(bool, std::string &message_out) - bool setBool(bool) // response.message will be empty - std::string setBool(bool) // response.success = true - void setBool(bool) // response.success = true and response.message will be empty std_srvs/Trigger: - bool trigger(std::string &message_out) - bool trigger() // response.message will be empty - std::string trigger() // response.success = true The approach can be easily extended to other ROS service types.
7564c75
to
524f976
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, there was just a build failure due to pre-C++11 incompatibility. Issue is easily circumvented, however.
@@ -118,12 +118,23 @@ TEST(TransportTest, VectorTest) | |||
} | |||
|
|||
static int callback_called = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: do we control in which thread the callbacks are made? If not, maybe this counter should be atomic. Not important right now, just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callbacks are executed by a thread pool owned by a ros::AsyncSpinner
in rtt_rosnode
. They could execute in parallel, but the service calls in the unit tests are synchronous and block until the callback has been processed and the results are returned through the network stack and roscpp. So no concurrency.
Was not quite as easily circumvented as it appeared at first, but now it works as intended. |
Very nice ! |
very nice ! |
…ion from #123) Clang seems to handle SFINAE differently than gcc and compilation of generated service proxy plugins failed with errors like: In file included from rtt_diagnostic_msgs/diagnostic_msgs_service_proxies/rtt_rosservice_proxies.cpp:7: rtt_roscomm/rtt_rosservice_proxy.h:99:30: error: implicit instantiation of undefined template 'ROSServiceServerOperationCallerWrapper<diagnostic_msgs::AddDiagnostics, 1>'
Implements #101.
With this patch it is possible to create ROS service servers for some common operation signatures out of the box, without the need to write custom wrappers or to add extra operations with the ROS specific callback signature.
Supported service types and associated signatures:
The approach can be easily extended to other ROS service types.