AuboStudio SDK  0.6.3
render_interface.h
Go to the documentation of this file.
1 #ifndef AUBO_CAPS_INTERFACE_RENDER_INTERFACE_H
2 #define AUBO_CAPS_INTERFACE_RENDER_INTERFACE_H
3 
4 #include <vector>
6 
7 class QGridLayout;
8 
9 namespace arcs {
10 namespace aubo_scope {
11 
12 ARCS_CLASS_FORWARD(RenderInterface);
13 
15 {
16 public:
17  enum ShowOptions : uint16_t
18  {
19  None = 0,
20  Ground = 0x01,
21  TargetRobot = 0x02,
22  RealRobot = 0x04,
23  Coordinate = 0x08,
24  Track = 0x10,
25  Point = 0x20,
26  View = 0x40,
27  Obstacle = 0x80,
28  SafetyPlane = 0x0100,
29  ToolPosition = 0x0200,
30  PointCloud = 0x0400,
31  All = 0xFFFF,
32  };
33 
34 public:
37  virtual ~RenderInterface();
38 
39  /**
40  * 设置 Render 窗口嵌入/移除(isEmbeded) 布局 gly 中
41  *
42  * @param is_embeded 是否嵌入
43  * @param gly 布局
44  * @return 无
45  */
46  void setRenderEmbeded(bool is_embeded, QGridLayout *gly);
47 
48  /**
49  * 设置显示模式,控制各种元素的显隐
50  *
51  * @param options 选项值,详情查看 ShowOptions 枚举
52  * @return 无
53  */
54  void setShowOptions(uint16_t options);
55 
56  /**
57  * 添加/修改点云
58  *
59  * @param name 点云名称
60  * @param points 点集合
61  * @param color 点云颜色 rgba
62  * @return 无
63  */
64  void addPointCloud(const std::string &name,
65  const std::vector<std::vector<double>> &points,
66  const std::vector<double> &color);
67 
68  /**
69  * 移除指定名称的点云
70  *
71  * @param name 点云名称
72  * @return 无
73  */
74  void removePointCloud(const std::string &name);
75 
76  /**
77  * 查找制定名称的点云是否存在
78  *
79  * @param name 点云名称
80  * @retval true 存在
81  * @retval false 不存在
82  */
83  bool hasPointCloud(const std::string &name);
84 
85  /**
86  * 移除所有的点云
87  *
88  * @param 无
89  * @retval 无
90  */
91  void clearPointCloud();
92 
93  /**
94  * 添加/修改路点
95  *
96  * @param wp 代表路点的唯一对象
97  * @param pose 路点位姿 x,y,z,rx,ry,rz
98  * @param color 路点颜色 {r, g, b, a}, 范围是 0.0~1.0
99  * @param axis_visible 路点上是否显示位姿方向箭头
100  * @retval true 成功
101  * @retval false 失败
102  */
103  bool addWaypoint(void *wp, const std::vector<double> &pose,
104  const std::vector<double> &color = { 0.0, 1.0, 0.0, 1.0 },
105  bool axis_visible = false);
106 
107  /**
108  * 移除指定路点
109  *
110  * @param wp 代表路点的唯一对象
111  * @retval 无
112  */
113  void removeWaypoint(void *wp);
114 
115  /**
116  * 查找指定路点是否存在
117  *
118  * @param wp 代表路点的唯一对象
119  * @retval true 存在
120  * @retval false 不存在
121  */
122  bool hasWaypoint(void *wp);
123 
124  /**
125  * 移除所有的路点
126  *
127  * @param 无
128  * @retval 无
129  */
130  void clearWaypoints();
131 
132  /**
133  * 添加/修改指定路点的交融轨迹
134  *
135  * @param wp 代表路点的唯一对象
136  * @param track 路点位姿 x,y,z,rx,ry,rz 集合
137  * @retval 无
138  */
139  void setMoveTrack(void *wp, const std::vector<std::vector<double>> &track);
140  void setBlendTrack(void *wp, const std::vector<std::vector<double>> &track);
141  void setMoveTrack(void *wp, const std::vector<std::vector<double>> &track,
142  const std::vector<double> &color);
143  void setBlendTrack(void *wp, const std::vector<std::vector<double>> &track,
144  const std::vector<double> &color);
145 
146  /**
147  * 添加/修改坐标轴
148  *
149  * @param name 坐标轴名称
150  * @param pose 位姿 x,y,z,rx,ry,rz
151  * @retval 无
152  */
153  void addCoordinate(const std::string &name,
154  const std::vector<double> &pose);
155 
156  /**
157  * 移除指定坐标轴
158  *
159  * @param name 坐标轴名称
160  * @retval 无
161  */
162  void removeCoordinate(const std::string &name);
163 
164  /**
165  * 查找指定坐标轴是否存在
166  *
167  * @param name 坐标轴名称
168  * @retval true 存在
169  * @retval false 不存在
170  */
171  bool hasCoordinate(const std::string &name);
172 
173  /**
174  * 添加/修改线
175  *
176  * @param name 线名称
177  * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
178  * @param pose: 点的参考坐标系, 默认 6 个 0
179  * @param points 点集合
180  * @param color 线颜色 {r, g, b, a}, 范围是 0.0~1.0
181  * @retval 无
182  */
183  void addLine(const std::string &name,
184  const std::vector<std::vector<double>> &points,
185  const std::vector<double> &color);
186  void addLine(const std::string &name, int link_num,
187  const std::vector<double> &pose,
188  const std::vector<std::vector<double>> &points,
189  const std::vector<double> &color);
190 
191  /**
192  * 移除指定线
193  *
194  * @param name 线名称
195  * @retval 无
196  */
197  void removeLine(const std::string &name);
198 
199  /**
200  * 移除所有的线
201  *
202  * @param 无
203  * @retval 无
204  */
205  void clearLines();
206 
207  /**
208  * 添加/修改平面
209  *
210  * @param name 平面名称
211  * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
212  * @param pose 位置
213  * @param size 平面大小(长,宽)
214  * @param color 线颜色 {r, g, b, a}, 范围是 0.0~1.0
215  * @retval 无
216  */
217  void addPlane(const std::string &name, const std::vector<double> &pose,
218  const std::vector<double> &size,
219  const std::vector<double> &color);
220  void addPlane(const std::string &name, int link_num,
221  const std::vector<double> &pose,
222  const std::vector<double> &size,
223  const std::vector<double> &color);
224 
225  /**
226  * 移除指定平面
227  *
228  * @param name 名称
229  * @retval 无
230  */
231  void removePlane(const std::string &name);
232 
233  /**
234  * 移除所有的平面
235  *
236  * @param 无
237  * @retval 无
238  */
239  void clearPlanes();
240 
241  /**
242  * 添加/修改立方体
243  *
244  * @param name 立方体名称
245  * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
246  * @param pose 位置
247  * @param size 立方体大小(长,宽,高)
248  * @param color 立方体颜色 {r, g, b, a}, 范围是 0.0~1.0
249  * @param type 立方体绘制类型 0 代表画 6 个平面,1 代表只画边框线
250  * @retval 无
251  */
252  void addCube(const std::string &name, const std::vector<double> &pose,
253  const std::vector<double> &size,
254  const std::vector<double> &color, int type = 0);
255  void addCube(const std::string &name, int link_num,
256  const std::vector<double> &pose,
257  const std::vector<double> &size,
258  const std::vector<double> &color, int type = 0);
259 
260  /**
261  * 添加/修改立方体
262  *
263  * @param name 立方体名称
264  * @param pose 位置
265  * @param length_min
266  * @param length_max
267  * @param width_min
268  * @param width_max
269  * @param height_min
270  * @param height_max
271  * @param color 立方体颜色 {r, g, b, a}, 范围是 0.0~1.0
272  * @param type 立方体绘制类型 0 代表画 6 个平面,1 代表只画边框线
273  * @retval 无
274  */
275  void addCube(const std::string &name, const std::vector<double> &pose,
276  float length_min, float length_max, float width_min,
277  float width_max, float height_min, float height_max,
278  const std::vector<double> &color, int type = 0);
279  void addCube(const std::string &name, int link_num,
280  const std::vector<double> &pose, float length_min,
281  float length_max, float width_min, float width_max,
282  float height_min, float height_max,
283  const std::vector<double> &color, int type = 0);
284 
285  /**
286  * 移除指定立方体
287  *
288  * @param name 立方体名称
289  * @retval 无
290  */
291  void removeCube(const std::string &name);
292 
293  /**
294  * 移除所有的立方体
295  *
296  * @param 无
297  * @retval 无
298  */
299  void clearCubes();
300 
301  // 模型文件
302  /**
303  * @brief addMesh 添加任意模型文件
304  * @param name: 唯一标识
305  * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
306  * @param model_path: 3ds 文件绝对路径
307  * @param pose: 模型文件安装位置 {x, y, z, rx, ry, rz}
308  * @return 0: 成功; 其他失败
309  */
310  int addMesh(const std::string &name, int link_num,
311  const std::string &model_path, const std::vector<double> &pose);
312 
313  /**
314  * @brief getMeshes 获取关节 link_num 的外设模型名字
315  * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
316  * @return 名字列表
317  */
318  std::vector<std::string> getMeshes(int link_num);
319  int removeMesh(const std::string &name);
320  int clearMeshes(int link_num);
321 
322 private:
323  friend class DataSwitch;
324  RenderInterface();
325  void *d_{ nullptr };
326 };
327 
328 } // namespace aubo_scope
329 } // namespace arcs
330 
331 #endif // AUBO_CAPS_INTERFACE_RENDER_INTERFACE_H
ARCS_CLASS_FORWARD(GripForceCapability)
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16