AuboStudio SDK  0.6.3
render_interface.h
浏览该文件的文档.
1#ifndef AUBO_CAPS_INTERFACE_RENDER_INTERFACE_H
2#define AUBO_CAPS_INTERFACE_RENDER_INTERFACE_H
3
4#include <vector>
6
7class QGridLayout;
8
9namespace arcs {
10namespace aubo_scope {
11
13
14/**
15 * @ingroup UserInterfaceApi
16 * \chinese
17 * 渲染接口
18 * 提供 3D 渲染相关的显示选项控制,包括地面、机器人模型、坐标系、轨迹和点等元素的
19 * 显示/隐藏。
20 * \endchinese
21 * \english
22 * RenderInterface
23 * Provides display option controls related to 3D rendering, including show/hide
24 * of ground, robot models, coordinate systems, trajectories and points.
25 * \endenglish
26 */
27
29{
30public:
31 enum ShowOptions : uint16_t
32 {
33 None = 0,
34 Ground = 0x01,
36 RealRobot = 0x04,
37 Coordinate = 0x08,
38 Track = 0x10,
39 Point = 0x20,
40 View = 0x40,
41 Obstacle = 0x80,
42 SafetyPlane = 0x0100,
43 ToolPosition = 0x0200,
44 PointCloud = 0x0400,
45 All = 0xFFFF,
46 };
47
48public:
52
53 /**
54 * @ingroup RenderInterface
55 * \chinese
56 * 设置 Render 窗口嵌入/移除(isEmbeded) 布局 gly 中
57 *
58 * @param is_embeded 是否嵌入
59 * @param gly 布局
60 * \endchinese
61 * \english
62 * Set the render window to be embedded/removed in the layout gly.
63 *
64 * @param is_embeded whether to embed
65 * @param gly the layout
66 * \endenglish
67 */
68 void setRenderEmbeded(bool is_embeded, QGridLayout *gly);
69
70 /**
71 * @ingroup RenderInterface
72 * \chinese
73 * 设置显示模式,控制各种元素的显隐
74 *
75 * @param options 选项值,详情查看 ShowOptions 枚举
76 * \endchinese
77 * \english
78 * Set the display mode to control the visibility of various elements.
79 *
80 * @param options option value, see ShowOptions enum for details
81 * \endenglish
82 */
83 void setShowOptions(uint16_t options);
84
85 /**
86 * @ingroup RenderInterface
87 * \chinese
88 * 添加/修改点云
89 *
90 * @param name 点云名称
91 * @param points 点集合
92 * @param color 点云颜色 rgba
93 * \endchinese
94 * \english
95 * Add/modify point cloud.
96 *
97 * @param name point cloud name
98 * @param points point collection
99 * @param color point cloud color rgba
100 * \endenglish
101 */
102 void addPointCloud(const std::string &name,
103 const std::vector<std::vector<double>> &points,
104 const std::vector<double> &color);
105
106 /**
107 * @ingroup RenderInterface
108 * \chinese
109 * 移除指定名称的点云
110 *
111 * @param name 点云名称
112 * \endchinese
113 * \english
114 * Remove the point cloud with the specified name.
115 *
116 * @param name point cloud name
117 * \endenglish
118 */
119 void removePointCloud(const std::string &name);
120
121 /**
122 * @ingroup RenderInterface
123 * \chinese
124 * 查找指定名称的点云是否存在
125 *
126 * @param name 点云名称
127 * @retval true 存在
128 * @retval false 不存在
129 * \endchinese
130 * \english
131 * Check whether the point cloud with the specified name exists.
132 *
133 * @param name point cloud name
134 * @retval true exists
135 * @retval false does not exist
136 * \endenglish
137 */
138 bool hasPointCloud(const std::string &name);
139
140 /**
141 * @ingroup RenderInterface
142 * \chinese
143 * 移除所有的点云
144 * \endchinese
145 * \english
146 * Remove all point clouds.
147 * \endenglish
148 */
150
151 /**
152 * @ingroup RenderInterface
153 * \chinese
154 * 添加/修改路点
155 *
156 * @param wp 代表路点的唯一对象
157 * @param pose 路点位姿 x,y,z,rx,ry,rz
158 * @param color 路点颜色 {r, g, b, a}, 范围是 0.0~1.0
159 * @param axis_visible 路点上是否显示位姿方向箭头
160 * @retval true 成功
161 * @retval false 失败
162 * \endchinese
163 * \english
164 * Add/modify waypoint.
165 *
166 * @param wp the unique object representing the waypoint
167 * @param pose waypoint pose x,y,z,rx,ry,rz
168 * @param color waypoint color {r, g, b, a}, range 0.0~1.0
169 * @param axis_visible whether to show pose direction arrows on the waypoint
170 * @retval true success
171 * @retval false failure
172 * \endenglish
173 */
174 bool addWaypoint(void *wp, const std::vector<double> &pose,
175 const std::vector<double> &color = { 0.0, 1.0, 0.0, 1.0 },
176 bool axis_visible = false);
177
178 /**
179 * @ingroup RenderInterface
180 * \chinese
181 * 移除指定路点
182 *
183 * @param wp 代表路点的唯一对象
184 * \endchinese
185 * \english
186 * Remove the specified waypoint.
187 *
188 * @param wp the unique object representing the waypoint
189 * \endenglish
190 */
191 void removeWaypoint(void *wp);
192
193 /**
194 * @ingroup RenderInterface
195 * \chinese
196 * 查找指定路点是否存在
197 *
198 * @param wp 代表路点的唯一对象
199 * @retval true 存在
200 * @retval false 不存在
201 * \endchinese
202 * \english
203 * Check whether the specified waypoint exists.
204 *
205 * @param wp the unique object representing the waypoint
206 * @retval true exists
207 * @retval false does not exist
208 * \endenglish
209 */
210 bool hasWaypoint(void *wp);
211
212 /**
213 * @ingroup RenderInterface
214 * \chinese
215 * 移除所有的路点
216 * \endchinese
217 * \english
218 * Remove all waypoints.
219 * \endenglish
220 */
222
223 /**
224 * @ingroup RenderInterface
225 * \chinese
226 * 添加/修改指定路点的交融轨迹
227 *
228 * @param wp 代表路点的唯一对象
229 * @param track 路点位姿 x,y,z,rx,ry,rz 集合
230 * \endchinese
231 * \english
232 * Add/modify the move track for the specified waypoint.
233 *
234 * @param wp the unique object representing the waypoint
235 * @param track waypoint pose collection x,y,z,rx,ry,rz
236 * \endenglish
237 */
238 void setMoveTrack(void *wp, const std::vector<std::vector<double>> &track);
239
240 /**
241 * @ingroup RenderInterface
242 * \chinese
243 * @brief setBlendTrack 设置混合轨迹
244 * @param wp 路点对象
245 * @param track 轨迹集合
246 * \endchinese
247 * \english
248 * @brief setBlendTrack
249 * @param wp
250 * @param track
251 * \endenglish
252 */
253 void setBlendTrack(void *wp, const std::vector<std::vector<double>> &track);
254
255 /**
256 * @ingroup RenderInterface
257 * \chinese
258 * @brief setMoveTrack 设置移动轨迹
259 * @param wp 路点对象
260 * @param track 轨迹集合
261 * @param color 颜色
262 * \endchinese
263 * \english
264 * @brief setMoveTrack
265 * @param wp
266 * @param track
267 * @param color
268 * \endenglish
269 */
270 void setMoveTrack(void *wp, const std::vector<std::vector<double>> &track,
271 const std::vector<double> &color);
272
273 /**
274 * @ingroup RenderInterface
275 * \chinese
276 * @brief setBlendTrack 设置混合轨迹
277 * @param wp 路点对象
278 * @param track 轨迹集合
279 * @param color 颜色
280 * \endchinese
281 * \english
282 * @brief setBlendTrack
283 * @param wp
284 * @param track
285 * @param color
286 * \endenglish
287 */
288 void setBlendTrack(void *wp, const std::vector<std::vector<double>> &track,
289 const std::vector<double> &color);
290
291 /**
292 * @ingroup RenderInterface
293 * \chinese
294 * 添加/修改坐标轴
295 *
296 * @param name 坐标轴名称
297 * @param pose 位姿 x,y,z,rx,ry,rz
298 * \endchinese
299 * \english
300 * Add/modify coordinate axis.
301 *
302 * @param name coordinate name
303 * @param pose pose x,y,z,rx,ry,rz
304 * \endenglish
305 */
306 void addCoordinate(const std::string &name,
307 const std::vector<double> &pose);
308
309 /**
310 * @ingroup RenderInterface
311 * \chinese
312 * 移除指定坐标轴
313 *
314 * @param name 坐标轴名称
315 * \endchinese
316 * \english
317 * Remove the specified coordinate axis.
318 *
319 * @param name coordinate name
320 * \endenglish
321 */
322 void removeCoordinate(const std::string &name);
323
324 /**
325 * @ingroup RenderInterface
326 * \chinese
327 * 查找指定坐标轴是否存在
328 *
329 * @param name 坐标轴名称
330 * @retval true 存在
331 * @retval false 不存在
332 * \endchinese
333 * \english
334 * Check whether the specified coordinate axis exists.
335 *
336 * @param name coordinate name
337 * @retval true exists
338 * @retval false does not exist
339 * \endenglish
340 */
341 bool hasCoordinate(const std::string &name);
342
343 /**
344 * @ingroup RenderInterface
345 * \chinese
346 * 添加/修改线
347 *
348 * @param name 线名称
349 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
350 * @param pose: 点的参考坐标系, 默认 6 个 0
351 * @param points 点集合
352 * @param color 线颜色 {r, g, b, a}, 范围是 0.0~1.0
353 * \endchinese
354 * \english
355 * Add/modify line.
356 *
357 * @param name line name
358 * @param link_num: -1: TCP; 0: base; 1~6: joints;
359 * @param pose: reference coordinate system for points, default 6 zeros
360 * @param points point collection
361 * @param color line color {r, g, b, a}, range 0.0~1.0
362 * \endenglish
363 */
364 void addLine(const std::string &name,
365 const std::vector<std::vector<double>> &points,
366 const std::vector<double> &color);
367
368 /**
369 * @ingroup RenderInterface
370 * \chinese
371 * @brief addLine 添加线
372 * @param name 线名称
373 * @param link_num 关节编号
374 * @param pose 位姿
375 * @param points 点集合
376 * @param color 颜色
377 * \endchinese
378 * \english
379 * @brief addLine
380 * @param name
381 * @param link_num
382 * @param pose
383 * @param points
384 * @param color
385 * \endenglish
386 */
387 void addLine(const std::string &name, int link_num,
388 const std::vector<double> &pose,
389 const std::vector<std::vector<double>> &points,
390 const std::vector<double> &color);
391
392 /**
393 * @ingroup RenderInterface
394 * \chinese
395 * 移除指定线
396 *
397 * @param name 线名称
398 * \endchinese
399 * \english
400 * Remove the specified line.
401 *
402 * @param name line name
403 * \endenglish
404 */
405 void removeLine(const std::string &name);
406
407 /**
408 * @ingroup RenderInterface
409 * \chinese
410 * 移除所有的线
411 * \endchinese
412 * \english
413 * Remove all lines.
414 * \endenglish
415 */
417
418 /**
419 * @ingroup RenderInterface
420 * \chinese
421 * 添加/修改平面
422 *
423 * @param name 平面名称
424 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
425 * @param pose 位置
426 * @param size 平面大小(长,宽)
427 * @param color 线颜色 {r, g, b, a}, 范围是 0.0~1.0
428 * \endchinese
429 * \english
430 * Add/modify plane.
431 *
432 * @param name plane name
433 * @param link_num: -1: TCP; 0: base; 1~6: joints;
434 * @param pose position
435 * @param size plane size (length, width)
436 * @param color color {r, g, b, a}, range 0.0~1.0
437 * \endenglish
438 */
439 void addPlane(const std::string &name, const std::vector<double> &pose,
440 const std::vector<double> &size,
441 const std::vector<double> &color);
442
443 /**
444 * @ingroup RenderInterface
445 * \chinese
446 * @brief addPlane 添加平面
447 * @param name 平面名称
448 * @param link_num 关节编号
449 * @param pose 位姿
450 * @param size 大小
451 * @param color 颜色
452 * \endchinese
453 * \english
454 * @brief addPlane
455 * @param name
456 * @param link_num
457 * @param pose
458 * @param size
459 * @param color
460 * \endenglish
461 */
462 void addPlane(const std::string &name, int link_num,
463 const std::vector<double> &pose,
464 const std::vector<double> &size,
465 const std::vector<double> &color);
466
467 /**
468 * @ingroup RenderInterface
469 * \chinese
470 * 移除指定平面
471 *
472 * @param name 名称
473 * \endchinese
474 * \english
475 * Remove the specified plane.
476 *
477 * @param name plane name
478 * \endenglish
479 */
480 void removePlane(const std::string &name);
481
482 /**
483 * @ingroup RenderInterface
484 * \chinese
485 * 移除所有的平面
486 * \endchinese
487 * \english
488 * Remove all planes.
489 * \endenglish
490 */
492
493 /**
494 * @ingroup RenderInterface
495 * \chinese
496 * 添加/修改立方体
497 *
498 * @param name 立方体名称
499 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
500 * @param pose 位置
501 * @param size 立方体大小(长,宽,高)
502 * @param color 立方体颜色 {r, g, b, a}, 范围是 0.0~1.0
503 * @param type 立方体绘制类型 0 代表画 6 个平面,1 代表只画边框线
504 * \endchinese
505 * \english
506 * Add/modify cube.
507 *
508 * @param name cube name
509 * @param link_num: -1: TCP; 0: base; 1~6: joints;
510 * @param pose position
511 * @param size cube size (length, width, height)
512 * @param color cube color {r, g, b, a}, range 0.0~1.0
513 * @param type cube rendering type: 0 for 6 planes, 1 for wireframe
514 * \endenglish
515 */
516 void addCube(const std::string &name, const std::vector<double> &pose,
517 const std::vector<double> &size,
518 const std::vector<double> &color, int type = 0);
519 /**
520 * @ingroup RenderInterface
521 * \chinese
522 * @brief addCube 添加立方体
523 * @param name 立方体名称
524 * @param link_num 关节编号
525 * @param pose 位姿
526 * @param size 大小
527 * @param color 颜色
528 * @param type 类型
529 * \endchinese
530 * \english
531 * @brief addCube
532 * @param name
533 * @param link_num
534 * @param pose
535 * @param size
536 * @param color
537 * @param type
538 * \endenglish
539 */
540 void addCube(const std::string &name, int link_num,
541 const std::vector<double> &pose,
542 const std::vector<double> &size,
543 const std::vector<double> &color, int type = 0);
544
545 /**
546 * @ingroup RenderInterface
547 * \chinese
548 * 添加/修改立方体(带尺寸范围)
549 *
550 * @param name 立方体名称
551 * @param pose 位置
552 * @param length_min 最小长度
553 * @param length_max 最大长度
554 * @param width_min 最小宽度
555 * @param width_max 最大宽度
556 * @param height_min 最小高度
557 * @param height_max 最大高度
558 * @param color 立方体颜色 {r, g, b, a}, 范围是 0.0~1.0
559 * @param type 立方体绘制类型 0 代表画 6 个平面,1 代表只画边框线
560 * \endchinese
561 * \english
562 * Add/modify cube with size ranges.
563 *
564 * @param name cube name
565 * @param pose position
566 * @param length_min
567 * @param length_max
568 * @param width_min
569 * @param width_max
570 * @param height_min
571 * @param height_max
572 * @param color cube color {r, g, b, a}, range 0.0~1.0
573 * @param type cube rendering type: 0 for 6 planes, 1 for wireframe
574 * \endenglish
575 */
576 void addCube(const std::string &name, const std::vector<double> &pose,
577 float length_min, float length_max, float width_min,
578 float width_max, float height_min, float height_max,
579 const std::vector<double> &color, int type = 0);
580
581 /**
582 * @ingroup RenderInterface
583 * \chinese
584 * @brief addCube 添加立方体
585 * @param name 立方体名称
586 * @param link_num 关节编号
587 * @param pose 位姿
588 * @param length_min 最小长度
589 * @param length_max 最大长度
590 * @param width_min 最小宽度
591 * @param width_max 最大宽度
592 * @param height_min 最小高度
593 * @param height_max 最大高度
594 * @param color 颜色
595 * @param type 类型
596 * \endchinese
597 * \english
598 * @brief addCube
599 * @param name
600 * @param link_num
601 * @param pose
602 * @param length_min
603 * @param length_max
604 * @param width_min
605 * @param width_max
606 * @param height_min
607 * @param height_max
608 * @param color
609 * @param type
610 * \endenglish
611 */
612 void addCube(const std::string &name, int link_num,
613 const std::vector<double> &pose, float length_min,
614 float length_max, float width_min, float width_max,
615 float height_min, float height_max,
616 const std::vector<double> &color, int type = 0);
617
618 /**
619 * @ingroup RenderInterface
620 * \chinese
621 * 移除指定立方体
622 *
623 * @param name 立方体名称
624 * \endchinese
625 * \english
626 * Remove the specified cube.
627 *
628 * @param name cube name
629 * \endenglish
630 */
631 void removeCube(const std::string &name);
632
633 /**
634 * @ingroup RenderInterface
635 * \chinese
636 * 移除所有的立方体
637 * \endchinese
638 * \english
639 * Remove all cubes.
640 * \endenglish
641 */
643
644 // 模型文件
645 /**
646 * @ingroup RenderInterface
647 * @brief addMesh 添加任意模型文件
648 * @param name: 唯一标识
649 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
650 * @param model_path: 3ds 文件绝对路径
651 * @param pose: 模型文件安装位置 {x, y, z, rx, ry, rz}
652 * @return 0: 成功; 其他失败
653 */
654 int addMesh(const std::string &name, int link_num,
655 const std::string &model_path, const std::vector<double> &pose);
656
657 /**
658 * @ingroup RenderInterface
659 * @brief getMeshes 获取关节 link_num 的外设模型名字
660 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
661 * @return 名字列表
662 */
663 std::vector<std::string> getMeshes(int link_num);
664
665 /**
666 * @ingroup RenderInterface
667 * @brief removeMesh
668 * @param name
669 * @return
670 */
671 int removeMesh(const std::string &name);
672
673 /**
674 * @ingroup RenderInterface
675 * @brief clearMeshes
676 * @param link_num
677 * @return
678 */
679 int clearMeshes(int link_num);
680
681private:
682 friend class DataSwitch;
684 void *d_{ nullptr };
685};
686
687} // namespace aubo_scope
688} // namespace arcs
689
690#endif // AUBO_CAPS_INTERFACE_RENDER_INTERFACE_H
#define ARCS_ABI_EXPORT
#define ARCS_CLASS_FORWARD(C)
Macro that forward declares a class and defines the respective smartpointers through ARCS_DECLARE_PTR...
\chinese 渲染接口 提供 3D 渲染相关的显示选项控制,包括地面、机器人模型、坐标系、轨迹和点等元素的 显示/隐藏。 \endchinese \english RenderInterface P...
int clearMeshes(int link_num)
clearMeshes
void addPlane(const std::string &name, const std::vector< double > &pose, const std::vector< double > &size, const std::vector< double > &color)
\chinese 添加/修改平面
void addCoordinate(const std::string &name, const std::vector< double > &pose)
\chinese 添加/修改坐标轴
void addCube(const std::string &name, const std::vector< double > &pose, const std::vector< double > &size, const std::vector< double > &color, int type=0)
\chinese 添加/修改立方体
void setMoveTrack(void *wp, const std::vector< std::vector< double > > &track, const std::vector< double > &color)
\chinese
bool hasPointCloud(const std::string &name)
\chinese 查找指定名称的点云是否存在
int removeMesh(const std::string &name)
removeMesh
void addCube(const std::string &name, int link_num, const std::vector< double > &pose, const std::vector< double > &size, const std::vector< double > &color, int type=0)
\chinese
void clearLines()
\chinese 移除所有的线 \endchinese \english Remove all lines.
void removePlane(const std::string &name)
\chinese 移除指定平面
RenderInterface(RenderInterface &&f)
bool hasWaypoint(void *wp)
\chinese 查找指定路点是否存在
void setBlendTrack(void *wp, const std::vector< std::vector< double > > &track, const std::vector< double > &color)
\chinese
void removeCoordinate(const std::string &name)
\chinese 移除指定坐标轴
void setMoveTrack(void *wp, const std::vector< std::vector< double > > &track)
\chinese 添加/修改指定路点的交融轨迹
void setRenderEmbeded(bool is_embeded, QGridLayout *gly)
\chinese 设置 Render 窗口嵌入/移除(isEmbeded) 布局 gly 中
RenderInterface(RenderInterface &f)
void removePointCloud(const std::string &name)
\chinese 移除指定名称的点云
void removeCube(const std::string &name)
\chinese 移除指定立方体
void addPointCloud(const std::string &name, const std::vector< std::vector< double > > &points, const std::vector< double > &color)
\chinese 添加/修改点云
void addLine(const std::string &name, const std::vector< std::vector< double > > &points, const std::vector< double > &color)
\chinese 添加/修改线
bool hasCoordinate(const std::string &name)
\chinese 查找指定坐标轴是否存在
void clearWaypoints()
\chinese 移除所有的路点 \endchinese \english Remove all waypoints.
void clearPointCloud()
\chinese 移除所有的点云 \endchinese \english Remove all point clouds.
void addPlane(const std::string &name, int link_num, const std::vector< double > &pose, const std::vector< double > &size, const std::vector< double > &color)
\chinese
void addCube(const std::string &name, int link_num, const std::vector< double > &pose, float length_min, float length_max, float width_min, float width_max, float height_min, float height_max, const std::vector< double > &color, int type=0)
\chinese
void removeLine(const std::string &name)
\chinese 移除指定线
void setShowOptions(uint16_t options)
\chinese 设置显示模式,控制各种元素的显隐
std::vector< std::string > getMeshes(int link_num)
getMeshes 获取关节 link_num 的外设模型名字
int addMesh(const std::string &name, int link_num, const std::string &model_path, const std::vector< double > &pose)
addMesh 添加任意模型文件
void removeWaypoint(void *wp)
\chinese 移除指定路点
void clearPlanes()
\chinese 移除所有的平面 \endchinese \english Remove all planes.
void clearCubes()
\chinese 移除所有的立方体 \endchinese \english Remove all cubes.
bool addWaypoint(void *wp, const std::vector< double > &pose, const std::vector< double > &color={ 0.0, 1.0, 0.0, 1.0 }, bool axis_visible=false)
\chinese 添加/修改路点
void addCube(const std::string &name, const std::vector< double > &pose, float length_min, float length_max, float width_min, float width_max, float height_min, float height_max, const std::vector< double > &color, int type=0)
\chinese 添加/修改立方体(带尺寸范围)
void addLine(const std::string &name, int link_num, const std::vector< double > &pose, const std::vector< std::vector< double > > &points, const std::vector< double > &color)
\chinese
void setBlendTrack(void *wp, const std::vector< std::vector< double > > &track)
\chinese