ARCS SDK API  0.24.0
sync_move.h
浏览该文件的文档.
1 /** @file sync_move.h
2  * @brief 同步运行
3  *
4  * 1. Independent movements
5  * If the different task programs, and their robots, work independently, no
6  * synchronization or coordination is needed. Each task program is then
7  * written as if it was the program for a single robot system.
8  *
9  * 2. Semi coordinated movements
10  * Several robots can work with the same work object, without synchronized
11  * movements, as long as the work object is not moving.
12  * A positioner can move the work object when the robots are not coordinated
13  * to it, and the robots can be coordinated to the work object when it is not
14  * moving. Switching between moving the object and coordinating the robots is
15  * called semi coordinated movements.
16  *
17  * 3. Coordinated synchronized movements
18  * Several robots can work with the same moving work object.
19  * The positioner or robot that holds the work object and the robots that work
20  * with the work object must have synchronized movements. This means that the
21  * RAPID task programs, that handle one mechanical unit each, execute their
22  * move instructions simultaneously.
23  */
24 #ifndef AUBO_SDK_SYNC_MOVE_INTERFACE_H
25 #define AUBO_SDK_SYNC_MOVE_INTERFACE_H
26 
27 #include <vector>
28 #include <unordered_set>
29 #include <string>
30 #include <memory>
31 #include <aubo/global_config.h>
32 
33 namespace arcs {
34 namespace common_interface {
35 
36 typedef std::unordered_set<std::string> TaskSet;
37 class ARCS_ABI_EXPORT SyncMove
38 {
39 public:
40  SyncMove();
41  virtual ~SyncMove();
42 
43  /**
44  *
45  * @return
46  *
47  * @par Python函数原型
48  * sync(self: pyaubo_sdk.SyncMove) -> int
49  *
50  * @par Lua函数原型
51  * sync() -> nil
52  *
53  */
54  int sync();
55 
56  /**
57  * syncMoveOn is used to start synchronized movement mode.
58  *
59  * A syncMoveOn instruction will wait for the other task programs. When
60  * all task programs have reached the syncMoveOn, they will continue
61  * their execution in synchronized movement mode. The move instructions
62  * in the different task programs are executed simultaneously, until the
63  * instruction syncMoveOff is executed.
64  * A stop point must be programmed before the syncMoveOn instruction.
65  *
66  * @param syncident
67  * @param taskset
68  * @return
69  *
70  * @par Python函数原型
71  * syncMoveOn(self: pyaubo_sdk.SyncMove, arg0: str, arg1: Set[str]) -> int
72  *
73  * @par Lua函数原型
74  * syncMoveOn(syncident: string, taskset: table) -> nil
75  * @endcoe
76  */
77  int syncMoveOn(const std::string &syncident, const TaskSet &taskset);
78 
79  /**
80  * 设置同步路径段的ID
81  * In synchronized movements mode, all or none of the simultaneous move
82  * instructions must be programmed with corner zones. This means that the
83  * move instructions with the same ID must either all have corner zones, or
84  * all have stop points. If a move instruction with a corner zone and a move
85  * instruction with a stop point are synchronously executed in their
86  * respective task program, an error will occur.
87  *
88  * Synchronously executed move instructions can have corner zones of
89  * different sizes (e.g. one use z10 and one use z50).
90  *
91  * @param id
92  * @return
93  *
94  * @par Python函数原型
95  * syncMoveSegment(self: pyaubo_sdk.SyncMove, arg0: int) -> bool
96  *
97  * @par Lua函数原型
98  * syncMoveSegment(id: number) -> boolean
99  * @endcoe
100  */
101  bool syncMoveSegment(int id);
102 
103  /**
104  * syncMoveOff is used to end synchronized movement mode.
105  *
106  * A syncMoveOff instruction will wait for the other task programs. When
107  * all task programs have reached the syncMoveOff, they will continue
108  * their execution in unsynchronized mode.
109  * A stop point must be programmed before the syncMoveOff instruction.
110  *
111  * @param syncident
112  * @return
113  *
114  * @par Python函数原型
115  * syncMoveOff(self: pyaubo_sdk.SyncMove, arg0: str) -> int
116  *
117  * @par Lua函数原型
118  * syncMoveOff(syncident: string) -> nil
119  * @endcoe
120  */
121  int syncMoveOff(const std::string &syncident);
122 
123  /**
124  * syncMoveUndo is used to turn off synchronized movements, even if not
125  * all the other task programs execute the syncMoveUndo instruction.
126  *
127  * syncMoveUndo is intended for UNDO handlers. When the program
128  * pointer is moved from the procedure, syncMoveUndo is used to turn off
129  * the synchronization.
130  *
131  * @return
132  *
133  * @par Python函数原型
134  * syncMoveUndo(self: pyaubo_sdk.SyncMove) -> int
135  *
136  * @par Lua函数原型
137  * syncMoveUndo() -> nil
138  * @endcoe
139  */
140  int syncMoveUndo();
141 
142  /**
143  * waitSyncTasks used to synchronize several task programs at a special
144  * point in the program.
145  *
146  * A waitSyncTasks instruction will wait for the other
147  * task programs. When all task programs have reached the waitSyncTasks
148  * instruction, they will continue their execution.
149  *
150  * @param syncident
151  * @param taskset
152  * @return
153  *
154  * @par Python函数原型
155  * waitSyncTasks(self: pyaubo_sdk.SyncMove, arg0: str, arg1: Set[str]) ->
156  * int
157  *
158  * @par Lua函数原型
159  * waitSyncTasks(syncident: string, taskset: table) -> nil
160  * @endcoe
161  */
162  int waitSyncTasks(const std::string &syncident, const TaskSet &taskset);
163 
164  /**
165  * isSyncMoveOn is used to tell if the mechanical unit group is in synchron-
166  * ized movement mode.
167  *
168  * A task that does not control any mechanical unit can find out if the
169  * mechanical units defined in the parameter Use Mechanical Unit Group are
170  * in synchronized movement mode.
171  *
172  * @return
173  *
174  * @par Python函数原型
175  * isSyncMoveOn(self: pyaubo_sdk.SyncMove) -> bool
176  *
177  * @par Lua函数原型
178  * isSyncMoveOn() -> boolean
179  * @endcoe
180  */
181  bool isSyncMoveOn();
182 
183  /**
184  *
185  * @return
186  *
187  * @par Python函数原型
188  * syncMoveSuspend(self: pyaubo_sdk.SyncMove) -> int
189  *
190  * @par Lua函数原型
191  * syncMoveSuspend() -> nil
192  * @endcoe
193  */
194  int syncMoveSuspend();
195 
196  /**
197  *
198  * @return
199  *
200  * @par Python函数原型
201  * syncMoveResume(self: pyaubo_sdk.SyncMove) -> int
202  *
203  * @par Lua函数原型
204  * syncMoveResume() -> nil
205  * @endcoe
206  */
207  int syncMoveResume();
208 
209 protected:
210  void *d_;
211 };
212 
213 using SyncMovePtr = std::shared_ptr<SyncMove>;
214 
215 // clang-format off
216 #define SyncMove_DECLARES \
217  _INST(SyncMove, 0, sync) \
218  _INST(SyncMove, 2, syncMoveOn, syncident, taskset) \
219  _INST(SyncMove, 1, syncMoveSegment, id) \
220  _INST(SyncMove, 1, syncMoveOff, syncident) \
221  _INST(SyncMove, 0, syncMoveUndo) \
222  _INST(SyncMove, 2, waitSyncTasks, syncident, taskset) \
223  _FUNC(SyncMove, 0, isSyncMoveOn) \
224  _INST(SyncMove, 0, syncMoveSuspend) \
225  _INST(SyncMove, 0, syncMoveResume)
226 // clang-format on
227 } // namespace common_interface
228 } // namespace arcs
229 #endif // AUBO_SDK_SYNC_MOVE_INTERFACE_H
std::shared_ptr< SyncMove > SyncMovePtr
Definition: sync_move.h:213
Definition: aubo_api.h:17
std::unordered_set< std::string > TaskSet
Definition: sync_move.h:36