10 Eigen::Displacementd delta = H.inverse()*Hdes;
11 ret.tail<3>() = delta.getTranslation();
12 ret.head<3>() = delta.getRotation().log();
13 ret.array() *= kp.array();
19 Eigen::Twistd deltav = Tdes-T;
20 return kv.asDiagonal() * deltav.get();
24 const Vector6d& kv,
const Eigen::Twistd& Tdes,
const Eigen::Twistd& T)
34 k = inertiaMatrix.diagonal().tail(model.
nbInternalDofs()).asDiagonal() * K;
40 Eigen::Displacementd
compute_H_2_in_1(
const Eigen::Displacementd& H_1_in_ref,
const Eigen::Displacementd& H_2_in_ref)
42 return H_1_in_ref.inverse() * H_2_in_ref;
51 R.col(2) = Vector3d::UnitZ();
52 R.col(1) = R.col(2).cross(R.col(0));
53 return Eigen::Displacementd(model.
getCoMPosition(), Quaterniond(R));
56 Eigen::Displacementd
interpolate(
const Eigen::Displacementd& Hstart,
const Eigen::Displacementd& Hend,
double t)
58 SE3CubicInterpolator<double>::StdVectorDisplacement displ;
59 SE3CubicInterpolator<double>::StdVectorTwist twist;
60 std::vector<double> times;
61 SE3CubicInterpolator<double> spline;
63 displ.push_back(Hstart);
64 displ.push_back(Hend);
65 Eigen::Twistd td(0,0,0,0,0,0);
70 spline.setControlPoint(displ, twist, times);
72 Eigen::Displacementd H;
75 spline.Interpolate(H, T, t);
79 Eigen::Displacementd
projectRotation(
const Eigen::Displacementd& H,
const Vector3d& n,
double& theta)
81 Eigen::Displacementd result = H;
83 const Matrix3d& R = H.getRotation().adjoint();
85 double tr1 = (R(2,1)-R(1,2))*n[0] + (R(0,2)-R(2,0))*n[1] + (R(1,0)-R(0,1))*n[2];
87 double tr2 = n[0] * (R(0,0)*n[0]+R(1,0)*n[1]+R(2,0)*n[2])
88 + n[1] * (R(0,1)*n[0]+R(1,1)*n[1]+R(2,1)*n[2])
89 + n[2] * (R(0,2)*n[0]+R(1,2)*n[1]+R(2,2)*n[2])
90 - R(0,0) - R(1,1) - R(2,2);
92 double alpha = atan2(tr1, tr2);
94 double s = sin(theta);
95 double c = cos(theta);
98 Rp(0,0) = + ic*n[0]*n[0] + c;
99 Rp(0,1) = -s*n[2] + ic*n[0]*n[1];
100 Rp(0,2) = s*n[1] + ic*n[0]*n[2];
101 Rp(1,0) = s*n[2] + ic*n[1]*n[0];
102 Rp(1,1) = + ic*n[1]*n[1] + c;
103 Rp(1,2) = -s*n[0] + ic*n[1]*n[2];
104 Rp(2,0) = -s*n[1] + ic*n[2]*n[0];
105 Rp(2,1) = s*n[0] + ic*n[2]*n[1];
106 Rp(2,2) = + ic*n[2]*n[2] + c;
108 result.getRotation() = Eigen::Displacementd::Rotation3D(Quaterniond(Rp));
Eigen::Displacementd compute_H_2_in_1(const Eigen::Displacementd &H_1_in_ref, const Eigen::Displacementd &H_2_in_ref)
int nbInternalDofs() const
virtual const Eigen::Displacementd & getFreeFlyerPosition() const =0
Eigen::Displacementd interpolate(const Eigen::Displacementd &Hstart, const Eigen::Displacementd &Hend, double t)
Eigen::Matrix< double, 6, 1 > cartesianPCoupling(const Eigen::Matrix< double, 6, 1 > &kp, const Eigen::Displacementd &Hdes, const Eigen::Displacementd &H)
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
virtual const Eigen::Vector3d & getCoMPosition() const =0
Eigen::Matrix< double, 6, 1 > cartesianDCoupling(const Eigen::Matrix< double, 6, 1 > &kv, const Eigen::Twistd &Tdes, const Eigen::Twistd &T)
Eigen::Displacementd projectRotation(const Eigen::Displacementd &H, const Eigen::Vector3d &n, double &theta)
Eigen::Matrix< double, 6, 1 > Vector6d
Eigen::Matrix< double, 6, 1 > cartesianPDCoupling(const Eigen::Matrix< double, 6, 1 > &kp, const Eigen::Displacementd &Hdes, const Eigen::Displacementd &H, const Eigen::Matrix< double, 6, 1 > &kv, const Eigen::Twistd &Tdes, const Eigen::Twistd &T)
virtual const Eigen::MatrixXd & getInertiaMatrix() const =0
Control utility functions.
Eigen::Displacementd computeEgoFrame(Model &model, const Eigen::Vector3d &fwdDirection_in_phantom)
Eigen::VectorXd adaptKToInertia(const Eigen::VectorXd &K, const Model &model, double scale=1.)