AUBO SDK  0.25.0
载入中...
搜索中...
未找到
runtime_machine.h
浏览该文件的文档.
1/** @file runtime_machine.h
2 * @brief Script interpreter runtime interface,
3 * allows pausing the script interpreter and setting/removing breakpoints.
4 */
5#ifndef AUBO_SDK_RUNTIME_MACHINE_INTERFACE_H
6#define AUBO_SDK_RUNTIME_MACHINE_INTERFACE_H
7
8#include <memory>
9#include <aubo/global_config.h>
10#include <aubo/type_def.h>
11
12namespace arcs {
13namespace common_interface {
14
15/**
16 * The RuntimeMachine class
17 */
18class ARCS_ABI_EXPORT RuntimeMachine
19{
20public:
22 virtual ~RuntimeMachine();
23
24
25 /**
26 * \chinese
27 * 返回 task_id
28 *
29 * @par JSON-RPC请求示例
30 * {"jsonrpc":"2.0","method":"RuntimeMachine.newTask","params":[false],"id":1}
31 *
32 * @par JSON-RPC响应示例
33 * {"id":1,"jsonrpc":"2.0","result":26}
34 * \endchinese
35 * \english
36 * Returns the task_id
37 *
38 * @par JSON-RPC Request Example
39 * {"jsonrpc":"2.0","method":"RuntimeMachine.newTask","params":[false],"id":1}
40 *
41 * @par JSON-RPC Response Example
42 * {"id":1,"jsonrpc":"2.0","result":26}
43 * \endenglish
44 */
45 int newTask(bool daemon = false);
46
47 /**
48 * \chinese
49 * 删除 task,会终止正在执行的运动
50 *
51 * @par JSON-RPC请求示例
52 * {"jsonrpc":"2.0","method":"RuntimeMachine.deleteTask","params":[26],"id":1}
53 *
54 * @par JSON-RPC响应示例
55 * {"id":1,"jsonrpc":"2.0","result":0}
56 *
57 * \endchinese
58 * \english
59 * Delete a task, which will terminate any ongoing motion.
60 *
61 * @par JSON-RPC Request Example
62 * {"jsonrpc":"2.0","method":"RuntimeMachine.deleteTask","params":[26],"id":1}
63 *
64 * @par JSON-RPC Response Example
65 * {"id":1,"jsonrpc":"2.0","result":0}
66 *
67 * \endenglish
68 */
69 int deleteTask(int tid);
70
71 /**
72 * \chinese
73 * 等待 task 自然结束
74 *
75 * @param tid
76 * @return
77 *
78 * @par JSON-RPC请求示例
79 * {"jsonrpc":"2.0","method":"RuntimeMachine.detachTask","params":[26],"id":1}
80 *
81 * @par JSON-RPC响应示例
82 * {"id":1,"jsonrpc":"2.0","result":0}
83 *
84 * \endchinese
85 * \english
86 * Wait for the task to finish naturally
87 *
88 * @param tid
89 * @return
90 *
91 * @par JSON-RPC Request Example
92 * {"jsonrpc":"2.0","method":"RuntimeMachine.detachTask","params":[26],"id":1}
93 *
94 * @par JSON-RPC Response Example
95 * {"id":1,"jsonrpc":"2.0","result":0}
96 *
97 * \endenglish
98 */
99 int detachTask(int tid);
100
101 /**
102 * \chinese
103 * 判断任务是否存活
104 *
105 * @param tid
106 * @return
107 *
108 * @par JSON-RPC请求示例
109 * {"jsonrpc":"2.0","method":"RuntimeMachine.isTaskAlive","params":[26],"id":1}
110 *
111 * @par JSON-RPC响应示例
112 * {"id":1,"jsonrpc":"2.0","result":true}
113 *
114 * \endchinese
115 * \english
116 * Check if the task is alive
117 *
118 * @param tid
119 * @return
120 *
121 * @par JSON-RPC Request Example
122 * {"jsonrpc":"2.0","method":"RuntimeMachine.isTaskAlive","params":[26],"id":1}
123 *
124 * @par JSON-RPC Response Example
125 * {"id":1,"jsonrpc":"2.0","result":true}
126 *
127 * \endenglish
128 */
129 bool isTaskAlive(int tid);
130
131 /**
132 * \chinese
133 * 获取任务中缓存的指令的数量
134 *
135 * @param tid
136 * @return
137 * \endchinese
138 * \english
139 * Get the number of cached instructions in the task
140 *
141 * @param tid
142 * @return
143 * \endenglish
144 */
145 int getTaskQueueSize(int tid);
146
147 /**
148 * \chinese
149 * 切换当前线程,切换之后接下来的指令将被插入切换后的线程中
150 *
151 * @param tid
152 * @return
153 *
154 * @par JSON-RPC请求示例
155 * {"jsonrpc":"2.0","method":"RuntimeMachine.switchTask","params":[26],"id":1}
156 *
157 * @par JSON-RPC响应示例
158 * {"id":1,"jsonrpc":"2.0","result":0}
159 *
160 * \endchinese
161 * \english
162 * Switch the current thread. After switching, subsequent instructions will be inserted into the switched thread.
163 *
164 * @param tid
165 * @return
166 *
167 * @par JSON-RPC Request Example
168 * {"jsonrpc":"2.0","method":"RuntimeMachine.switchTask","params":[26],"id":1}
169 *
170 * @par JSON-RPC Response Example
171 * {"id":1,"jsonrpc":"2.0","result":0}
172 *
173 * \endenglish
174 */
175 int switchTask(int tid);
176
177 /**
178 * \chinese
179 * 标记记下来的指令的行号和注释
180 *
181 * @param lineno
182 * @param comment
183 * @return
184 *
185 * @par JSON-RPC请求示例
186 * {"jsonrpc":"2.0","method":"RuntimeMachine.setLabel","params":[5,"moveJoint"],"id":1}
187 *
188 * @par JSON-RPC响应示例
189 * {"id":1,"jsonrpc":"2.0","result":0}
190 *
191 * \endchinese
192 * \english
193 * Mark the line number and comment of the recorded instruction
194 *
195 * @param lineno
196 * @param comment
197 * @return
198 *
199 * @par JSON-RPC Request Example
200 * {"jsonrpc":"2.0","method":"RuntimeMachine.setLabel","params":[5,"moveJoint"],"id":1}
201 *
202 * @par JSON-RPC Response Example
203 * {"id":1,"jsonrpc":"2.0","result":0}
204 *
205 * \endenglish
206 */
207 int setLabel(int lineno, const std::string &comment);
208
209 /**
210 * \chinese
211 * 向aubo_control日志中添加注释
212 * 使用 setLabel 替换
213 *
214 * @param tid 指令的线程ID
215 * @param lineno 行号
216 * @param comment 注释
217 * @return
218 *
219 * @par Python函数原型
220 * setPlanContext(self: pyaubo_sdk.RuntimeMachine, arg0: int, arg1: int,
221 * arg2: str) -> int
222 *
223 * @par Lua函数原型
224 * setPlanContext(tid: number, lineno: number, comment: string) -> number
225 *
226 * @par JSON-RPC请求示例
227 * {"jsonrpc":"2.0","method":"RuntimeMachine.setPlanContext","params":[26,3,"moveJoint"],"id":1}
228 *
229 * @par JSON-RPC响应示例
230 * {"id":1,"jsonrpc":"2.0","result":0}
231 *
232 * \endchinese
233 * \english
234 * Add a comment to the aubo_control log
235 * Use setLabel instead
236 *
237 * @param tid Thread ID of the instruction
238 * @param lineno Line number
239 * @param comment Comment
240 * @return
241 *
242 * @par Python function prototype
243 * setPlanContext(self: pyaubo_sdk.RuntimeMachine, arg0: int, arg1: int,
244 * arg2: str) -> int
245 *
246 * @par Lua function prototype
247 * setPlanContext(tid: number, lineno: number, comment: string) -> number
248 *
249 * @par JSON-RPC Request Example
250 * {"jsonrpc":"2.0","method":"RuntimeMachine.setPlanContext","params":[26,3,"moveJoint"],"id":1}
251 *
252 * @par JSON-RPC Response Example
253 * {"id":1,"jsonrpc":"2.0","result":0}
254 *
255 * \endenglish
256 */
257 ARCS_DEPRECATED int setPlanContext(int tid, int lineno,
258 const std::string &comment);
259
260 /**
261 * \chinese
262 * 空操作
263 *
264 * @return
265 *
266 * @par JSON-RPC请求示例
267 * {"jsonrpc":"2.0","method":"RuntimeMachine.nop","params":[],"id":1}
268 *
269 * @par JSON-RPC响应示例
270 * {"id":1,"jsonrpc":"2.0","result":0}
271 *
272 * \endchinese
273 * \english
274 * No operation
275 *
276 * @return
277 *
278 * @par JSON-RPC Request Example
279 * {"jsonrpc":"2.0","method":"RuntimeMachine.nop","params":[],"id":1}
280 *
281 * @par JSON-RPC Response Example
282 * {"id":1,"jsonrpc":"2.0","result":0}
283 *
284 * \endenglish
285 */
286 int nop();
287
288 /**
289 * \chinese
290 * 获取耗时的接口(INST)执行状态, 如 setPersistentParameters
291 *
292 * @return 指令名字, 执行状态
293 * 执行状态: EXECUTING/FINISHED
294 *
295 * @par Python函数原型
296 * getExecutionStatus(self: pyaubo_sdk.RuntimeMachine) -> Tuple[str, str,
297 * int]
298 *
299 * @par Lua函数原型
300 * getExecutionStatus() -> string, string, number
301 *
302 * @par JSON-RPC请求示例
303 * {"jsonrpc":"2.0","method":"RuntimeMachine.getExecutionStatus","params":[],"id":1}
304 *
305 * @par JSON-RPC响应示例
306 * {"id":1,"jsonrpc":"2.0","result":["confirmSafetyParameters","FINISHED"]}
307 *
308 * \endchinese
309 * \english
310 * Get the execution status of time-consuming interfaces (INST), such as setPersistentParameters
311 *
312 * @return Instruction name, execution status
313 * Execution status: EXECUTING/FINISHED
314 *
315 * @par Python function prototype
316 * getExecutionStatus(self: pyaubo_sdk.RuntimeMachine) -> Tuple[str, str, int]
317 *
318 * @par Lua function prototype
319 * getExecutionStatus() -> string, string, number
320 *
321 * @par JSON-RPC Request Example
322 * {"jsonrpc":"2.0","method":"RuntimeMachine.getExecutionStatus","params":[],"id":1}
323 *
324 * @par JSON-RPC Response Example
325 * {"id":1,"jsonrpc":"2.0","result":["confirmSafetyParameters","FINISHED"]}
326 *
327 * \endenglish
328 */
329 std::tuple<std::string, std::string> getExecutionStatus();
330 std::tuple<std::string, std::string, int> getExecutionStatus1();
331
332 /**
333 * \chinese
334 * 跳转到指定行号
335 *
336 * @param lineno
337 * @return
338 *
339 * @par Python函数原型
340 * gotoLine(self: pyaubo_sdk.RuntimeMachine, arg0: int) -> int
341 *
342 * @par Lua函数原型
343 * gotoLine(lineno: number) -> number
344 *
345 * @par JSON-RPC请求示例
346 * {"jsonrpc":"2.0","method":"RuntimeMachine.gotoLine","params":[10],"id":1}
347 *
348 * @par JSON-RPC响应示例
349 * {"id":1,"jsonrpc":"2.0","result":0}
350 *
351 * \endchinese
352 * \english
353 * Jump to the specified line number
354 *
355 * @param lineno
356 * @return
357 *
358 * @par Python function prototype
359 * gotoLine(self: pyaubo_sdk.RuntimeMachine, arg0: int) -> int
360 *
361 * @par Lua function prototype
362 * gotoLine(lineno: number) -> number
363 *
364 * @par JSON-RPC Request Example
365 * {"jsonrpc":"2.0","method":"RuntimeMachine.gotoLine","params":[10],"id":1}
366 *
367 * @par JSON-RPC Response Example
368 * {"id":1,"jsonrpc":"2.0","result":0}
369 *
370 * \endenglish
371 */
372 int gotoLine(int lineno);
373
374 /**
375 * \chinese
376 * 获取当前运行上下文
377 *
378 * @param tid 任务编号
379 * 如果指定(不是-1),返回对应任务的运行上下文;如果不指定(是-1),返回正在运行的线程的运行上下文
380 *
381 * @return
382 *
383 * @par Python函数原型
384 * getPlanContext(self: pyaubo_sdk.RuntimeMachine) -> Tuple[int, int, str]
385 *
386 * @par Lua函数原型
387 * getPlanContext() -> number
388 *
389 * @par JSON-RPC请求示例
390 * {"jsonrpc":"2.0","method":"RuntimeMachine.getPlanContext","params":[-1],"id":1}
391 *
392 * @par JSON-RPC响应示例
393 * {"id":1,"jsonrpc":"2.0","result":[-1,0,""]}
394 *
395 * \endchinese
396 * \english
397 * Get the current runtime context
398 *
399 * @param tid Task ID
400 * If specified (not -1), returns the runtime context of the corresponding task; if not specified (is -1), returns the runtime context of the currently running thread
401 *
402 * @return
403 *
404 * @par Python function prototype
405 * getPlanContext(self: pyaubo_sdk.RuntimeMachine) -> Tuple[int, int, str]
406 *
407 * @par Lua function prototype
408 * getPlanContext() -> number
409 *
410 * @par JSON-RPC Request Example
411 * {"jsonrpc":"2.0","method":"RuntimeMachine.getPlanContext","params":[-1],"id":1}
412 *
413 * @par JSON-RPC Response Example
414 * {"id":1,"jsonrpc":"2.0","result":[-1,0,""]}
415 *
416 * \endenglish
417 */
418 std::tuple<int, int, std::string> getPlanContext(int tid = -1);
419
420 /**
421 * \chinese
422 * 获取提前运行规划器的上下文信息
423 *
424 * @param tid 任务编号
425 * 如果指定(不是-1),返回对应任务运行规划器的上下文信息;如果不指定(是-1),返回正在运行的线程运行规划器的上下文信息
426 *
427 * @return
428 *
429 * @par JSON-RPC请求示例
430 * {"jsonrpc":"2.0","method":"RuntimeMachine.getAdvancePlanContext","params":[-1],"id":1}
431 *
432 * @par JSON-RPC响应示例
433 * {"id":1,"jsonrpc":"2.0","result":[-1,-1,""]}
434 *
435 * \endchinese
436 * \english
437 * Get the context information of the advance planner
438 *
439 * @param tid Task ID
440 * If specified (not -1), returns the context information of the advance planner for the corresponding task; if not specified (is -1), returns the context information of the advance planner for the currently running thread
441 *
442 * @return
443 *
444 * @par JSON-RPC Request Example
445 * {"jsonrpc":"2.0","method":"RuntimeMachine.getAdvancePlanContext","params":[-1],"id":1}
446 *
447 * @par JSON-RPC Response Example
448 * {"id":1,"jsonrpc":"2.0","result":[-1,-1,""]}
449 *
450 * \endenglish
451 */
452 std::tuple<int, int, std::string> getAdvancePlanContext(int tid = -1);
453
454 /**
455 * \chinese
456 * 获取AdvanceRun的程序指针
457 *
458 * @return
459 *
460 * @par JSON-RPC请求示例
461 * {"jsonrpc":"2.0","method":"RuntimeMachine.getAdvancePtr","params":[-1],"id":1}
462 *
463 * @par JSON-RPC响应示例
464 * {"id":1,"jsonrpc":"2.0","result":-1}
465 *
466 * \endchinese
467 * \english
468 * Get the program pointer of AdvanceRun
469 *
470 * @return
471 *
472 * @par JSON-RPC Request Example
473 * {"jsonrpc":"2.0","method":"RuntimeMachine.getAdvancePtr","params":[-1],"id":1}
474 *
475 * @par JSON-RPC Response Example
476 * {"id":1,"jsonrpc":"2.0","result":-1}
477 *
478 * \endenglish
479 */
480 int getAdvancePtr(int tid = -1);
481
482 /**
483 * \chinese
484 * 获取机器人运动的程序指针
485 *
486 * @param tid 任务编号
487 * 如果指定(不是-1),返回对应任务的程序指针;如果不指定(是-1),返回正在运行线程的程序指针
488 *
489 * @return
490 *
491 * @par JSON-RPC请求示例
492 * {"jsonrpc":"2.0","method":"RuntimeMachine.getMainPtr","params":[-1],"id":1}
493 *
494 * @par JSON-RPC响应示例
495 * {"id":1,"jsonrpc":"2.0","result":-1}
496 *
497 * \endchinese
498 * \english
499 * Get the program pointer of robot motion
500 *
501 * @param tid Task ID
502 * If specified (not -1), returns the program pointer of the corresponding task; if not specified (is -1), returns the program pointer of the currently running thread
503 *
504 * @return
505 *
506 * @par JSON-RPC Request Example
507 * {"jsonrpc":"2.0","method":"RuntimeMachine.getMainPtr","params":[-1],"id":1}
508 *
509 * @par JSON-RPC Response Example
510 * {"id":1,"jsonrpc":"2.0","result":-1}
511 *
512 * \endenglish
513 */
514 int getMainPtr(int tid = -1);
515
516 /**
517 * \chinese
518 * 获取最近解释过的指令指针
519 *
520 * @param tid
521 * @return
522 *
523 * @par JSON-RPC请求示例
524 * {"jsonrpc":"2.0","method":"RuntimeMachine.getInterpPtr","params":[26],"id":1}
525 *
526 * @par JSON-RPC响应示例
527 * {"id":1,"jsonrpc":"2.0","result":-1}
528 *
529 * \endchinese
530 * \english
531 * Get the pointer of the most recently interpreted instruction
532 *
533 * @param tid
534 * @return
535 *
536 * @par JSON-RPC Request Example
537 * {"jsonrpc":"2.0","method":"RuntimeMachine.getInterpPtr","params":[26],"id":1}
538 *
539 * @par JSON-RPC Response Example
540 * {"id":1,"jsonrpc":"2.0","result":-1}
541 *
542 * \endenglish
543 */
544 int getInterpPtr(int tid);
545
546 /**
547 * \chinese
548 * 加载本地工程文件
549 * Lua 脚本,只需要给出文件名字,不需要后缀,需要从 ${ARCS_WS}/program
550 * 目录中查找
551 *
552 * @param program
553 * @return
554 *
555 * @par JSON-RPC请求示例
556 * {"jsonrpc":"2.0","method":"RuntimeMachine.loadProgram","params":["demo"],"id":1}
557 *
558 * @par JSON-RPC响应示例
559 * {"id":1,"jsonrpc":"2.0","result":0}
560 *
561 * \endchinese
562 * \english
563 * Load a local project file.
564 * For Lua scripts, only the file name is required (no extension), and it will be searched in the ${ARCS_WS}/program directory.
565 *
566 * @param program
567 * @return
568 *
569 * @par JSON-RPC Request Example
570 * {"jsonrpc":"2.0","method":"RuntimeMachine.loadProgram","params":["demo"],"id":1}
571 *
572 * @par JSON-RPC Response Example
573 * {"id":1,"jsonrpc":"2.0","result":0}
574 *
575 * \endenglish
576 */
577 int loadProgram(const std::string &program);
578
579 /**
580 * \chinese
581 * 预加载工程文件
582 *
583 * @param index 0~99 工程索引号
584 * @param program 工程名字
585 * @return
586 * \endchinese
587 * \english
588 * Preload project file
589 *
590 * @param index Project index number (0~99)
591 * @param program Project name
592 * @return
593 * \endenglish
594 */
595 int preloadProgram(int index, const std::string &program);
596
597 /**
598 * \chinese
599 * 获取预加载工程文件名字,如果没有加载或者超出索引范围则返回空字符串
600 *
601 * @param index 0~99 工程索引号
602 * @return 工程文件名字
603 * \endchinese
604 * \english
605 * Get the name of the preloaded project file. Returns an empty string if not loaded or index is out of range.
606 *
607 * @param index Project index number (0~99)
608 * @return Project file name
609 * \endenglish
610 */
611 std::string getPreloadProgram(int index);
612
613 /**
614 * \chinese
615 * 运行已经加载的工程文件
616 *
617 * @return
618 *
619 * @par JSON-RPC请求示例
620 * {"jsonrpc":"2.0","method":"RuntimeMachine.runProgram","params":[],"id":1}
621 *
622 * @par JSON-RPC响应示例
623 * {"id":1,"jsonrpc":"2.0","result":0}
624 *
625 * \endchinese
626 * \english
627 * Run the already loaded project file
628 *
629 * @return
630 *
631 * @par JSON-RPC Request Example
632 * {"jsonrpc":"2.0","method":"RuntimeMachine.runProgram","params":[],"id":1}
633 *
634 * @par JSON-RPC Response Example
635 * {"id":1,"jsonrpc":"2.0","result":0}
636 *
637 * \endenglish
638 */
640
641 /**
642 * \chinese
643 * 开始运行时
644 *
645 * @return
646 *
647 * @par Python函数原型
648 * start(self: pyaubo_sdk.RuntimeMachine) -> int
649 *
650 * @par Lua函数原型
651 * start() -> number
652 *
653 * @par JSON-RPC请求示例
654 * {"jsonrpc":"2.0","method":"RuntimeMachine.start","params":[],"id":1}
655 *
656 * @par JSON-RPC响应示例
657 * {"id":1,"jsonrpc":"2.0","result":0}
658 *
659 * \endchinese
660 * \english
661 * Start the runtime
662 *
663 * @return
664 *
665 * @par Python function prototype
666 * start(self: pyaubo_sdk.RuntimeMachine) -> int
667 *
668 * @par Lua function prototype
669 * start() -> number
670 *
671 * @par JSON-RPC Request Example
672 * {"jsonrpc":"2.0","method":"RuntimeMachine.start","params":[],"id":1}
673 *
674 * @par JSON-RPC Response Example
675 * {"id":1,"jsonrpc":"2.0","result":0}
676 *
677 * \endenglish
678 */
679 int start();
680
681 /**
682 * \chinese
683 * 停止运行时即脚本运行,无法停止运行时状态为 Stopped 时的机器人运动
684 *
685 * 如果考虑停止机器人所有运动,可以调用 RuntimeMachine::abort 接口
686 *
687 * @return
688 *
689 * @par Python函数原型
690 * stop(self: pyaubo_sdk.RuntimeMachine) -> int
691 *
692 * @par Lua函数原型
693 * stop() -> number
694 *
695 * @par JSON-RPC请求示例
696 * {"jsonrpc":"2.0","method":"RuntimeMachine.stop","params":[],"id":1}
697 *
698 * @par JSON-RPC响应示例
699 * {"id":1,"jsonrpc":"2.0","result":0}
700 *
701 * \endchinese
702 * \english
703 * Stop the runtime, i.e., stop script execution. Cannot stop robot motion when the runtime state is Stopped.
704 *
705 * If you want to stop all robot motion, use the RuntimeMachine::abort interface.
706 *
707 * @return
708 *
709 * @par Python function prototype
710 * stop(self: pyaubo_sdk.RuntimeMachine) -> int
711 *
712 * @par Lua function prototype
713 * stop() -> number
714 *
715 * @par JSON-RPC Request Example
716 * {"jsonrpc":"2.0","method":"RuntimeMachine.stop","params":[],"id":1}
717 *
718 * @par JSON-RPC Response Example
719 * {"id":1,"jsonrpc":"2.0","result":0}
720 *
721 * \endenglish
722 */
723 int stop();
724
725 /**
726 * \chinese
727 * 终止机器人运行.
728 *
729 * 如果只是考虑停止运行时,可以调用 RuntimeMachine::stop 接口
730 *
731 * 如果脚本运行时处于 Running 状态,则终止运行时;如果运行时处于 Stopped
732 * 且机器人正在移动,则停止机器人移动;如果此时力控开启了,则机器人停止力控
733 *
734 * @return
735 *
736 * @par Python函数原型
737 * abort(self: pyaubo_sdk.RuntimeMachine) -> int
738 *
739 * @par Lua函数原型
740 * abort() -> number
741 *
742 * @par JSON-RPC请求示例
743 * {"jsonrpc":"2.0","method":"RuntimeMachine.abort","params":[],"id":1}
744 *
745 * @par JSON-RPC响应示例
746 * {"id":1,"jsonrpc":"2.0","result":0}
747 *
748 * \endchinese
749 * \english
750 * Abort robot operation.
751 *
752 * If you only want to stop the runtime, you can call the RuntimeMachine::stop interface.
753 *
754 * If the script runtime is in the Running state, aborts the runtime; if the runtime is Stopped and the robot is moving, stops the robot motion; if force control is enabled, stops force control.
755 *
756 * @return
757 *
758 * @par Python function prototype
759 * abort(self: pyaubo_sdk.RuntimeMachine) -> int
760 *
761 * @par Lua function prototype
762 * abort() -> number
763 *
764 * @par JSON-RPC Request Example
765 * {"jsonrpc":"2.0","method":"RuntimeMachine.abort","params":[],"id":1}
766 *
767 * @par JSON-RPC Response Example
768 * {"id":1,"jsonrpc":"2.0","result":0}
769 *
770 * \endenglish
771 */
772 int abort();
773
774 /**
775 * \chinese
776 * 暂停解释器
777 *
778 * @return
779 *
780 * @par Python函数原型
781 * pause(self: pyaubo_sdk.RuntimeMachine) -> int
782 *
783 * @par Lua函数原型
784 * pause() -> number
785 *
786 * @par JSON-RPC请求示例
787 * {"jsonrpc":"2.0","method":"RuntimeMachine.pause","params":[],"id":1}
788 *
789 * @par JSON-RPC响应示例
790 * {"id":1,"jsonrpc":"2.0","result":0}
791 *
792 * \endchinese
793 * \english
794 * Pause the interpreter
795 *
796 * @return
797 *
798 * @par Python function prototype
799 * pause(self: pyaubo_sdk.RuntimeMachine) -> int
800 *
801 * @par Lua function prototype
802 * pause() -> number
803 *
804 * @par JSON-RPC Request Example
805 * {"jsonrpc":"2.0","method":"RuntimeMachine.pause","params":[],"id":1}
806 *
807 * @par JSON-RPC Response Example
808 * {"id":1,"jsonrpc":"2.0","result":0}
809 *
810 * \endenglish
811 */
812 int pause();
813
814 /**
815 * \chinese
816 * 单步运行
817 *
818 * @return
819 *
820 * @par Python函数原型
821 * step(self: pyaubo_sdk.RuntimeMachine) -> int
822 *
823 * @par Lua函数原型
824 * step() -> number
825 *
826 * @par JSON-RPC请求示例
827 * {"jsonrpc":"2.0","method":"RuntimeMachine.step","params":[],"id":1}
828 *
829 * @par JSON-RPC响应示例
830 * {"id":1,"jsonrpc":"2.0","result":0}
831 *
832 * \endchinese
833 * \english
834 * Execute a single step
835 *
836 * @return
837 *
838 * @par Python function prototype
839 * step(self: pyaubo_sdk.RuntimeMachine) -> int
840 *
841 * @par Lua function prototype
842 * step() -> number
843 *
844 * @par JSON-RPC Request Example
845 * {"jsonrpc":"2.0","method":"RuntimeMachine.step","params":[],"id":1}
846 *
847 * @par JSON-RPC Response Example
848 * {"id":1,"jsonrpc":"2.0","result":0}
849 *
850 * \endenglish
851 */
852 int step();
853
854 /**
855 * \chinese
856 * 恢复解释器
857 *
858 * @return
859 *
860 * @par Python函数原型
861 * resume(self: pyaubo_sdk.RuntimeMachine) -> int
862 *
863 * @par Lua函数原型
864 * resume() -> number
865 *
866 * @par JSON-RPC请求示例
867 * {"jsonrpc":"2.0","method":"RuntimeMachine.resume","params":[],"id":1}
868 *
869 * @par JSON-RPC响应示例
870 * {"id":1,"jsonrpc":"2.0","result":0}
871 *
872 * \endchinese
873 * \english
874 * Resume the interpreter
875 *
876 * @return
877 *
878 * @par Python function prototype
879 * resume(self: pyaubo_sdk.RuntimeMachine) -> int
880 *
881 * @par Lua function prototype
882 * resume() -> number
883 *
884 * @par JSON-RPC Request Example
885 * {"jsonrpc":"2.0","method":"RuntimeMachine.resume","params":[],"id":1}
886 *
887 * @par JSON-RPC Response Example
888 * {"id":1,"jsonrpc":"2.0","result":0}
889 *
890 * \endenglish
891 */
892 int resume();
893
894 /**
895 * \chinese
896 * 恢复解释器之前等待恢复前之前的序列完成
897 *
898 * @param wait
899 * @return
900 *
901 * @par JSON-RPC请求示例
902 * {"jsonrpc":"2.0","method":"RuntimeMachine.setResumeWait","params":[true],"id":1}
903 *
904 * @par JSON-RPC响应示例
905 * {"id":1,"jsonrpc":"2.0","result":0}
906 *
907 * \endchinese
908 * \english
909 * Wait for the previous sequence to complete before resuming the interpreter
910 *
911 * @param wait
912 * @return
913 *
914 * @par JSON-RPC Request Example
915 * {"jsonrpc":"2.0","method":"RuntimeMachine.setResumeWait","params":[true],"id":1}
916 *
917 * @par JSON-RPC Response Example
918 * {"id":1,"jsonrpc":"2.0","result":0}
919 *
920 * \endenglish
921 */
922 int setResumeWait(bool wait);
923
924 /**
925 * \chinese
926 * 获取规划器的状态
927 *
928 * @return
929 *
930 * @par Python函数原型
931 * getStatus(self: pyaubo_sdk.RuntimeMachine) ->
932 * arcs::common_interface::RuntimeState
933 *
934 * @par Lua函数原型
935 * getStatus() -> number
936 *
937 * @par JSON-RPC请求示例
938 * {"jsonrpc":"2.0","method":"RuntimeMachine.getStatus","params":[],"id":1}
939 *
940 * @par JSON-RPC响应示例
941 * {"id":1,"jsonrpc":"2.0","result":"Running"}
942 *
943 * \endchinese
944 * \english
945 * Get the status of the planner
946 *
947 * @return
948 *
949 * @par Python function prototype
950 * getStatus(self: pyaubo_sdk.RuntimeMachine) ->
951 * arcs::common_interface::RuntimeState
952 *
953 * @par Lua function prototype
954 * getStatus() -> number
955 *
956 * @par JSON-RPC Request Example
957 * {"jsonrpc":"2.0","method":"RuntimeMachine.getStatus","params":[],"id":1}
958 *
959 * @par JSON-RPC Response Example
960 * {"id":1,"jsonrpc":"2.0","result":"Running"}
961 *
962 * \endenglish
963 */
964 ARCS_DEPRECATED RuntimeState getStatus();
966
967 /**
968 * \chinese
969 * 设置断点
970 *
971 * @param lineno
972 * @return
973 *
974 * @par Python函数原型
975 * setBreakPoint(self: pyaubo_sdk.RuntimeMachine, arg0: int) -> int
976 *
977 * @par Lua函数原型
978 * setBreakPoint(lineno: number) -> number
979 *
980 * @par JSON-RPC请求示例
981 * {"jsonrpc":"2.0","method":"RuntimeMachine.setBreakPoint","params":[15],"id":1}
982 *
983 * @par JSON-RPC响应示例
984 * {"id":1,"jsonrpc":"2.0","result":0}
985 *
986 * \endchinese
987 * \english
988 * Set a breakpoint
989 *
990 * @param lineno
991 * @return
992 *
993 * @par Python function prototype
994 * setBreakPoint(self: pyaubo_sdk.RuntimeMachine, arg0: int) -> int
995 *
996 * @par Lua function prototype
997 * setBreakPoint(lineno: number) -> number
998 *
999 * @par JSON-RPC Request Example
1000 * {"jsonrpc":"2.0","method":"RuntimeMachine.setBreakPoint","params":[15],"id":1}
1001 *
1002 * @par JSON-RPC Response Example
1003 * {"id":1,"jsonrpc":"2.0","result":0}
1004 *
1005 * \endenglish
1006 */
1007 int setBreakPoint(int lineno);
1008
1009 /**
1010 * \chinese
1011 * 移除断点
1012 *
1013 * @param lineno
1014 * @return
1015 *
1016 * @par Python函数原型
1017 * removeBreakPoint(self: pyaubo_sdk.RuntimeMachine, arg0: int) -> int
1018 *
1019 * @par Lua函数原型
1020 * removeBreakPoint(lineno: number) -> number
1021 *
1022 * @par JSON-RPC请求示例
1023 * {"jsonrpc":"2.0","method":"RuntimeMachine.removeBreakPoint","params":[15],"id":1}
1024 *
1025 * @par JSON-RPC响应示例
1026 * {"id":1,"jsonrpc":"2.0","result":0}
1027 *
1028 * \endchinese
1029 * \english
1030 * Remove a breakpoint
1031 *
1032 * @param lineno
1033 * @return
1034 *
1035 * @par Python function prototype
1036 * removeBreakPoint(self: pyaubo_sdk.RuntimeMachine, arg0: int) -> int
1037 *
1038 * @par Lua function prototype
1039 * removeBreakPoint(lineno: number) -> number
1040 *
1041 * @par JSON-RPC Request Example
1042 * {"jsonrpc":"2.0","method":"RuntimeMachine.removeBreakPoint","params":[15],"id":1}
1043 *
1044 * @par JSON-RPC Response Example
1045 * {"id":1,"jsonrpc":"2.0","result":0}
1046 *
1047 * \endenglish
1048 */
1049 int removeBreakPoint(int lineno);
1050
1051 /**
1052 * \chinese
1053 * 清除所有断点
1054 *
1055 * @return
1056 *
1057 * @par Python函数原型
1058 * clearBreakPoints(self: pyaubo_sdk.RuntimeMachine) -> int
1059 *
1060 * @par Lua函数原型
1061 * clearBreakPoints() -> number
1062 *
1063 * @par JSON-RPC请求示例
1064 * {"jsonrpc":"2.0","method":"RuntimeMachine.clearBreakPoints","params":[],"id":1}
1065 *
1066 * @par JSON-RPC响应示例
1067 * {"id":1,"jsonrpc":"2.0","result":0}
1068 *
1069 * \endchinese
1070 * \english
1071 * Clear all breakpoints
1072 *
1073 * @return
1074 *
1075 * @par Python function prototype
1076 * clearBreakPoints(self: pyaubo_sdk.RuntimeMachine) -> int
1077 *
1078 * @par Lua function prototype
1079 * clearBreakPoints() -> number
1080 *
1081 * @par JSON-RPC Request Example
1082 * {"jsonrpc":"2.0","method":"RuntimeMachine.clearBreakPoints","params":[],"id":1}
1083 *
1084 * @par JSON-RPC Response Example
1085 * {"id":1,"jsonrpc":"2.0","result":0}
1086 *
1087 * \endenglish
1088 */
1090
1091 /**
1092 * \chinese
1093 * 定时器开始
1094 *
1095 * @param name
1096 * @return
1097 *
1098 * @par Python函数原型
1099 * timerStart(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1100 *
1101 * @par Lua函数原型
1102 * timerStart(name: string) -> nil
1103 *
1104 * @par JSON-RPC请求示例
1105 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerStart","params":["timer"],"id":1}
1106 *
1107 * @par JSON-RPC响应示例
1108 * {"id":1,"jsonrpc":"2.0","result":0}
1109 *
1110 * \endchinese
1111 * \english
1112 * Start the timer
1113 *
1114 * @param name
1115 * @return
1116 *
1117 * @par Python function prototype
1118 * timerStart(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1119 *
1120 * @par Lua function prototype
1121 * timerStart(name: string) -> nil
1122 *
1123 * @par JSON-RPC Request Example
1124 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerStart","params":["timer"],"id":1}
1125 *
1126 * @par JSON-RPC Response Example
1127 * {"id":1,"jsonrpc":"2.0","result":0}
1128 *
1129 * \endenglish
1130 */
1131 int timerStart(const std::string &name);
1132
1133 /**
1134 * \chinese
1135 * 定时器结束
1136 *
1137 * @param name
1138 * @return
1139 *
1140 * @par Python函数原型
1141 * timerStop(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1142 *
1143 * @par Lua函数原型
1144 * timerStop(name: string) -> nil
1145 *
1146 * @par JSON-RPC请求示例
1147 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerStop","params":["timer"],"id":1}
1148 *
1149 * @par JSON-RPC响应示例
1150 * {"id":1,"jsonrpc":"2.0","result":0}
1151 *
1152 * \endchinese
1153 * \english
1154 * Stop the timer
1155 *
1156 * @param name
1157 * @return
1158 *
1159 * @par Python function prototype
1160 * timerStop(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1161 *
1162 * @par Lua function prototype
1163 * timerStop(name: string) -> nil
1164 *
1165 * @par JSON-RPC Request Example
1166 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerStop","params":["timer"],"id":1}
1167 *
1168 * @par JSON-RPC Response Example
1169 * {"id":1,"jsonrpc":"2.0","result":0}
1170 *
1171 * \endenglish
1172 */
1173 int timerStop(const std::string &name);
1174
1175 /**
1176 * \chinese
1177 * 定时器重置
1178 *
1179 * @param name
1180 * @return
1181 *
1182 * @par Python函数原型
1183 * timerReset(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1184 *
1185 * @par Lua函数原型
1186 * timerReset(name: string) -> nil
1187 *
1188 * @par JSON-RPC请求示例
1189 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerReset","params":["timer"],"id":1}
1190 *
1191 * @par JSON-RPC响应示例
1192 * {"id":1,"jsonrpc":"2.0","result":0}
1193 *
1194 * \endchinese
1195 * \english
1196 * Reset the timer
1197 *
1198 * @param name
1199 * @return
1200 *
1201 * @par Python function prototype
1202 * timerReset(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1203 *
1204 * @par Lua function prototype
1205 * timerReset(name: string) -> nil
1206 *
1207 * @par JSON-RPC Request Example
1208 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerReset","params":["timer"],"id":1}
1209 *
1210 * @par JSON-RPC Response Example
1211 * {"id":1,"jsonrpc":"2.0","result":0}
1212 *
1213 * \endenglish
1214 */
1215 int timerReset(const std::string &name);
1216
1217 /**
1218 * \chinese
1219 * 定时器删除
1220 *
1221 * @param name
1222 * @return
1223 *
1224 * @par Python函数原型
1225 * timerDelete(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1226 *
1227 * @par Lua函数原型
1228 * timerDelete(name: string) -> nil
1229 *
1230 * @par JSON-RPC请求示例
1231 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerDelete","params":["timer"],"id":1}
1232 *
1233 * @par JSON-RPC响应示例
1234 * {"id":1,"jsonrpc":"2.0","result":0}
1235 *
1236 * \endchinese
1237 * \english
1238 * Delete the timer
1239 *
1240 * @param name
1241 * @return
1242 *
1243 * @par Python function prototype
1244 * timerDelete(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> int
1245 *
1246 * @par Lua function prototype
1247 * timerDelete(name: string) -> nil
1248 *
1249 * @par JSON-RPC Request Example
1250 * {"jsonrpc":"2.0","method":"RuntimeMachine.timerDelete","params":["timer"],"id":1}
1251 *
1252 * @par JSON-RPC Response Example
1253 * {"id":1,"jsonrpc":"2.0","result":0}
1254 *
1255 * \endenglish
1256 */
1257 int timerDelete(const std::string &name);
1258
1259 /**
1260 * \chinese
1261 * 获取定时器数值
1262 *
1263 * @param name
1264 * @return
1265 *
1266 * @par Python函数原型
1267 * getTimer(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> float
1268 *
1269 * @par Lua函数原型
1270 * getTimer(name: string) -> number
1271 *
1272 * @par JSON-RPC请求示例
1273 * {"jsonrpc":"2.0","method":"RuntimeMachine.getTimer","params":["timer"],"id":1}
1274 *
1275 * @par JSON-RPC响应示例
1276 * {"id":1,"jsonrpc":"2.0","result":25.409769612}
1277 *
1278 * \endchinese
1279 * \english
1280 * Get the timer value
1281 *
1282 * @param name
1283 * @return
1284 *
1285 * @par Python function prototype
1286 * getTimer(self: pyaubo_sdk.RuntimeMachine, arg0: str) -> float
1287 *
1288 * @par Lua function prototype
1289 * getTimer(name: string) -> number
1290 *
1291 * @par JSON-RPC Request Example
1292 * {"jsonrpc":"2.0","method":"RuntimeMachine.getTimer","params":["timer"],"id":1}
1293 *
1294 * @par JSON-RPC Response Example
1295 * {"id":1,"jsonrpc":"2.0","result":25.409769612}
1296 *
1297 * \endenglish
1298 */
1299 double getTimer(const std::string &name);
1300
1301 /**
1302 * \chinese
1303 * 开始配置触发
1304 *
1305 * @param distance
1306 * @param delay
1307 * @return
1308 *
1309 * @par JSON-RPC请求示例
1310 * {"jsonrpc":"2.0","method":"RuntimeMachine.triggBegin","params":[],"id":1}
1311 *
1312 * @par JSON-RPC响应示例
1313 * {"id":1,"jsonrpc":"2.0","result":0}
1314 *
1315 * \endchinese
1316 * \english
1317 * Start configuring trigger
1318 *
1319 * @param distance
1320 * @param delay
1321 * @return
1322 *
1323 * @par JSON-RPC Request Example
1324 * {"jsonrpc":"2.0","method":"RuntimeMachine.triggBegin","params":[],"id":1}
1325 *
1326 * @par JSON-RPC Response Example
1327 * {"id":1,"jsonrpc":"2.0","result":0}
1328 *
1329 * \endenglish
1330 */
1331 int triggBegin(double distance, double delay);
1332
1333 /**
1334 * \chinese
1335 * 终止配置触发
1336 *
1337 * @return
1338 *
1339 * @par JSON-RPC请求示例
1340 * {"jsonrpc":"2.0","method":"RuntimeMachine.triggEnd","params":[],"id":1}
1341 *
1342 * @par JSON-RPC响应示例
1343 * {"id":1,"jsonrpc":"2.0","result":0}
1344 *
1345 * \endchinese
1346 * \english
1347 * End configuring trigger
1348 *
1349 * @return
1350 *
1351 * @par JSON-RPC Request Example
1352 * {"jsonrpc":"2.0","method":"RuntimeMachine.triggEnd","params":[],"id":1}
1353 *
1354 * @par JSON-RPC Response Example
1355 * {"id":1,"jsonrpc":"2.0","result":0}
1356 *
1357 * \endenglish
1358 */
1360
1361 /**
1362 * \chinese
1363 * 返回自动分配的中断号
1364 *
1365 * @param distance
1366 * @param delay
1367 * @param intnum
1368 * @return
1369 * \endchinese
1370 * \english
1371 * Returns the automatically assigned interrupt number
1372 *
1373 * @param distance
1374 * @param delay
1375 * @param intnum
1376 * @return
1377 * \endenglish
1378 */
1379 int triggInterrupt(double distance, double delay);
1380
1381 /**
1382 * \chinese
1383 * 获取所有的中断号列表
1384 *
1385 * @return
1386 *
1387 * @par JSON-RPC请求示例
1388 * {"jsonrpc":"2.0","method":"RuntimeMachine.getTriggInterrupts","params":[],"id":1}
1389 *
1390 * @par JSON-RPC响应示例
1391 * {"id":1,"jsonrpc":"2.0","result":[]}
1392 *
1393 * \endchinese
1394 * \english
1395 * Get the list of all interrupt numbers
1396 *
1397 * @return
1398 *
1399 * @par JSON-RPC Request Example
1400 * {"jsonrpc":"2.0","method":"RuntimeMachine.getTriggInterrupts","params":[],"id":1}
1401 *
1402 * @par JSON-RPC Response Example
1403 * {"id":1,"jsonrpc":"2.0","result":[]}
1404 *
1405 * \endenglish
1406 */
1407 std::vector<int> getTriggInterrupts();
1408
1409protected:
1410 void *d_;
1411};
1412
1413using RuntimeMachinePtr = std::shared_ptr<RuntimeMachine>;
1414
1415} // namespace common_interface
1416} // namespace arcs
1417#endif // AUBO_SDK_RUNTIME_MACHINE_H
int timerStop(const std::string &name)
定时器结束
int preloadProgram(int index, const std::string &program)
预加载工程文件
double getTimer(const std::string &name)
获取定时器数值
int switchTask(int tid)
切换当前线程,切换之后接下来的指令将被插入切换后的线程中
std::tuple< int, int, std::string > getPlanContext(int tid=-1)
获取当前运行上下文
int abort()
终止机器人运行.
std::string getPreloadProgram(int index)
获取预加载工程文件名字,如果没有加载或者超出索引范围则返回空字符串
int gotoLine(int lineno)
跳转到指定行号
int detachTask(int tid)
等待 task 自然结束
int runProgram()
运行已经加载的工程文件
int timerReset(const std::string &name)
定时器重置
std::tuple< int, int, std::string > getAdvancePlanContext(int tid=-1)
获取提前运行规划器的上下文信息
ARCS_DEPRECATED int setPlanContext(int tid, int lineno, const std::string &comment)
向aubo_control日志中添加注释 使用 setLabel 替换
int triggBegin(double distance, double delay)
开始配置触发
int getAdvancePtr(int tid=-1)
获取AdvanceRun的程序指针
int triggEnd()
终止配置触发
int removeBreakPoint(int lineno)
移除断点
int clearBreakPoints()
清除所有断点
std::tuple< std::string, std::string, int > getExecutionStatus1()
int setBreakPoint(int lineno)
设置断点
int setResumeWait(bool wait)
恢复解释器之前等待恢复前之前的序列完成
int loadProgram(const std::string &program)
加载本地工程文件 Lua 脚本,只需要给出文件名字,不需要后缀,需要从 ${ARCS_WS}/program 目录中查找
ARCS_DEPRECATED RuntimeState getStatus()
获取规划器的状态
int getInterpPtr(int tid)
获取最近解释过的指令指针
int getTaskQueueSize(int tid)
获取任务中缓存的指令的数量
std::vector< int > getTriggInterrupts()
获取所有的中断号列表
int deleteTask(int tid)
删除 task,会终止正在执行的运动
int newTask(bool daemon=false)
返回 task_id
int triggInterrupt(double distance, double delay)
返回自动分配的中断号
int timerDelete(const std::string &name)
定时器删除
int getMainPtr(int tid=-1)
获取机器人运动的程序指针
int timerStart(const std::string &name)
定时器开始
std::tuple< std::string, std::string > getExecutionStatus()
获取耗时的接口(INST)执行状态, 如 setPersistentParameters
bool isTaskAlive(int tid)
判断任务是否存活
int setLabel(int lineno, const std::string &comment)
标记记下来的指令的行号和注释
int stop()
停止运行时即脚本运行,无法停止运行时状态为 Stopped 时的机器人运动
std::shared_ptr< RuntimeMachine > RuntimeMachinePtr
数据类型的定义