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