ARCS SDK API  0.24.0
aubo_api.h
浏览该文件的文档.
1 /** @file aubo_api.h
2  * @brief 机器人及外部轴等控制API接口,如获取机器人列表、获取系统信息等等
3  */
4 #ifndef AUBO_SDK_AUBO_API_INTERFACE_H
5 #define AUBO_SDK_AUBO_API_INTERFACE_H
6 
7 #include <aubo/system_info.h>
8 #include <aubo/runtime_machine.h>
10 #include <aubo/robot_interface.h>
11 #include <aubo/global_config.h>
12 #include <aubo/math.h>
13 #include <aubo/socket.h>
14 #include <aubo/serial.h>
15 #include <aubo/axis_interface.h>
16 
17 namespace arcs {
18 namespace common_interface {
19 
20 class ARCS_ABI_EXPORT AuboApi
21 {
22 public:
23  AuboApi();
24  virtual ~AuboApi();
25 
26  /**
27  * 获取纯数学相关接口
28  *
29  * @return MathPtr对象的指针
30  *
31  * @par Python函数原型
32  * getMath(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.Math
33  *
34  * @par C++示例
35  * @code
36  * auto rpc_cli = std::make_shared<RpcClient>();
37  * MathPtr ptr = rpc_cli->getMath();
38  * @endcode
39  *
40  */
41  MathPtr getMath();
42 
43  /**
44  * 获取系统信息
45  *
46  * @return SystemInfoPtr对象的指针
47  *
48  * @par Python函数原型
49  * getSystemInfo(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.SystemInfo
50  *
51  * @par C++示例
52  * @code
53  * auto rpc_cli = std::make_shared<RpcClient>();
54  * SystemInfoPtr ptr = rpc_cli->getSystemInfo();
55  * @endcode
56  *
57  */
58  SystemInfoPtr getSystemInfo();
59 
60  /**
61  * 获取运行时接口
62  *
63  * @return RuntimeMachinePtr对象的指针
64  *
65  * @par Python函数原型
66  * getRuntimeMachine(self: pyaubo_sdk.AuboApi) -> pyaubo_sdk.RuntimeMachine
67  *
68  * @par C++示例
69  * @code
70  * auto rpc_cli = std::make_shared<RpcClient>();
71  * RuntimeMachinePtr ptr = rpc_cli->getRuntimeMachine();
72  * @endcode
73  *
74  */
75  RuntimeMachinePtr getRuntimeMachine();
76 
77  /**
78  * 对外寄存器接口
79  *
80  * @return RegisterControlPtr对象的指针
81  *
82  * @par Python函数原型
83  * getRegisterControl(self: pyaubo_sdk.AuboApi) ->
84  * pyaubo_sdk.RegisterControl
85  *
86  * @par C++示例
87  * @code
88  * auto rpc_cli = std::make_shared<RpcClient>();
89  * RegisterControlPtr ptr = rpc_cli->getRegisterControl();
90  * @endcode
91  *
92  */
93  RegisterControlPtr getRegisterControl();
94 
95  /**
96  * 获取机器人列表
97  *
98  * @return 机器人列表
99  *
100  * @par Python函数原型
101  * getRobotNames(self: pyaubo_sdk.AuboApi) -> List[str]
102  *
103  * @par C++示例
104  * @code
105  * auto rpc_cli = std::make_shared<RpcClient>();
106  * auto robot_name = rpc_cli->getRobotNames().front();
107  * @endcode
108  *
109  * @par JSON-RPC请求示例
110  * {"jsonrpc":"2.0","method":"getRobotNames","params":[],"id":1}
111  *
112  * @par JSON-RPC响应示例
113  * {"id":1,"jsonrpc":"2.0","result":["rob1"]}
114  *
115  */
116  std::vector<std::string> getRobotNames();
117 
118  /**
119  * 根据名字获取 RobotInterfacePtr 接口
120  *
121  * @param name 机器人名字
122  * @return RobotInterfacePtr对象的指针
123  *
124  * @par Python函数原型
125  * getRobotInterface(self: pyaubo_sdk.AuboApi, arg0: str) ->
126  * pyaubo_sdk.RobotInterface
127  *
128  * @par C++示例
129  * @code
130  * auto rpc_cli = std::make_shared<RpcClient>();
131  * auto robot_name = rpc_cli->getRobotNames().front();
132  * RobotInterfacePtr ptr = rpc_cli->getRobotInterface(robot_name);
133  * @endcode
134  *
135  */
136  RobotInterfacePtr getRobotInterface(const std::string &name);
137 
138  /**
139  * 获取外部轴列表
140  *
141  * @return
142  */
143  std::vector<std::string> getAxisNames();
144 
145  /**
146  * 获取外部轴接口
147  *
148  * @param name
149  * @return
150  */
151  AxisInterfacePtr getAxisInterface(const std::string &name);
152 
153  /// 获取独立 IO 模块接口
154 
155  /**
156  * 获取 socket
157  * @return SocketPtr对象的指针
158  *
159  * @par Python函数原型
160  * getSocket(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Socket
161  * @endcode
162  *
163  * @par C++示例
164  * @code
165  * auto rpc_cli = std::make_shared<RpcClient>();
166  * SocketPtr ptr = rpc_cli->getSocket();
167  * @endcode
168  *
169  */
170  SocketPtr getSocket();
171 
172  /**
173  *
174  * @return SerialPtr对象的指针
175  *
176  * @par Python函数原型
177  * getSerial(self: pyaubo_sdk.AuboApi) -> arcs::common_interface::Serial
178  *
179  * @par C++示例
180  * @code
181  * auto rpc_cli = std::make_shared<RpcClient>();
182  * SerialPtr ptr = rpc_cli->getSerial();
183  * @endcode
184  */
185  SerialPtr getSerial();
186 
187  /**
188  * 获取同步运动接口
189  *
190  * @return SyncMovePtr对象的指针
191  */
192  SyncMovePtr getSyncMove(const std::string &name);
193 
194  /**
195  * 获取告警信息接口
196  *
197  * @return TracePtr对象的指针
198  */
199  TracePtr getTrace(const std::string &name);
200 
201 protected:
202  void *d_{ nullptr };
203 };
204 using AuboApiPtr = std::shared_ptr<AuboApi>;
205 
206 // clang-format off
207 #define AuboApi_DECLARES \
208  _FUNC(AuboApi, 0, getMath) \
209  _FUNC(AuboApi, 0, getSystemInfo) \
210  _FUNC(AuboApi, 0, getRuntimeMachine) \
211  _FUNC(AuboApi, 0, getRegisterControl) \
212  _FUNC(AuboApi, 0, getRobotNames) \
213  _FUNC(AuboApi, 1, getRobotInterface, name) \
214  _FUNC(AuboApi, 0, getAxisNames) \
215  _FUNC(AuboApi, 1, getAxisInterface, name) \
216  _FUNC(AuboApi, 0, getSocket) \
217  _FUNC(AuboApi, 0, getSerial) \
218  _FUNC(AuboApi, 1, getSyncMove, name) \
219  _FUNC(AuboApi, 1, getTrace, name)
220 // clang-format on
221 
222 } // namespace common_interface
223 } // namespace arcs
224 
225 #endif // AUBO_SDK_AUBO_API_H
std::shared_ptr< Math > MathPtr
Definition: math.h:388
数学方法接口,如欧拉角与四元数转换、位姿的加减运算
std::shared_ptr< Serial > SerialPtr
Definition: serial.h:238
std::shared_ptr< RobotInterface > RobotInterfacePtr
std::shared_ptr< SystemInfo > SystemInfoPtr
Definition: system_info.h:182
std::shared_ptr< Trace > TracePtr
Definition: trace.h:154
寄存器操作接口,用于三个模块之间的数据交换功能
std::shared_ptr< AuboApi > AuboApiPtr
Definition: aubo_api.h:204
脚本解释器运行时接口, 可以实现脚本解释器的暂停、脚本解释器的设置/取消断点
std::shared_ptr< SyncMove > SyncMovePtr
Definition: sync_move.h:213
std::shared_ptr< Socket > SocketPtr
Definition: socket.h:308
机器人API 接口
串口通信
获取系统信息接口,如接口板的版本号、示教器软件的版本号
std::shared_ptr< RegisterControl > RegisterControlPtr
std::shared_ptr< AxisInterface > AxisInterfacePtr
std::shared_ptr< RuntimeMachine > RuntimeMachinePtr
Definition: aubo_api.h:17
socket通信