This repository has been archived by the owner on Jun 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
RobotControlSupport.h
108 lines (78 loc) · 2.78 KB
/
RobotControlSupport.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef ROBOTCONTROL_SUPPORT_H
#define ROBOTCONTROL_SUPPORT_H
#include "normative/function_call.h"
#include "robotPlugin.h"
#include "robotSupport.h"
namespace robot {
class RobotControlSupport;
class RobotControlAsync;
class RobotControl
{
public:
typedef RobotControlAsync AsyncInterfaceType;
typedef RobotControlSupport SupportType;
typedef RobotControl_Request RequestType;
typedef RobotControl_Reply ReplyType;
virtual void command(const Command & command) = 0;
virtual float setSpeed(float speed) = 0;
virtual float getSpeed() = 0;
virtual void getStatus(Status & status) = 0;
virtual ~RobotControl() { }
};
class RobotControlAsync
{
public:
typedef RobotControl InterfaceType;
typedef RobotControlSupport SupportType;
typedef RobotControl_Request RequestType;
typedef RobotControl_Reply ReplyType;
virtual dds::rpc::future<void> command_async(const robot::Command & command) = 0;
virtual dds::rpc::future<float> setSpeed_async(float speed) = 0;
virtual dds::rpc::future<float> getSpeed_async() = 0;
virtual dds::rpc::future<robot::RobotControl_getStatus_Out> getStatus_async() = 0;
virtual ~RobotControlAsync() { }
};
class RobotControlSupport
{
public:
typedef robot::RobotControl InterfaceType;
typedef robot::RobotControlAsync AsyncInterfaceType;
typedef robot::RobotControl_Request RequestType;
typedef robot::RobotControl_Reply ReplyType;
class Client : public virtual robot::RobotControl,
public virtual robot::RobotControlAsync,
public virtual dds::rpc::ClientEndpoint
{
public:
Client();
Client(const dds::rpc::ClientParams & client_params);
/* Methods from RobotControl */
void command(const Command & command);
float setSpeed(float speed);
float getSpeed();
void getStatus(Status & status);
/* Methods from RobotControlAsync */
dds::rpc::future<void> command_async(const robot::Command & command);
dds::rpc::future<float> setSpeed_async(float speed);
dds::rpc::future<float> getSpeed_async();
dds::rpc::future<robot::RobotControl_getStatus_Out> getStatus_async();
};
class Service : public dds::rpc::ServiceEndpoint
{
public:
// Normative: Uses default Server
Service();
// Normative: Uses default Server
template <class Impl>
Service(Impl & impl);
template <class Impl>
Service(Impl & impl, dds::rpc::Server & server);
template <class Impl>
Service(Impl & impl,
dds::rpc::Server & server,
const dds::rpc::ServiceParams & service_params);
};
};
} // namespace robot
#include "RobotControlSupport.hpp"
#endif // ROBOTCONTROL_SUPPORT_H