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 * @brief The RenderInterface class
17 */
18
20{
21public:
22 enum ShowOptions : uint16_t
23 {
24 None = 0,
25 Ground = 0x01,
27 RealRobot = 0x04,
28 Coordinate = 0x08,
29 Track = 0x10,
30 Point = 0x20,
31 View = 0x40,
32 Obstacle = 0x80,
33 SafetyPlane = 0x0100,
34 ToolPosition = 0x0200,
35 PointCloud = 0x0400,
36 All = 0xFFFF,
37 };
38
39public:
43
44 /**
45 * @ingroup RenderInterface
46 * 设置 Render 窗口嵌入/移除(isEmbeded) 布局 gly 中
47 *
48 * @param is_embeded 是否嵌入
49 * @param gly 布局
50 * @return 无
51 */
52 void setRenderEmbeded(bool is_embeded, QGridLayout *gly);
53
54 /**
55 * @ingroup RenderInterface
56 * 设置显示模式,控制各种元素的显隐
57 *
58 * @param options 选项值,详情查看 ShowOptions 枚举
59 * @return 无
60 */
61 void setShowOptions(uint16_t options);
62
63 /**
64 * @ingroup RenderInterface
65 * 添加/修改点云
66 *
67 * @param name 点云名称
68 * @param points 点集合
69 * @param color 点云颜色 rgba
70 * @return 无
71 */
72 void addPointCloud(const std::string &name,
73 const std::vector<std::vector<double>> &points,
74 const std::vector<double> &color);
75
76 /**
77 * @ingroup RenderInterface
78 * 移除指定名称的点云
79 *
80 * @param name 点云名称
81 * @return 无
82 */
83 void removePointCloud(const std::string &name);
84
85 /**
86 * @ingroup RenderInterface
87 * 查找制定名称的点云是否存在
88 *
89 * @param name 点云名称
90 * @retval true 存在
91 * @retval false 不存在
92 */
93 bool hasPointCloud(const std::string &name);
94
95 /**
96 * @ingroup RenderInterface
97 * 移除所有的点云
98 *
99 * @param 无
100 * @retval 无
101 */
103
104 /**
105 * @ingroup RenderInterface
106 * 添加/修改路点
107 *
108 * @param wp 代表路点的唯一对象
109 * @param pose 路点位姿 x,y,z,rx,ry,rz
110 * @param color 路点颜色 {r, g, b, a}, 范围是 0.0~1.0
111 * @param axis_visible 路点上是否显示位姿方向箭头
112 * @retval true 成功
113 * @retval false 失败
114 */
115 bool addWaypoint(void *wp, const std::vector<double> &pose,
116 const std::vector<double> &color = { 0.0, 1.0, 0.0, 1.0 },
117 bool axis_visible = false);
118
119 /**
120 * @ingroup RenderInterface
121 * 移除指定路点
122 *
123 * @param wp 代表路点的唯一对象
124 * @retval 无
125 */
126 void removeWaypoint(void *wp);
127
128 /**
129 * @ingroup RenderInterface
130 * 查找指定路点是否存在
131 *
132 * @param wp 代表路点的唯一对象
133 * @retval true 存在
134 * @retval false 不存在
135 */
136 bool hasWaypoint(void *wp);
137
138 /**
139 * @ingroup RenderInterface
140 * 移除所有的路点
141 *
142 * @param 无
143 * @retval 无
144 */
146
147 /**
148 * @ingroup RenderInterface
149 * 添加/修改指定路点的交融轨迹
150 *
151 * @param wp 代表路点的唯一对象
152 * @param track 路点位姿 x,y,z,rx,ry,rz 集合
153 * @retval 无
154 */
155 void setMoveTrack(void *wp, const std::vector<std::vector<double>> &track);
156
157 /**
158 * @ingroup RenderInterface
159 * @brief setBlendTrack
160 * @param wp
161 * @param track
162 */
163 void setBlendTrack(void *wp, const std::vector<std::vector<double>> &track);
164
165 /**
166 * @ingroup RenderInterface
167 * @brief setMoveTrack
168 * @param wp
169 * @param track
170 * @param color
171 */
172 void setMoveTrack(void *wp, const std::vector<std::vector<double>> &track,
173 const std::vector<double> &color);
174
175 /**
176 * @ingroup RenderInterface
177 * @brief setBlendTrack
178 * @param wp
179 * @param track
180 * @param color
181 */
182 void setBlendTrack(void *wp, const std::vector<std::vector<double>> &track,
183 const std::vector<double> &color);
184
185 /**
186 * @ingroup RenderInterface
187 * 添加/修改坐标轴
188 *
189 * @param name 坐标轴名称
190 * @param pose 位姿 x,y,z,rx,ry,rz
191 * @retval 无
192 */
193 void addCoordinate(const std::string &name,
194 const std::vector<double> &pose);
195
196 /**
197 * @ingroup RenderInterface
198 * 移除指定坐标轴
199 *
200 * @param name 坐标轴名称
201 * @retval 无
202 */
203 void removeCoordinate(const std::string &name);
204
205 /**
206 * @ingroup RenderInterface
207 * 查找指定坐标轴是否存在
208 *
209 * @param name 坐标轴名称
210 * @retval true 存在
211 * @retval false 不存在
212 */
213 bool hasCoordinate(const std::string &name);
214
215 /**
216 * @ingroup RenderInterface
217 * 添加/修改线
218 *
219 * @param name 线名称
220 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
221 * @param pose: 点的参考坐标系, 默认 6 个 0
222 * @param points 点集合
223 * @param color 线颜色 {r, g, b, a}, 范围是 0.0~1.0
224 * @retval 无
225 */
226 void addLine(const std::string &name,
227 const std::vector<std::vector<double>> &points,
228 const std::vector<double> &color);
229
230 /**
231 * @ingroup RenderInterface
232 * @brief addLine
233 * @param name
234 * @param link_num
235 * @param pose
236 * @param points
237 * @param color
238 */
239 void addLine(const std::string &name, int link_num,
240 const std::vector<double> &pose,
241 const std::vector<std::vector<double>> &points,
242 const std::vector<double> &color);
243
244 /**
245 * @ingroup RenderInterface
246 * 移除指定线
247 *
248 * @param name 线名称
249 * @retval 无
250 */
251 void removeLine(const std::string &name);
252
253 /**
254 * @ingroup RenderInterface
255 * 移除所有的线
256 *
257 * @param 无
258 * @retval 无
259 */
261
262 /**
263 * @ingroup RenderInterface
264 * 添加/修改平面
265 *
266 * @param name 平面名称
267 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
268 * @param pose 位置
269 * @param size 平面大小(长,宽)
270 * @param color 线颜色 {r, g, b, a}, 范围是 0.0~1.0
271 * @retval 无
272 */
273 void addPlane(const std::string &name, const std::vector<double> &pose,
274 const std::vector<double> &size,
275 const std::vector<double> &color);
276
277 /**
278 * @ingroup RenderInterface
279 * @brief addPlane
280 * @param name
281 * @param link_num
282 * @param pose
283 * @param size
284 * @param color
285 */
286 void addPlane(const std::string &name, int link_num,
287 const std::vector<double> &pose,
288 const std::vector<double> &size,
289 const std::vector<double> &color);
290
291 /**
292 * @ingroup RenderInterface
293 * 移除指定平面
294 *
295 * @param name 名称
296 * @retval 无
297 */
298 void removePlane(const std::string &name);
299
300 /**
301 * @ingroup RenderInterface
302 * 移除所有的平面
303 *
304 * @param 无
305 * @retval 无
306 */
308
309 /**
310 * @ingroup RenderInterface
311 * 添加/修改立方体
312 *
313 * @param name 立方体名称
314 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
315 * @param pose 位置
316 * @param size 立方体大小(长,宽,高)
317 * @param color 立方体颜色 {r, g, b, a}, 范围是 0.0~1.0
318 * @param type 立方体绘制类型 0 代表画 6 个平面,1 代表只画边框线
319 * @retval 无
320 */
321 void addCube(const std::string &name, const std::vector<double> &pose,
322 const std::vector<double> &size,
323 const std::vector<double> &color, int type = 0);
324 /**
325 * @ingroup RenderInterface
326 * @brief addCube
327 * @param name
328 * @param link_num
329 * @param pose
330 * @param size
331 * @param color
332 * @param type
333 */
334 void addCube(const std::string &name, int link_num,
335 const std::vector<double> &pose,
336 const std::vector<double> &size,
337 const std::vector<double> &color, int type = 0);
338
339 /**
340 * @ingroup RenderInterface
341 * 添加/修改立方体
342 *
343 * @param name 立方体名称
344 * @param pose 位置
345 * @param length_min
346 * @param length_max
347 * @param width_min
348 * @param width_max
349 * @param height_min
350 * @param height_max
351 * @param color 立方体颜色 {r, g, b, a}, 范围是 0.0~1.0
352 * @param type 立方体绘制类型 0 代表画 6 个平面,1 代表只画边框线
353 * @retval 无
354 */
355 void addCube(const std::string &name, const std::vector<double> &pose,
356 float length_min, float length_max, float width_min,
357 float width_max, float height_min, float height_max,
358 const std::vector<double> &color, int type = 0);
359
360 /**
361 * @ingroup RenderInterface
362 * @brief addCube
363 * @param name
364 * @param link_num
365 * @param pose
366 * @param length_min
367 * @param length_max
368 * @param width_min
369 * @param width_max
370 * @param height_min
371 * @param height_max
372 * @param color
373 * @param type
374 */
375 void addCube(const std::string &name, int link_num,
376 const std::vector<double> &pose, float length_min,
377 float length_max, float width_min, float width_max,
378 float height_min, float height_max,
379 const std::vector<double> &color, int type = 0);
380
381 /**
382 * @ingroup RenderInterface
383 * 移除指定立方体
384 *
385 * @param name 立方体名称
386 * @retval 无
387 */
388 void removeCube(const std::string &name);
389
390 /**
391 * @ingroup RenderInterface
392 * 移除所有的立方体
393 *
394 * @param 无
395 * @retval 无
396 */
398
399 // 模型文件
400 /**
401 * @ingroup RenderInterface
402 * @brief addMesh 添加任意模型文件
403 * @param name: 唯一标识
404 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
405 * @param model_path: 3ds 文件绝对路径
406 * @param pose: 模型文件安装位置 {x, y, z, rx, ry, rz}
407 * @return 0: 成功; 其他失败
408 */
409 int addMesh(const std::string &name, int link_num,
410 const std::string &model_path, const std::vector<double> &pose);
411
412 /**
413 * @ingroup RenderInterface
414 * @brief getMeshes 获取关节 link_num 的外设模型名字
415 * @param link_num: -1: TCP; 0: 底座; 1~6: 关节;
416 * @return 名字列表
417 */
418 std::vector<std::string> getMeshes(int link_num);
419
420 /**
421 * @ingroup RenderInterface
422 * @brief removeMesh
423 * @param name
424 * @return
425 */
426 int removeMesh(const std::string &name);
427
428 /**
429 * @ingroup RenderInterface
430 * @brief clearMeshes
431 * @param link_num
432 * @return
433 */
434 int clearMeshes(int link_num);
435
436private:
437 friend class DataSwitch;
439 void *d_{ nullptr };
440};
441
442} // namespace aubo_scope
443} // namespace arcs
444
445#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...
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)
添加/修改平面
void addCoordinate(const std::string &name, const std::vector< double > &pose)
添加/修改坐标轴
void addCube(const std::string &name, const std::vector< double > &pose, const std::vector< double > &size, const std::vector< double > &color, int type=0)
添加/修改立方体
void setMoveTrack(void *wp, const std::vector< std::vector< double > > &track, const std::vector< double > &color)
setMoveTrack
bool hasPointCloud(const std::string &name)
查找制定名称的点云是否存在
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)
addCube
void clearLines()
移除所有的线
void removePlane(const std::string &name)
移除指定平面
RenderInterface(RenderInterface &&f)
bool hasWaypoint(void *wp)
查找指定路点是否存在
void setBlendTrack(void *wp, const std::vector< std::vector< double > > &track, const std::vector< double > &color)
setBlendTrack
void removeCoordinate(const std::string &name)
移除指定坐标轴
void setMoveTrack(void *wp, const std::vector< std::vector< double > > &track)
添加/修改指定路点的交融轨迹
void setRenderEmbeded(bool is_embeded, QGridLayout *gly)
设置 Render 窗口嵌入/移除(isEmbeded) 布局 gly 中
RenderInterface(RenderInterface &f)
void removePointCloud(const std::string &name)
移除指定名称的点云
void removeCube(const std::string &name)
移除指定立方体
void addPointCloud(const std::string &name, const std::vector< std::vector< double > > &points, const std::vector< double > &color)
添加/修改点云
void addLine(const std::string &name, const std::vector< std::vector< double > > &points, const std::vector< double > &color)
添加/修改线
bool hasCoordinate(const std::string &name)
查找指定坐标轴是否存在
void clearWaypoints()
移除所有的路点
void clearPointCloud()
移除所有的点云
void addPlane(const std::string &name, int link_num, const std::vector< double > &pose, const std::vector< double > &size, const std::vector< double > &color)
addPlane
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)
addCube
void removeLine(const std::string &name)
移除指定线
void setShowOptions(uint16_t options)
设置显示模式,控制各种元素的显隐
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)
移除指定路点
void clearPlanes()
移除所有的平面
void clearCubes()
移除所有的立方体
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)
添加/修改路点
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)
添加/修改立方体
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)
addLine
void setBlendTrack(void *wp, const std::vector< std::vector< double > > &track)
setBlendTrack