-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdual_arm_rtt-service.cpp
44 lines (37 loc) · 1.45 KB
/
dual_arm_rtt-service.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <rtt/plugin/ServicePlugin.hpp>
class PointGeneratorService : public RTT::Service {
public:
PointGeneratorService(RTT::TaskContext* owner) : Service("PointGeneratorService", owner)
{
this->addOperation("getOwnerName", &PointGeneratorService::getOwnerName, this).doc("Returns the name of the owner of this object.");
}
string getOwnerName() {
// getOwner() returns the TaskContext pointer we got in
// the constructor:
return getOwner()->getName();
}
};
ORO_SERVICE_NAMED_PLUGIN(PointGeneratorService, "PointGeneratorService")
/*
#include <rtt/TaskContext.hpp>
#include <iostream>
class MyServer : public RTT::TaskContext {
public:
MyServer() : TaskContext("server") {
this->provides("display")
->addOperation("showErrorMsg", &MyServer::showErrorMsg, this, RTT::OwnThread)
.doc("Shows an error on the display.")
.arg("code", "The error code")
.arg("msg","An error message");
this->provides("display")
->addOperation("clearErrors", &MyServer::clearErrors, this, RTT::OwnThread)
.doc("Clears any error on the display.");
}
void showErrorMsg(int code, std::string msg) {
std::cout << "Code: "<<code<<" - Message: "<< msg <<std::endl;
}
void clearErrors() {
std::cout << "No errors present." << std::endl;
}
};
ORO_SERVICE_NAMED_PLUGIN(MyServer, "MyServer")*/