PDF
AUBO SDK  0.26.0
math.h
浏览该文件的文档.
1/** @file math.h
2 * \~chinese @brief 数学方法接口,如欧拉角与四元数转换、位姿的加减运算
3 * \~english @brief Mathematic operation interface, such as euler to quaternion conversion, addition/subtraction of poses
4 */
5#ifndef AUBO_SDK_MATH_INTERFACE_H
6#define AUBO_SDK_MATH_INTERFACE_H
7
8#include <vector>
9#include <memory>
10
11#include <aubo/type_def.h>
12#include <aubo/global_config.h>
13
14namespace arcs {
15namespace common_interface {
16
17/**
18 * \chinese
19 * @defgroup Math Math (数学工具)
20 * 数学工具API接口
21 * \endchinese
22 *
23 * \english
24 * @defgroup Math Math
25 * Math API interface
26 * \endenglish
27 */
28class ARCS_ABI_EXPORT Math
29{
30public:
32 virtual ~Math();
33
34 /**
35 * @ingroup Math
36 * \english
37 * Pose addition
38 *
39 * Both arguments contain three position parameters (x, y, z) jointly called
40 * P, and three rotation parameters (R_x, R_y, R_z) jointly called R. This
41 * function calculates the result x_3 as the addition of the given poses as
42 * follows:
43 *
44 * p_3.P = p_1.P + p_2.P
45 *
46 * p_3.R = p_1.R * p_2.R
47 *
48 * @param p1 Tool pose 1
49 * @param p2 Tool pose 2
50 * @return sum of position parts and product of rotation parts (pose)
51 *
52 * @par Python interface prototype
53 * poseAdd(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
54 * List[float]
55 *
56 * @par Lua interface prototype
57 * poseAdd(p1: table, p2: table) -> table
58 *
59 * @par Lua example
60 * pose_add = poseAdd({0.2, 0.5, 0.1, 1.57, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
61 *
62 * @par JSON-RPC request example
63 * {"jsonrpc":"2.0","method":"Math.poseAdd","params":[[0.2, 0.5, 0.1, 1.57,
64 * 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
65 *
66 * @par JSON-RPC response example
67 * {"id":1,"jsonrpc":"2.0","result":[0.4,1.0,0.7,3.14,-0.0,0.0]}
68 * \endengish
69 *
70 * \chinese
71 * 位姿相加。
72 * 两个参数都包含三个位置参数(x、y、z),统称为P,
73 * 以及三个旋转参数(R_x、R_y、R_z),统称为R。
74 * 此函数根据以下方式计算结果 p_3,即给定位姿的相加:
75 * p_3.P = p_1.P + p_2.P,
76 * p_3.R = p_1.R * p_2.R
77 *
78 * @param p1 工具位姿1(pose)
79 * @param p2 工具位姿2(pose)
80 * @return 位置部分之和和旋转部分之积(pose)
81 *
82 * @par Python函数原型
83 * poseAdd(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
84 * List[float]
85 *
86 * @par Lua函数原型
87 * poseAdd(p1: table, p2: table) -> table
88 *
89 * @par Lua示例
90 * pose_add = poseAdd({0.2, 0.5, 0.1, 1.57, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
91 *
92 * @par JSON-RPC请求示例
93 * {"jsonrpc":"2.0","method":"Math.poseAdd","params":[[0.2, 0.5, 0.1, 1.57,
94 * 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
95 *
96 * @par JSON-RPC响应示例
97 * {"id":1,"jsonrpc":"2.0","result":[0.4,1.0,0.7,3.14,-0.0,0.0]}
98 * \endchinese
99 */
100 std::vector<double> poseAdd(const std::vector<double> &p1,
101 const std::vector<double> &p2);
102
103 /**
104 * @ingroup Math
105 * \chinese
106 * 位姿相减
107 *
108 * 两个参数都包含三个位置参数(x、y、z),统称为P,
109 * 以及三个旋转参数(R_x、R_y、R_z),统称为R。
110 * 此函数根据以下方式计算结果 p_3,即给定位姿的相加:
111 * p_3.P = p_1.P - p_2.P,
112 * p_3.R = p_1.R * p_2.R.inverse
113 *
114 * @param p1 工具位姿1
115 * @param p2 工具位姿2
116 * @return 位姿相减计算结果
117 *
118 * @par Python函数原型
119 * poseSub(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
120 * List[float]
121 *
122 * @par Lua函数原型
123 * poseSub(p1: table, p2: table) -> table
124 *
125 * @par Lua示例
126 * pose_sub = poseSub({0.2, 0.5, 0.1, 1.57, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
127 *
128 * @par JSON-RPC请求示例
129 * {"jsonrpc":"2.0","method":"Math.poseSub","params":[[0.2, 0.5, 0.1, 1.57,
130 * 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
131 *
132 * @par JSON-RPC响应示例
133 * {"id":1,"jsonrpc":"2.0","result":[0.0,0.0,-0.5,0.0,-0.0,0.0]}
134 * \endchinese
135 *
136 * \english
137 * Pose subtraction
138 *
139 * Both arguments contain three position parameters (x, y, z) jointly called
140 * P, and three rotation parameters (R_x, R_y, R_z) jointly called R. This
141 * function calculates the result x_3 as the addition of the given poses as
142 * follows:
143 *
144 * p_3.P = p_1.P - p_2.P,
145 *
146 * p_3.R = p_1.R * p_2.R.inverse
147 *
148 * @param p1 tool pose 1
149 * @param p2 tool pose 2
150 * @return difference between two poses
151 *
152 * @par Python interface prototype
153 * poseSub(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
154 * List[float]
155 *
156 * @par Lua interface prototype
157 * poseSub(p1: table, p2: table) -> table
158 *
159 * @par Lua example
160 * pose_sub = poseSub({0.2, 0.5, 0.1, 1.57, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
161 *
162 * @par JSON-RPC request example
163 * {"jsonrpc":"2.0","method":"Math.poseSub","params":[[0.2, 0.5, 0.1, 1.57,
164 * 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
165 *
166 * @par JSON-RPC response example
167 * {"id":1,"jsonrpc":"2.0","result":[0.0,0.0,-0.5,0.0,-0.0,0.0]}
168 * \endenglish
169 */
170 std::vector<double> poseSub(const std::vector<double> &p1,
171 const std::vector<double> &p2);
172
173 /**
174 * @ingroup Math
175 * \chinese
176 * 计算线性插值
177 *
178 * @param p1 起点的TCP位姿
179 * @param p2 终点的TCP位姿
180 * @param alpha 系数,
181 * 当0<alpha<1,返回p1和p2两点直线的之间靠近p1端且占总路径比例为alpha的点;
182 * 例如当alpha=0.3,返回的是靠近p1那端,总路径的百分之30的点;
183 * 当alpha>1,返回p2;
184 * 当alpha<0,返回p1;
185 * @return 插值计算结果
186 *
187 * @par Python函数原型
188 * interpolatePose(self: pyaubo_sdk.Math, arg0: List[float], arg1:
189 * List[float], arg2: float) -> List[float]
190 *
191 * @par Lua函数原型
192 * interpolatePose(p1: table, p2: table, alpha: number) -> table
193 *
194 * @par Lua示例
195 * pose_interpolate = interpolatePose({0.2, 0.2, 0.4, 0, 0, 0},{0.2, 0.2, 0.6, 0, 0, 0},0.5)
196 *
197 * @par JSON-RPC请求示例
198 * {"jsonrpc":"2.0","method":"Math.interpolatePose","params":[[0.2, 0.2,
199 * 0.4, 0, 0, 0],[0.2, 0.2, 0.6, 0, 0, 0],0.5],"id":1}
200 *
201 * @par JSON-RPC响应示例
202 * {"id":1,"jsonrpc":"2.0","result":[0.2,0.2,0.5,0.0,-0.0,0.0]}
203 * \endchinese
204 *
205 * \english
206 * Calculate linear interpolation
207 *
208 * @param p1 starting TCP pose
209 * @param p2 ending TCP pose
210 * @param alpha coefficient;
211 * When 0<alpha<1,return a point between p1 & p2 that is closer to p1, at alpha percentage of the path;
212 * For example when alpha=0.3,point returned is closer to p1,at 30% of the total distance;
213 * When alpha>1, return p2;
214 * When alpha<0,return p1;
215 * @return interpolation result
216 *
217 * @par Python interface prototype
218 * interpolatePose(self: pyaubo_sdk.Math, arg0: List[float], arg1:
219 * List[float], arg2: float) -> List[float]
220 *
221 * @par Lua interface prototype
222 * interpolatePose(p1: table, p2: table, alpha: number) -> table
223 *
224 * @par Lua example
225 * pose_interpolate = interpolatePose({0.2, 0.2, 0.4, 0, 0, 0},{0.2, 0.2, 0.6, 0, 0, 0},0.5)
226 *
227 * @par JSON-RPC request example
228 * {"jsonrpc":"2.0","method":"Math.interpolatePose","params":[[0.2, 0.2,
229 * 0.4, 0, 0, 0],[0.2, 0.2, 0.6, 0, 0, 0],0.5],"id":1}
230 *
231 * @par JSON-RPC response example
232 * {"id":1,"jsonrpc":"2.0","result":[0.2,0.2,0.5,0.0,-0.0,0.0]}
233 * \endenglish
234 *
235 */
236 std::vector<double> interpolatePose(const std::vector<double> &p1,
237 const std::vector<double> &p2,
238 double alpha);
239 /**
240 * @ingroup Math
241 * \chinese
242 * 位姿变换
243 *
244 * 第一个参数 p_from 用于转换第二个参数 p_from_to,并返回结果。
245 * 这意味着结果是从 p_from 的坐标系开始,
246 * 然后在该坐标系中移动 p_from_to后的位姿。
247 *
248 * 这个函数可以从两个不同的角度来看。
249 * 一种是函数将 p_from_to 根据 p_from 的参数进行转换,即平移和旋转。
250 * 另一种是函数被用于获取结果姿态,先对 p_from 进行移动,然后再对 p_from_to
251 * 进行移动。 如果将姿态视为转换矩阵,它看起来像是:
252 *
253 * T_world->to = T_world->from * T_from->to,
254 * T_x->to = T_x->from * T_from->to
255 *
256 * 这两个方程描述了姿态变换的基本原理,根据给定的起始姿态和相对于起始姿态的姿态变化,可以计算出目标姿态。
257 *
258 * 举个例子,已知B相对于A的位姿、C相对于B的位姿,求C相对于A的位姿。
259 * 第一个参数是B相对于A的位姿,第二个参数是C相对于B的位姿,
260 * 返回值是C相对于A的位姿。
261 *
262 * @param pose_from 起始位姿(空间向量)
263 * @param pose_from_to 相对于起始位姿的姿态变化(空间向量)
264 * @return 结果位姿 (空间向量)
265 *
266 * @par Python函数原型
267 * poseTrans(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
268 * List[float]
269 *
270 * @par Lua函数原型
271 * poseTrans(pose_from: table, pose_from_to: table) -> table
272 *
273 * @par Lua示例
274 * pose_trans = poseTrans({0.2, 0.5, 0.1, 1.57, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
275 *
276 * @par JSON-RPC请求示例
277 * {"jsonrpc":"2.0","method":"Math.poseTrans","params":[[0.2, 0.5,
278 * 0.1, 1.57, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
279 *
280 * @par JSON-RPC响应示例
281 * {"id":1,"jsonrpc":"2.0","result":[0.4,-0.09960164640373415,0.6004776374923573,3.14,-0.0,0.0]}
282 * \endchinese
283 *
284 * \english
285 * Pose transformation
286 *
287 * The first argument, p_from, is used to transform the second argument,
288 * p_from_to, and the result is then returned. This means that the result is
289 * the resulting pose, when starting at the coordinate system of p_from, and
290 * then in that coordinate system moving p_from_to.
291 *
292 * This function can be seen in two different views. Either the function
293 * transforms, that is translates and rotates, p_from_to by the parameters
294 * of p_from. Or the function is used to get the resulting pose, when first
295 * making a move of p_from and then from there, a move of p_from_to. If the
296 * poses were regarded as transformation matrices, it would look like:
297 *
298 * T_world->to = T_world->from * T_from->to,
299 * T_x->to = T_x->from * T_from->to
300 *
301 *
302 * These two equations describes the foundations for pose transformation.
303 * Based on a starting pose and the pose transformation relative to the starting pose, we can get the target pose.
304 *
305 * For example, we know pose of B relative to A, pose of C relative to B, find pose of C relative to A.
306 * param 1 is pose of B relative to A,param 2 is pose of C relative to B,
307 * the return value is the pose of C relative to A
308 *
309 * @param pose_from starting pose(vector in 3D space)
310 * @param pose_from_to pose transformation relative to starting pose(vector in 3D space)
311 * @return final pose (vector in 3D space)
312 *
313 * @par Python interface prototype
314 * poseTrans(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float]) ->
315 * List[float]
316 *
317 * @par Lua interface prototype
318 * poseTrans(pose_from: table, pose_from_to: table) -> table
319 *
320 * @par Lua example
321 * pose_trans = poseTrans({0.2, 0.5, 0.1, 1.57, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
322 *
323 * @par JSON-RPC request example
324 * {"jsonrpc":"2.0","method":"Math.poseTrans","params":[[0.2, 0.5,
325 * 0.1, 1.57, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
326 *
327 * @par JSON-RPC response example
328 * {"id":1,"jsonrpc":"2.0","result":[0.4,-0.09960164640373415,0.6004776374923573,3.14,-0.0,0.0]}
329 * \endenglish
330 */
331 std::vector<double> poseTrans(const std::vector<double> &pose_from,
332 const std::vector<double> &pose_from_to);
333
334 /**
335 * \english
336 * Pose inverse transformation
337 *
338 * Given pose of C relative to A, pose of C relative to B, find pose of B relative to A.
339 * param 1 is pose of C relative to A,param 2 is pose of C relative to B,
340 * the return value is the pose of B relative to A
341 *
342 * @param pose_from starting pose
343 * @param pose_to_from pose transformation relative to final pose
344 * @return resulting pose
345 *
346 * @par Python interface prototype
347 * poseTransInv(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
348 * -> List[float]
349 *
350 * @par Lua interface prototype
351 * poseTransInv(pose_from: table, pose_to_from: table) -> table
352 *
353 * @par Lua example
354 * pose_trans_inv = poseTransInv({0.4, -0.0996016, 0.600478, 3.14, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
355 *
356 * @par JSON-RPC request example
357 * {"jsonrpc":"2.0","method":"Math.poseTransInv","params":[[0.4, -0.0996016,
358 * 0.600478, 3.14, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
359 *
360 * @par JSON-RPC response example
361 * {"id":1,"jsonrpc":"2.0","result":[0.2,0.5000000464037341,0.10000036250764266,1.57,-0.0,0.0]}
362 * \endenglish
363 *
364 * @ingroup Math
365 * \chinese
366 * 姿态逆变换
367 *
368 * 已知C相对于A的位姿、C相对于B的位姿,求B相对于A的位姿。
369 * 第一个参数是C相对于A的位姿,第二个参数是C相对于B的位姿,
370 * 返回值是B相对于A的位姿。
371 *
372 * @param pose_from 起始位姿
373 * @param pose_to_from 相对于结果位姿的姿态变化
374 * @return 结果位姿
375 *
376 * @par Python函数原型
377 * poseTransInv(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
378 * -> List[float]
379 *
380 * @par Lua函数原型
381 * poseTransInv(pose_from: table, pose_to_from: table) -> table
382 *
383 * @par Lua示例
384 * pose_trans_inv = poseTransInv({0.4, -0.0996016, 0.600478, 3.14, 0, 0},{0.2, 0.5, 0.6, 1.57, 0, 0})
385 *
386 * @par JSON-RPC请求示例
387 * {"jsonrpc":"2.0","method":"Math.poseTransInv","params":[[0.4, -0.0996016,
388 * 0.600478, 3.14, 0, 0],[0.2, 0.5, 0.6, 1.57, 0, 0]],"id":1}
389 *
390 * @par JSON-RPC响应示例
391 * {"id":1,"jsonrpc":"2.0","result":[0.2,0.5000000464037341,0.10000036250764266,1.57,-0.0,0.0]}
392 * \endchinese
393 */
394 std::vector<double> poseTransInv(const std::vector<double> &pose_from,
395 const std::vector<double> &pose_to_from);
396
397 /**
398 * @ingroup Math
399 * \chinese
400 * 获取位姿的逆
401 *
402 * @param pose 工具位姿(空间向量)
403 * @return 工具位姿的逆转换(空间向量)
404 *
405 * @par Python函数原型
406 * poseInverse(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
407 *
408 * @par Lua函数原型
409 * poseInverse(pose: table) -> table
410 *
411 * @par Lua示例
412 * pose_inverse = poseInverse({0.2, 0.5, 0.1, 1.57, 0, 3.14})
413 *
414 * @par JSON-RPC请求示例
415 * {"jsonrpc":"2.0","method":"Math.poseInverse","params":[[0.2, 0.5,
416 * 0.1, 1.57, 0, 3.14]],"id":1}
417 *
418 * @par JSON-RPC响应示例
419 * {"id":1,"jsonrpc":"2.0","result":[0.19920341988726448,-0.09960155178838484,-0.5003973704832628,
420 * 1.5699999989900404,-0.0015926530848129354,-3.1415913853161266]}
421 *
422 * \endchinese
423 *
424 * \english
425 * Get the inverse of a pose
426 *
427 * @param pose tool pose (spatial vector)
428 * @return inverse tool pose transformation (spatial vector)
429 *
430 * @par Python interface prototype
431 * poseInverse(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
432 *
433 * @par Lua interface prototype
434 * poseInverse(pose: table) -> table
435 *
436 * @par Lua example
437 * pose_inverse = poseInverse({0.2, 0.5, 0.1, 1.57, 0, 3.14})
438 *
439 * @par JSON-RPC request example
440 * {"jsonrpc":"2.0","method":"Math.poseInverse","params":[[0.2, 0.5,
441 * 0.1, 1.57, 0, 3.14]],"id":1}
442 *
443 * @par JSON-RPC response example
444 * {"id":1,"jsonrpc":"2.0","result":[0.19920341988726448,-0.09960155178838484,-0.5003973704832628,
445 * 1.5699999989900404,-0.0015926530848129354,-3.1415913853161266]}
446 * \endenglish
447 *
448 */
449 std::vector<double> poseInverse(const std::vector<double> &pose);
450
451 /**
452 * @ingroup Math
453 * \chinese
454 * 计算两个位姿的位置距离
455 *
456 * @param p1 位姿1
457 * @param p2 位姿2
458 * @return 两个位姿的位置距离
459 *
460 * @par Lua函数原型
461 * poseDistance(p1: table, p2: table) -> number
462 *
463 * @par Lua示例
464 * pose_distance = poseDistance({0.1, 0.3, 0.1, 0.3142, 0.0, 1.571},{0.2, 0.5, 0.6, 0, -0.172, 0.0})
465 *
466 * @par JSON-RPC请求示例
467 * {"jsonrpc":"2.0","method":"Math.poseDistance","params":[[0.1, 0.3, 0.1,
468 * 0.3142, 0.0, 1.571],[0.2, 0.5, 0.6, 0, -0.172, 0.0]],"id":1}
469 *
470 * @par JSON-RPC响应示例
471 * {"id":1,"jsonrpc":"2.0","result":0.5477225575051661}
472 * \endchinese
473 *
474 * \english
475 * Calculate distance between two poses
476 *
477 * @param p1 pose 1
478 * @param p2 pose 2
479 * @return distance between the poses
480 *
481 * @par Lua function prototype
482 * poseDistance(p1: table, p2: table) -> number
483 *
484 * @par Lua example
485 * pose_distance = poseDistance({0.1, 0.3, 0.1, 0.3142, 0.0, 1.571},{0.2, 0.5, 0.6, 0, -0.172, 0.0})
486 *
487 * @par JSON-RPC request example
488 * {"jsonrpc":"2.0","method":"Math.poseDistance","params":[[0.1, 0.3, 0.1,
489 * 0.3142, 0.0, 1.571],[0.2, 0.5, 0.6, 0, -0.172, 0.0]],"id":1}
490 *
491 * @par JSON-RPC response example
492 * {"id":1,"jsonrpc":"2.0","result":0.5477225575051661}
493 * \endenglish
494 *
495 */
496 double poseDistance(const std::vector<double> &p1,
497 const std::vector<double> &p2);
498
499 /**
500 * @ingroup Math
501 * \chinese
502 * 计算两个位姿的轴角距离
503 *
504 * @param p1 位姿1
505 * @param p2 位姿2
506 * @return 轴角距离
507 *
508 * @par Lua函数原型
509 * poseAngleDistance(p1: table, p2: table) -> number
510 *
511 * @par Lua示例
512 * pose_angle_distance = poseAngleDistance({0.1, 0.3, 0.1, 0.3142, 0.0, 1.571},{0.2, 0.5, 0.6, 0, -0.172, 0.0})
513 *
514 * \endchinese
515 *
516 * \english
517 * Calculate axis-angle difference between two poses
518 *
519 * @param p1 pose 1
520 * @param p2 pose 2
521 * @return axis angle difference
522 *
523 * @par Lua函数原型
524 * poseAngleDistance(p1: table, p2: table) -> number
525 *
526 * @par Lua示例
527 * pose_angle_distance = poseAngleDistance({0.1, 0.3, 0.1, 0.3142, 0.0, 1.571},{0.2, 0.5, 0.6, 0, -0.172, 0.0})
528 *
529 * \endenglish
530 */
531 double poseAngleDistance(const std::vector<double> &p1,
532
533 const std::vector<double> &p2);
534
535 /**
536 * @ingroup Math
537 * \chinese
538 * 判断两个位姿是否相等
539 *
540 * @param p1 位姿1
541 * @param p2 位姿2
542 * @param eps 误差
543 * @return 相等返回true,反之返回false
544 *
545 * @par Lua函数原型
546 * poseEqual(p1: table, p2: table, eps: number) -> boolean
547 *
548 * @par Lua示例
549 * pose_equal = poseEqual({0.1, 0.3, 0.1, 0.3142, 0.0, 1.571},{0.1, 0.3, 0.1, 0.3142, 0.0, 1.5711},0.01)
550 *
551 * @par JSON-RPC请求示例
552 * {"jsonrpc":"2.0","method":"Math.poseEqual","params":[[0.1, 0.3, 0.1,
553 * 0.3142, 0.0, 1.571],[0.1, 0.3, 0.1, 0.3142, 0.0, 1.5711],0.01]],"id":1}
554 *
555 * @par JSON-RPC响应示例
556 * {"id":1,"jsonrpc":"2.0","result":0.0}
557 * \endchinese
558 *
559 * \english
560 * Determine if two poses are equivalent
561 *
562 * @param p1 pose 1
563 * @param p2 pose 2
564 * @param eps error margin
565 * @return true or false
566 *
567 * @par Lua函数原型
568 * poseEqual(p1: table, p2: table, eps: number) -> boolean
569 *
570 * @par Lua示例
571 * pose_equal = poseEqual({0.1, 0.3, 0.1, 0.3142, 0.0, 1.571},{0.1, 0.3, 0.1, 0.3142, 0.0, 1.5711},0.01)
572 *
573 * @par JSON-RPC request example
574 * {"jsonrpc":"2.0","method":"Math.poseEqual","params":[[0.1, 0.3, 0.1,
575 * 0.3142, 0.0, 1.571],[0.1, 0.3, 0.1, 0.3142, 0.0, 1.5711],0.01],"id":1}
576 *
577 * @par JSON-RPC response example
578 * {"id":1,"jsonrpc":"2.0","result":0.0}
579 * \endenglish
580 */
581 bool poseEqual(const std::vector<double> &p1, const std::vector<double> &p2,
582 double eps = 5e-5);
583
584 /**
585 * @ingroup Math
586 * \chinese
587 * @param F_b_a_old
588 * @param V_in_a
589 * @param type
590 * @return
591 *
592 * @par Python函数原型
593 * transferRefFrame(self: pyaubo_sdk.Math, arg0: List[float], arg1:
594 * List[float[3]], arg2: int) -> List[float]
595 *
596 * @par Lua函数原型
597 * transferRefFrame(F_b_a_old: table, V_in_a: table, type: number) -> table
598 * \endchinese
599 *
600 * \english
601 * @param F_b_a_old
602 * @param V_in_a
603 * @param type
604 * @return
605 *
606 * @par Python interface prototype
607 * transferRefFrame(self: pyaubo_sdk.Math, arg0: List[float], arg1:
608 * List[float[3]], arg2: int) -> List[float]
609 *
610 * @par Lua interface prototype
611 * transferRefFrame(F_b_a_old: table, V_in_a: table, type: number) -> table
612 * \endenglish
613 */
614 std::vector<double> transferRefFrame(const std::vector<double> &F_b_a_old,
615 const Vector3d &V_in_a, int type);
616
617 /**
618 * @ingroup Math
619 * \chinese
620 * 姿态旋转
621 *
622 * @param pose
623 * @param rotv
624 * @return
625 *
626 * @par Python函数原型
627 * poseRotation(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
628 * -> List[float]
629 *
630 * @par Lua函数原型
631 * poseRotation(pose: table, rotv: table) -> table
632 * \endchinese
633 *
634 * \english
635 * Pose rotation
636 *
637 * @param pose
638 * @param rotv
639 * @return
640 *
641 * @par Python interface prototype
642 * poseRotation(self: pyaubo_sdk.Math, arg0: List[float], arg1: List[float])
643 * -> List[float]
644 *
645 * @par Lua interface prototype
646 * poseRotation(pose: table, rotv: table) -> table
647 * \endenglish
648 */
649 std::vector<double> poseRotation(const std::vector<double> &pose,
650 const std::vector<double> &rotv);
651
652 /**
653 * @ingroup Math
654 * \chinese
655 * 欧拉角转四元数
656 *
657 * @param rpy 欧拉角
658 * @return 四元数
659 *
660 * @par Python函数原型
661 * rpyToQuaternion(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
662 *
663 * @par Lua函数原型
664 * rpyToQuaternion(rpy: table) -> table
665 *
666 * @par Lua示例
667 * quaternion = rpyToQuaternion({0.611, 0.785, 0.960})
668 *
669 * @par JSON-RPC请求示例
670 * {"jsonrpc":"2.0","method":"Math.rpyToQuaternion","params":[[0.611, 0.785,
671 * 0.960]],"id":1}
672 *
673 * @par JSON-RPC响应示例
674 * {"id":1,"jsonrpc":"2.0","result":[0.834721517970497,0.07804256900772265,0.4518931575790371,0.3048637712043723]}
675 * \endchinese
676 *
677 * \english
678 * Euler angles to quaternions
679 *
680 * @param rpy euler angles
681 * @return quaternions
682 *
683 * @par Python interface prototype
684 * rpyToQuaternion(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
685 *
686 * @par Lua interface prototype
687 * rpyToQuaternion(rpy: table) -> table
688 *
689 * @par Lua example
690 * quaternion = rpyToQuaternion({0.611, 0.785, 0.960})
691 *
692 * @par JSON-RPC request example
693 * {"jsonrpc":"2.0","method":"Math.rpyToQuaternion","params":[[0.611, 0.785,
694 * 0.960]],"id":1}
695 *
696 * @par JSON-RPC response example
697 * {"id":1,"jsonrpc":"2.0","result":[0.834721517970497,0.07804256900772265,0.4518931575790371,0.3048637712043723]}
698 * \endenglish
699 */
700 std::vector<double> rpyToQuaternion(const std::vector<double> &rpy);
701
702 /**
703 * @ingroup Math
704 * \chinese
705 * 四元数转欧拉角
706 *
707 * @param quat 四元数
708 * @return 欧拉角
709 *
710 * @par Python函数原型
711 * quaternionToRpy(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
712 *
713 * @par Lua函数原型
714 * quaternionToRpy(quat: table) -> table
715 *
716 * @par Lua示例
717 * rpy = quaternionToRpy({0.834722,0.0780426, 0.451893, 0.304864})
718 *
719 * @par JSON-RPC请求示例
720 * {"jsonrpc":"2.0","method":"Math.quaternionToRpy","params":[[0.834722,
721 * 0.0780426, 0.451893, 0.304864]],"id":1}
722 *
723 * @par JSON-RPC响应示例
724 * {"id":1,"jsonrpc":"2.0","result":[0.6110000520523781,0.7849996877683915,0.960000543982093]}
725 * \endchinese
726 *
727 * \english
728 * Quaternions to euler angles
729 *
730 * @param quat quaternions
731 * @return euler angles
732 *
733 * @par Python interface prototype
734 * quaternionToRpy(self: pyaubo_sdk.Math, arg0: List[float]) -> List[float]
735 *
736 * @par Lua interface prototype
737 * quaternionToRpy(quat: table) -> table
738 *
739 * @par Lua example
740 * rpy = quaternionToRpy({0.834722,0.0780426, 0.451893, 0.304864})
741 *
742 * @par JSON-RPC request example
743 * {"jsonrpc":"2.0","method":"Math.quaternionToRpy","params":[[0.834722,
744 * 0.0780426, 0.451893, 0.304864]],"id":1}
745 *
746 * @par JSON-RPC response example
747 * {"id":1,"jsonrpc":"2.0","result":[0.6110000520523781,0.7849996877683915,0.960000543982093]}
748 * \endenglish
749 */
750 std::vector<double> quaternionToRpy(const std::vector<double> &quat);
751
752 /**
753 * @ingroup Math
754 * \chinese
755 * 四点法标定TCP偏移
756 *
757 * 找一个尖点,将机械臂工具末端点绕着尖点示教四个位置,姿态差别要大。
758 * 设置完毕后即可计算出来结果。
759 *
760 * @param poses 四个点的位姿集合
761 * @return TCP标定结果和标定结果是否有效
762 *
763 * @par Python函数原型
764 * tcpOffsetIdentify(self: pyaubo_sdk.Math, arg0: List[List[float]]) ->
765 * Tuple[List[float], int]
766 *
767 * @par Lua函数原型
768 * tcpOffsetIdentify(poses: table) -> table
769 *
770 * @par Lua示例
771 * p1 = {0.48659,0.10456,0.24824,-3.135,0.004,1.569} \n
772 * p2 = {0.38610,0.09096,0.22432,2.552,-0.437,1.008} \n
773 * p3 = {0.38610,0.05349,0.16791,-3.021,-0.981,0.517} \n
774 * p4 = {0.49675,0.06417,0.21408,-2.438,0.458,0.651} \n
775 * p = {p1,p2,p3,p4} \n
776 * tcp_result = tcpOffsetIdentify(p)
777 *
778 * \endchinese
779 *
780 * \english
781 * Four point method calibration for TCP offset
782 *
783 * About a sharp point, move the robot's tcp in four different poses. Difference between each pose should be drastic.
784 * Result can be obtained based on these four poses
785 *
786 * @param poses combination of four different poses
787 * @return TCP calibration result and whether successfull
788 *
789 * @par Python interface prototype
790 * tcpOffsetIdentify(self: pyaubo_sdk.Math, arg0: List[List[float]]) ->
791 * Tuple[List[float], int]
792 *
793 * @par Lua interface prototype
794 * tcpOffsetIdentify(poses: table) -> table
795 *
796 * @par Lua example
797 * p1 = {0.48659,0.10456,0.24824,-3.135,0.004,1.569} \n
798 * p2 = {0.38610,0.09096,0.22432,2.552,-0.437,1.008} \n
799 * p3 = {0.38610,0.05349,0.16791,-3.021,-0.981,0.517} \n
800 * p4 = {0.49675,0.06417,0.21408,-2.438,0.458,0.651} \n
801 * p = {p1,p2,p3,p4} \n
802 * tcp_result = tcpOffsetIdentify(p)
803 *
804 * \endenglish
805 */
807 const std::vector<std::vector<double>> &poses);
808
809 /**
810 * @ingroup Math
811 * \chinese
812 * 三点法标定坐标系
813 *
814 * @param poses 三个点的位姿集合
815 * @param type 类型:\n
816 * 0 - oxy 原点 x轴正方向 xy平面(y轴正方向)\n
817 * 1 - oxz 原点 x轴正方向 xz平面(z轴正方向)\n
818 * 2 - oyz 原点 y轴正方向 yz平面(z轴正方向)\n
819 * 3 - oyx 原点 y轴正方向 yx平面(x轴正方向)\n
820 * 4 - ozx 原点 z轴正方向 zx平面(x轴正方向)\n
821 * 5 - ozy 原点 z轴正方向 zy平面(y轴正方向)\n
822 * @return 坐标系标定结果和标定结果是否有效
823 *
824 * @par Lua函数原型
825 * calibrateCoordinate(poses: table, type: int) -> table, number
826 *
827 * @par Lua示例
828 * p1 = {0.55462,0.06219,0.37175,-3.142,0.0,1.580} \n
829 * p2 = {0.63746,0.11805,0.37175,-3.142,0.0,1.580} \n
830 * p3 = {0.40441,0.28489,0.37174,-3.142,0.0,1.580} \n
831 * p = {p1,p2,p3} \n
832 * coord_pose, cal_result = calibrateCoordinate(p,0)
833 *
834 * @par JSON-RPC请求示例
835 * {"jsonrpc":"2.0","method":"Math.calibrateCoordinate","params":[[[0.55462,0.06219,0.37175,-3.142,0.0,1.580],
836 * [0.63746,0.11805,0.37175,-3.142,0.0,1.580],[0.40441,0.28489,0.37174,-3.142,0.0,1.580]],0],"id":1}
837 *
838 * @par JSON-RPC响应示例
839 * {"id":1,"jsonrpc":"2.0","result":[[0.55462,0.06219,0.37175,-3.722688983883945e-05,-1.6940658945086007e-21,0.5932768162455785],0]}
840 * \endchinese
841 *
842 * \english
843 * Calibrate coordinate system with 3 points
844 *
845 * @param poses set of 3 poses
846 * @param type type:\n
847 * 0 - oxy origin, +x axis, xy plane (+y direction) \n
848 * 1 - oxz origin, +x axis, xz plane (+z direction) \n
849 * 2 - oyz origin, +y axis, yz plane (+z direction) \n
850 * 3 - oyx origin, +y axis, yx plane (+x direction) \n
851 * 4 - ozx origin, +z axis, zx plane (+x direction) \n
852 * 5 - ozy origin, +z axis, zy plane (+y direction) \n
853 * @return Coordinate system calibration result and whether the calibration result is valid
854 *
855 * @par Lua function prototype
856 * calibrateCoordinate(poses: table, type: int) -> table, number
857 *
858 * @par Lua example
859 * p1 = {0.55462,0.06219,0.37175,-3.142,0.0,1.580} \n
860 * p2 = {0.63746,0.11805,0.37175,-3.142,0.0,1.580} \n
861 * p3 = {0.40441,0.28489,0.37174,-3.142,0.0,1.580} \n
862 * p = {p1,p2,p3} \n
863 * coord_pose, cal_result = calibrateCoordinate(p,0)
864 *
865 * @par JSON-RPC request example
866 * {"jsonrpc":"2.0","method":"Math.calibrateCoordinate","params":[[[0.55462,0.06219,0.37175,-3.142,0.0,1.580],
867 * [0.63746,0.11805,0.37175,-3.142,0.0,1.580],[0.40441,0.28489,0.37174,-3.142,0.0,1.580]],0],"id":1}
868 *
869 * @par JSON-RPC response example
870 * {"id":1,"jsonrpc":"2.0","result":[[0.55462,0.06219,0.37175,-3.722688983883945e-05,-1.6940658945086007e-21,0.5932768162455785],0]}
871 * \endenglish
872 */
874 const std::vector<std::vector<double>> &poses, int type);
875
876 /**
877 * @ingroup Math
878 * \chinese
879 * 根据圆弧的三个点,计算出拟合成的圆的另一半圆弧的中间点位置
880 *
881 * @param p1 圆弧的起始点
882 * @param p2 圆弧的中间点
883 * @param p3 圆弧的结束点
884 * @param mode 当mode等于1的时候,表示需要对姿态进行圆弧规划;
885 * 当mode等于0的时候,表示不需要对姿态进行圆弧规划
886 *
887 * @return 拟合成的圆的另一半圆弧的中间点位置和计算结果是否有效
888 *
889 * @par Lua函数原型
890 * calculateCircleFourthPoint(p1: table, p2: table, p3: table, mode: int)
891 *
892 * @par Lua示例
893 * center_pose, cal_result = calculateCircleFourthPoint({0.5488696249770836,-0.1214996547187204,0.2631931199112321,-3.14159198038469,-3.673205103150083e-06,1.570796326792424},
894 * {0.5488696249770835,-0.1214996547187207,0.3599720701808493,-3.14159198038469,-3.6732051029273e-06,1.570796326792423},
895 * {0.5488696249770836,-0.0389996547187214,0.3599720701808496,-3.141591980384691,-3.673205102557476e-06,1.570796326792422},1)
896 *
897 * @par JSON-RPC请求示例
898 * {"jsonrpc":"2.0","method":"Math.calculateCircleFourthPoint","params":[[0.5488696249770836,-0.1214996547187204,0.2631931199112321,-3.14159198038469,-3.673205103150083e-06,1.570796326792424],
899 * [0.5488696249770835,-0.1214996547187207,0.3599720701808493,-3.14159198038469,-3.6732051029273e-06,1.570796326792423],
900 * [0.5488696249770836,-0.0389996547187214,0.3599720701808496,-3.141591980384691,-3.673205102557476e-06,
901 * 1.570796326792422],1],"id":1}
902 *
903 * @par JSON-RPC响应示例
904 * {"id":1,"jsonrpc":"2.0","result":[[0.5488696249770837,-0.031860179583911546,0.27033259504604207,-3.1415919803846903,-3.67320510285378e-06,1.570796326792423],1]}
905 *
906 * \endchinese
907 *
908 * \english
909 * Based on three points on an arc, calculate the position of the midpoint of the other half of the fitted circle's arc
910 *
911 * @param p1 start point of the arc
912 * @param p2 middle point of the arc
913 * @param p3 end point of the arc
914 * @param mode when mode = 1, need to plan for orientation around arc;
915 * when mode = 0, do not need to plan for orientation around arc.
916 * @return position of the midpoint of the other half of the fitted circle's arc and whether the result is valid.
917 *
918 *
919 * @par Lua函数原型
920 * calculateCircleFourthPoint(p1: table, p2: table, p3: table, mode: int)
921 *
922 * @par Lua示例
923 * center_pose, cal_result = calculateCircleFourthPoint({0.5488696249770836,-0.1214996547187204,0.2631931199112321,-3.14159198038469,-3.673205103150083e-06,1.570796326792424},
924 * {0.5488696249770835,-0.1214996547187207,0.3599720701808493,-3.14159198038469,-3.6732051029273e-06,1.570796326792423},
925 * {0.5488696249770836,-0.0389996547187214,0.3599720701808496,-3.141591980384691,-3.673205102557476e-06,1.570796326792422},1)
926 *
927 * @par JSON-RPC request example
928 * {"jsonrpc":"2.0","method":"Math.calculateCircleFourthPoint","params":[[0.5488696249770836,-0.1214996547187204,0.2631931199112321,-3.14159198038469,-3.673205103150083e-06,1.570796326792424],
929 * [0.5488696249770835,-0.1214996547187207,0.3599720701808493,-3.14159198038469,-3.6732051029273e-06,1.570796326792423],
930 * [0.5488696249770836,-0.0389996547187214,0.3599720701808496,-3.141591980384691,-3.673205102557476e-06,
931 * 1.570796326792422],1],"id":1}
932 *
933 * @par JSON-RPC response example
934 * {"id":1,"jsonrpc":"2.0","result":[[0.5488696249770837,-0.031860179583911546,0.27033259504604207,-3.1415919803846903,-3.67320510285378e-06,1.570796326792423],1]}
935 *
936 * \endenglish
937 */
938 ResultWithErrno calculateCircleFourthPoint(const std::vector<double> &p1,
939 const std::vector<double> &p2,
940 const std::vector<double> &p3,
941 int mode);
942 /**
943 * @ingroup Math
944 * \chinese
945 * @brief forceTrans:
946 * 变换力和力矩的参考坐标系 force_in_b = pose_a_in_b * force_in_a
947 * @param pose_a_in_b: a 坐标系在 b 坐标系的位姿
948 * @param force_in_a: 力和力矩在 a 坐标系的描述
949 * @return force_in_b,力和力矩在 b 坐标系的描述
950 * \endchinese
951 *
952 * \english
953 * @brief forceTrans:
954 * Transform the reference frame of force and torque: force_in_b = pose_a_in_b * force_in_a
955 * @param pose_a_in_b: pose of frame a in frame b
956 * @param force_in_a: force and torque described in frame a
957 * @return Force_in_b, force and torque described in frame b
958 * \endenglish
959 */
960 std::vector<double> forceTrans(const std::vector<double> &pose_a_in_b,
961 const std::vector<double> &force_in_a);
962
963 /**
964 * @ingroup Math
965 * \chinese
966 * @brief 通过距离计算工具坐标系下的位姿增量
967 * @param distances: N 个距离, N >=3
968 * @param position: 距离参考轨迹的保持高度
969 * @param radius: 传感器中心距离末端tcp的等效半径
970 * @param track_scale: 跟踪比例, 设置范围(0, 1], 1表示跟踪更快
971 * @return 基于工具坐标系的位姿增量
972 * \endchinese
973 *
974 * \english
975 * @brief Calculate pose increment in tool coordinate system based on sensor data
976 * @param distances: N distances, N >= 3
977 * @param position: reference height to maintain from the trajectory
978 * @param radius: effective radius from sensor center to tool TCP
979 * @param track_scale: tracking ratio, range (0, 1], 1 means faster tracking
980 * @return Pose increment in tool coordinate system
981 * \endenglish
982 */
983 std::vector<double> getDeltaPoseBySensorDistance(
984 const std::vector<double> &distances, double position, double radius,
985 double track_scale);
986
987 /**
988 * @ingroup Math
989 * \chinese
990 * @brief changeFTFrame: 变换力和力矩的参考坐标系
991 * @param pose_a_in_b: a 坐标系在 b 坐标系的位姿
992 * @param ft_in_a: 作用在 a 点的力和力矩在 a 坐标系的描述
993 * @return ft_in_b,作用在 b 点的力和力矩在 b 坐标系的描述
994 * \endchinese
995 *
996 * \english
997 * @brief changeFTFrame: Transform the reference frame of force and torque
998 * @param pose_a_in_b: pose of frame a in frame b
999 * @param ft_in_a: force and torque applied at point a, described in frame a
1000 * @return ft_in_b, force and torque applied at point b, described in frame b
1001 * \endenglish
1002 */
1003 std::vector<double> deltaPoseTrans(const std::vector<double> &pose_a_in_b,
1004 const std::vector<double> &ft_in_a);
1005
1006 /**
1007 * @ingroup Math
1008 * \chinese
1009 * @brief addDeltaPose: 计算以给定速度变换单位时间后的位姿
1010 * @param pose_a_in_b: 当前时刻 a 相对于 b 的位姿
1011 * @param v_in_b: 当前时刻 a 坐标系的速度在 b 的描述
1012 * @return pose_in_b, 单位时间后的位姿在 b 的描述
1013 * \endchinese
1014 *
1015 * \english
1016 * @brief addDeltaPose: Calculate the pose after unit time given a velocity
1017 * @param pose_a_in_b: current pose of a relative to b
1018 * @param v_in_b: velocity of frame a described in frame b at current time
1019 * @return pose_in_b, pose after unit time described in frame b
1020 * \endenglish
1021 */
1022 std::vector<double> deltaPoseAdd(const std::vector<double> &pose_a_in_b,
1023 const std::vector<double> &v_in_b);
1024
1025 /**
1026 * @ingroup Math
1027 * \chinese
1028 * @brief changePoseWithXYRef: 修改 pose_tar 的xy轴方向,尽量与 pose_ref 一致,
1029 * @param pose_tar: 需要修改的目标位姿
1030 * @param pose_ref: 参考位姿
1031 * @return 修改后的位姿,采用pose_tar的 xyz 坐标和 z 轴方向
1032 * \endchinese
1033 *
1034 * \english
1035 * @brief changePoseWithXYRef: Modify the XY axis direction of pose_tar to be as consistent as possible with pose_ref
1036 * @param pose_tar: target pose to be modified
1037 * @param pose_ref: reference pose
1038 * @return Modified pose, using the xyz coordinates and z axis direction of pose_tar
1039 * \endenglish
1040 */
1041 std::vector<double> changePoseWithXYRef(
1042 const std::vector<double> &pose_tar,
1043 const std::vector<double> &pose_ref);
1044
1045 /**
1046 * @ingroup Math
1047 * \chinese
1048 * @brief homMatrixToPose: 由齐次变换矩阵得到位姿
1049 * @param homMatrix: 4*4 齐次变换矩阵, 输入元素采用横向排列
1050 * @return 对应的位姿
1051 * \endchinese
1052 *
1053 * \english
1054 * @brief homMatrixToPose: Get pose from homogeneous transformation matrix
1055 * @param homMatrix: 4x4 homogeneous transformation matrix, input elements are arranged row-wise
1056 * @return corresponding pose
1057 * \endenglish
1058 */
1059 std::vector<double> homMatrixToPose(const std::vector<double> &homMatrix);
1060
1061 /**
1062 * @ingroup Math
1063 * \chinese
1064 * @brief poseToHomMatrix: 位姿变换得到齐次变换矩阵
1065 * @param pose: 输入的位姿
1066 * @return 输出的齐次变换矩阵,元素横向排列
1067 * \endchinese
1068 *
1069 * \english
1070 * @brief poseToHomMatrix: Get homogeneous transformation matrix from pose
1071 * @param pose: input pose
1072 * @return output homogeneous transformation matrix, elements arranged row-wise
1073 * \endenglish
1074 */
1075 std::vector<double> poseToHomMatrix(const std::vector<double> &pose);
1076
1077protected:
1078 void *d_;
1079};
1080using MathPtr = std::shared_ptr<Math>;
1081
1082} // namespace common_interface
1083} // namespace arcs
1084#endif
std::vector< double > transferRefFrame(const std::vector< double > &F_b_a_old, const Vector3d &V_in_a, int type)
double poseDistance(const std::vector< double > &p1, const std::vector< double > &p2)
计算两个位姿的位置距离
std::vector< double > poseTrans(const std::vector< double > &pose_from, const std::vector< double > &pose_from_to)
位姿变换
std::vector< double > forceTrans(const std::vector< double > &pose_a_in_b, const std::vector< double > &force_in_a)
std::vector< double > poseToHomMatrix(const std::vector< double > &pose)
std::vector< double > poseRotation(const std::vector< double > &pose, const std::vector< double > &rotv)
姿态旋转
ResultWithErrno calculateCircleFourthPoint(const std::vector< double > &p1, const std::vector< double > &p2, const std::vector< double > &p3, int mode)
根据圆弧的三个点,计算出拟合成的圆的另一半圆弧的中间点位置
std::vector< double > changePoseWithXYRef(const std::vector< double > &pose_tar, const std::vector< double > &pose_ref)
std::vector< double > poseAdd(const std::vector< double > &p1, const std::vector< double > &p2)
double poseAngleDistance(const std::vector< double > &p1, const std::vector< double > &p2)
计算两个位姿的轴角距离
std::vector< double > getDeltaPoseBySensorDistance(const std::vector< double > &distances, double position, double radius, double track_scale)
ResultWithErrno calibrateCoordinate(const std::vector< std::vector< double > > &poses, int type)
三点法标定坐标系
std::vector< double > poseSub(const std::vector< double > &p1, const std::vector< double > &p2)
位姿相减
bool poseEqual(const std::vector< double > &p1, const std::vector< double > &p2, double eps=5e-5)
判断两个位姿是否相等
ResultWithErrno tcpOffsetIdentify(const std::vector< std::vector< double > > &poses)
四点法标定TCP偏移
std::vector< double > quaternionToRpy(const std::vector< double > &quat)
四元数转欧拉角
std::vector< double > rpyToQuaternion(const std::vector< double > &rpy)
欧拉角转四元数
std::vector< double > homMatrixToPose(const std::vector< double > &homMatrix)
std::vector< double > poseTransInv(const std::vector< double > &pose_from, const std::vector< double > &pose_to_from)
姿态逆变换
std::vector< double > poseInverse(const std::vector< double > &pose)
获取位姿的逆
std::vector< double > interpolatePose(const std::vector< double > &p1, const std::vector< double > &p2, double alpha)
计算线性插值
std::vector< double > deltaPoseTrans(const std::vector< double > &pose_a_in_b, const std::vector< double > &ft_in_a)
std::vector< double > deltaPoseAdd(const std::vector< double > &pose_a_in_b, const std::vector< double > &v_in_b)
std::shared_ptr< Math > MathPtr
std::array< double, 3 > Vector3d
std::tuple< std::vector< double >, int > ResultWithErrno
数据类型的定义