2 #include <boost/algorithm/string.hpp> 28 this->doc(
"RTT Service for connecting RTT ports to ROS actionlib actions.");
30 this->addOperation(
"connect",
32 .doc(
"Connects a set of RTT data ports (goal,cancel,status,result,feedback) to a ROS actionlib action server or client.")
33 .arg(
"action_ns",
"The ROS action namespace (like \"/some/action\").");
35 this->addOperation(
"connectSub",
36 (
bool (
ActionlibService::*)(
const std::string&,
const std::string&))&ActionlibService::connect,
this)
37 .doc(
"Connects a set of RTT data ports (goal,cancel,status,result,feedback) defined on a sub-service to a ROS actionlib action server or client.")
38 .arg(
"service_name",
"The RTT service name (like \"some_provided_service.another\") under which the ports are defined.")
39 .arg(
"action_ns",
"The ROS action namespace (like \"/some/action\").");
47 std::vector<std::string> rtt_uri_tokens;
48 boost::split(rtt_uri_tokens, rtt_uri, boost::is_any_of(
"."));
51 if(rtt_uri_tokens.size() < 1) {
57 for(std::vector<std::string>::iterator it = rtt_uri_tokens.begin();
58 it != rtt_uri_tokens.end();
61 if(provided->hasService(*it)) {
62 provided = provided->provides(*it);
75 const std::string &ros_action_ns)
77 return this->connect(this->getOwner()->provides(), ros_action_ns);
83 const std::string &rtt_service_name,
84 const std::string &ros_action_ns)
90 if(rtt_action_service.get() == NULL) {
94 return this->connect(rtt_action_service, ros_action_ns);
102 const std::string &ros_action_ns)
105 if(rtt_action_service.get() == NULL || rtt_action_service->getOwner() != this->getOwner()) {
#define ORO_SERVICE_NAMED_PLUGIN(SERVICE, NAME)
boost::shared_ptr< Service > shared_ptr
bool connect(const std::string &rtt_service_name, const std::string &ros_action_ns)
Connect.
bool setPortsFromService(RTT::Service::shared_ptr service)
Store the required RTT ports from a given RTT service.
ActionlibService(TaskContext *owner)
bool createStream(const std::string action_ns, RTT::ConnPolicy cp_template=RTT::ConnPolicy::data())
Create a stream from this RTT actionlib port interface to the appropriate ROS topic interface...
RTT::Service::shared_ptr get_owner_service(const std::string rtt_uri)
Get an RTT service from a string identifier.
bool connect(RTT::Service::shared_ptr rtt_action_service, const std::string &ros_action_ns)
Connect an RTT operation or operation caller to a ROS service server or service client.
bool connect(const std::string &ros_action_ns)