Skip to content

Commit

Permalink
Merge pull request #134 from orocos/fix-rtt_roscomm-rosservice-namespace
Browse files Browse the repository at this point in the history
rtt_roscomm: add rtt_roscomm namespace for rosservice plugins and helper classes
  • Loading branch information
meyerj authored Nov 28, 2019
2 parents c64c2e4 + 92ff2a0 commit 75eaee6
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 1 deletion.
4 changes: 4 additions & 0 deletions rtt_roscomm/include/rtt_roscomm/rtt_rosservice_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_void.hpp>

namespace rtt_roscomm {

//! Abstract ROS Service Proxy
class ROSServiceProxyBase
{
Expand Down Expand Up @@ -260,4 +262,6 @@ class ROSServiceProxyFactory : public ROSServiceProxyFactoryBase
}
};

} // namespace rtt_roscomm

#endif // ifndef __RTT_ROSCOMM_RTT_ROSSERVICE_PROXY_H
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <rtt/RTT.hpp>
#include <boost/shared_ptr.hpp>

namespace rtt_roscomm {

class ROSServiceRegistryService;
class ROSServiceProxyFactoryBase;
typedef boost::shared_ptr<ROSServiceRegistryService> ROSServiceRegistryServicePtr;
Expand Down Expand Up @@ -42,4 +44,6 @@ class ROSServiceRegistryService : public RTT::Service
static ROSServiceRegistryServicePtr s_instance_;
};

} // namespace rtt_roscomm

#endif // __RTT_ROSSERVICE_RTT_ROSSERVICE_REGISTRY_SERVICE_H
5 changes: 5 additions & 0 deletions rtt_roscomm/src/rtt_rosservice_registry_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <rtt_roscomm/rtt_rosservice_registry_service.h>
#include <rtt_roscomm/rtt_rosservice_proxy.h>

namespace rtt_roscomm {

ROSServiceRegistryServicePtr ROSServiceRegistryService::s_instance_;

ROSServiceRegistryServicePtr ROSServiceRegistryService::Instance()
Expand Down Expand Up @@ -101,7 +103,10 @@ static void loadROSServiceRegistryService()
ROSServiceRegistryService::Instance();
}

} // namespace rtt_roscomm

using namespace RTT;
using namespace rtt_roscomm;
extern "C" {
bool loadRTTPlugin(RTT::TaskContext* c){
if (c != 0) return false;
Expand Down
6 changes: 5 additions & 1 deletion rtt_roscomm/src/rtt_rosservice_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
using namespace RTT;
using namespace std;

namespace rtt_roscomm {

/**
* The globally loadable ROS service.
*/
Expand Down Expand Up @@ -215,4 +217,6 @@ class ROSServiceService : public RTT::Service
std::map<std::string, ROSServiceClientProxyBase*> client_proxies_;
};

ORO_SERVICE_NAMED_PLUGIN(ROSServiceService, "rosservice")
} // namespace rtt_roscomm

ORO_SERVICE_NAMED_PLUGIN(rtt_roscomm::ROSServiceService, "rosservice")
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

namespace rtt_@ROSPACKAGE@_ros_service_proxies {

using namespace rtt_roscomm;

bool registerROSServiceProxies() {
// Get the ros service registry service
ROSServiceRegistryServicePtr rosservice_registry = ROSServiceRegistryService::Instance();
Expand Down
4 changes: 4 additions & 0 deletions typekits/rtt_std_srvs/include/rtt_std_srvs/Empty.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// - void empty()
//

namespace rtt_roscomm {

template<> struct ROSServiceServerOperationCallerWrapper<std_srvs::Empty,1> {
typedef bool Signature();
typedef RTT::OperationCaller<Signature> ProxyOperationCallerType;
Expand All @@ -29,4 +31,6 @@ template<> struct ROSServiceServerOperationCallerWrapper<std_srvs::Empty,2> {
}
};

} // namespace rtt_roscomm

#endif // RTT_STD_SRVS_EMPTY_H
4 changes: 4 additions & 0 deletions typekits/rtt_std_srvs/include/rtt_std_srvs/SetBool.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// - void setBool(bool) // response.success = true and response.message will be empty
//

namespace rtt_roscomm {

template<> struct ROSServiceServerOperationCallerWrapper<std_srvs::SetBool,1> {
typedef bool Signature(bool, std::string&);
typedef RTT::OperationCaller<Signature> ProxyOperationCallerType;
Expand Down Expand Up @@ -52,4 +54,6 @@ template<> struct ROSServiceServerOperationCallerWrapper<std_srvs::SetBool,4> {
}
};

} // namespace rtt_roscomm

#endif // RTT_STD_SRVS_SETBOOL_H
4 changes: 4 additions & 0 deletions typekits/rtt_std_srvs/include/rtt_std_srvs/Trigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// - std::string trigger() // response.success = true
//

namespace rtt_roscomm {

template<> struct ROSServiceServerOperationCallerWrapper<std_srvs::Trigger,1> {
typedef bool Signature(std::string &message_out);
typedef RTT::OperationCaller<Signature> ProxyOperationCallerType;
Expand Down Expand Up @@ -41,4 +43,6 @@ template<> struct ROSServiceServerOperationCallerWrapper<std_srvs::Trigger,3> {
}
};

} // namespace rtt_roscomm

#endif // RTT_STD_SRVS_TRIGGER_H

0 comments on commit 75eaee6

Please sign in to comment.