4#ifndef AUBO_SDK_MATH_INTERFACE_H
5#define AUBO_SDK_MATH_INTERFACE_H
11#include <aubo/global_config.h>
14namespace common_interface {
60 std::vector<double>
poseAdd(
const std::vector<double> &p1,
61 const std::vector<double> &p2);
92 std::vector<double>
poseSub(
const std::vector<double> &p1,
93 const std::vector<double> &p2);
123 const std::vector<double> &p2,
181 std::vector<double>
poseTrans(
const std::vector<double> &pose_from,
182 const std::vector<double> &pose_from_to);
211 const std::vector<double> &pose_to_from);
256 const std::vector<double> &p2);
267 const std::vector<double> &p2);
285 bool poseEqual(
const std::vector<double> &p1,
const std::vector<double> &p2,
322 const std::vector<double> &rotv);
386 const std::vector<std::vector<double>> &poses);
410 const std::vector<std::vector<double>> &poses,
int type);
433 const std::vector<double> &p2,
434 const std::vector<double> &p3,
443 std::vector<double>
forceTrans(
const std::vector<double> &pose_a_in_b,
444 const std::vector<double> &force_in_a);
455 const std::vector<double> &distances,
double position,
double radius,
465 const std::vector<double> &ft_in_a);
473 std::vector<double>
deltaPoseAdd(
const std::vector<double> &pose_a_in_b,
474 const std::vector<double> &v_in_b);
484 const std::vector<double> &pose_tar,
485 const std::vector<double> &pose_ref);
507#define Math_DECLARES \
508 _FUNC(Math, 2, poseAdd, p1, p2) \
509 _FUNC(Math, 2, poseSub, p1, p2) \
510 _FUNC(Math, 3, interpolatePose, p1, p2, alpha) \
511 _FUNC(Math, 2, poseTrans, pose_from, pose_from_to) \
512 _FUNC(Math, 2, poseTransInv, pose_from, pose_to_from) \
513 _FUNC(Math, 1, poseInverse, pose) \
514 _FUNC(Math, 2, poseDistance, p1, p2) \
515 _FUNC(Math, 2, poseAngleDistance, p1, p2) \
516 _FUNC(Math, 3, poseEqual, p1, p2, eps) \
517 _FUNC(Math, 3, transferRefFrame, F_b_a_old, V_in_a, type) \
518 _FUNC(Math, 2, poseRotation, pose, rotv) \
519 _FUNC(Math, 1, rpyToQuaternion, rpy) \
520 _FUNC(Math, 1, quaternionToRpy, quant) \
521 _FUNC(Math, 1, tcpOffsetIdentify, poses) \
522 _FUNC(Math, 2, calibrateCoordinate, poses, type) \
523 _FUNC(Math, 4, calculateCircleFourthPoint, p1, p2, p3, mode) \
524 _FUNC(Math, 2, forceTrans, pose_a_in_b, force_in_a) \
525 _FUNC(Math, 4, getDeltaPoseBySensorDistance, distances, position, radius, track_scale) \
526 _FUNC(Math, 2, deltaPoseTrans, pose_a_in_b, ft_in_a) \
527 _FUNC(Math, 2, deltaPoseAdd, pose_a_in_b, v_in_b)
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)
Pose transformation
std::vector< double > forceTrans(const std::vector< double > &pose_a_in_b, const std::vector< double > &force_in_a)
forceTrans: 变换力和力矩的参考坐标系 force_in_b = pose_a_in_b * force_in_a
std::vector< double > poseToHomMatrix(const std::vector< double > &pose)
poseToHomMatrix: 位姿变换得到齐次变换矩阵
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)
changePoseWithXYRef: 修改 pose_tar 的xy轴方向,尽量与 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)
计算两个位姿的轴角距离
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)
Pose subtraction 位姿相减
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)
homMatrixToPose: 由齐次变换矩阵得到位姿
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)
Get the inverse of a 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)
changeFTFrame: 变换力和力矩的参考坐标系
std::vector< double > deltaPoseAdd(const std::vector< double > &pose_a_in_b, const std::vector< double > &v_in_b)
addDeltaPose: 计算以给定速度变换单位时间后的位姿
std::array< double, 3 > Vector3d
std::shared_ptr< Math > MathPtr
std::tuple< std::vector< double >, int > ResultWithErrno