00001 00030 #include <rtt/RTT.hpp> 00031 #include <rtt/plugin/Plugin.hpp> 00032 #include <rtt/plugin/ServicePlugin.hpp> 00033 #include <rtt/internal/GlobalService.hpp> 00034 00035 #include <ros/package.h> 00036 00037 using namespace RTT; 00038 using namespace std; 00039 00040 class ROSPackService : public RTT::Service { 00041 public: 00042 ROSPackService(TaskContext* owner) 00043 : Service("rospack", owner) 00044 { 00045 this->addOperation("find", &ros::package::getPath).doc("Returns the fully-qualified path to a package, or an empty string if the package is not found"); 00046 } 00047 }; 00048 00049 void loadROSPackService(){ 00050 RTT::Service::shared_ptr rps(new ROSPackService(0)); 00051 RTT::internal::GlobalService::Instance()->addService(rps); 00052 } 00053 00054 using namespace RTT; 00055 extern "C" { 00056 bool loadRTTPlugin(RTT::TaskContext* c){ 00057 loadROSPackService(); 00058 return true; 00059 } 00060 std::string getRTTPluginName (){ 00061 return "rospack"; 00062 } 00063 std::string getRTTTargetName (){ 00064 return OROCOS_TARGET_NAME; 00065 } 00066 }