Tetrapod Project
kinematics.h
Go to the documentation of this file.
1 /*******************************************************************/
2 /* AUTHOR: Paal Arthur S. Thorseth */
3 /* ORGN: Dept of Eng Cybernetics, NTNU Trondheim */
4 /* FILE: kinematics.h */
5 /* DATE: Mar 1, 2021 */
6 /* */
7 /* Copyright (C) 2021 Paal Arthur S. Thorseth, */
8 /* Adrian B. Ghansah */
9 /* */
10 /* This program is free software: you can redistribute it */
11 /* and/or modify it under the terms of the GNU General */
12 /* Public License as published by the Free Software Foundation, */
13 /* either version 3 of the License, or (at your option) any */
14 /* later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty */
18 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
19 /* See the GNU General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU General Public */
22 /* License along with this program. If not, see */
23 /* <https://www.gnu.org/licenses/>. */
24 /* */
25 /*******************************************************************/
26 
27 #pragma once
28 
29 // C++ Standard Library
30 #include <cmath>
31 #include <algorithm>
32 
33 // ROS
34 #include "ros/ros.h"
35 
36 // ROS Package Libraries
37 #include <math_utils/angle_utils.h>
38 
39 // Eigen
40 #include <Eigen/Core>
41 
42 // Kindr
43 #include <kindr/Core>
44 
45 using GeneralizedCoordinates = Eigen::Matrix<double, 18, 1>;
46 using FootstepPositions = Eigen::Matrix<Eigen::Vector3d, 4, 1>;
47 using JointSpaceVector = Eigen::Matrix<double, 12, 1>;
48 using Twist = Eigen::Matrix<double, 6, 1>;
50 using TransMatrix = kindr::HomTransformMatrixD;
51 
54 {
56  public: enum LegType { frontLeft = 1, frontRight = 2, rearLeft = 3, rearRight = 4, NONE };
57 
59  public: enum BodyType { base = 1, hip = 2, thigh = 3, leg = 4, foot = 5 };
60 
62  public: Kinematics();
63 
65  public: virtual ~Kinematics();
66 
76  public: bool SolveForwardKinematics(const GeneralizedCoordinates &_q,
77  FootstepPositions &_f_pos);
78 
87  public: bool SolveInverseKinematics(const Twist &_q_b,
88  const FootstepPositions &_f_pos,
89  JointSpaceVector &_q_r);
90 
98  public: Vector3d SolveSingleLegForwardKinematics(const Vector3d &_h_pos,
99  const double &_theta_hy,
100  const double &_theta_hp,
101  const double &_theta_kp);
102 
108  public: Vector3d SolveSingleLegForwardKinematics(const Vector3d &_joint_angles);
109 
116  public: Vector3d SolveSingleLegForwardKinematics(const LegType &_leg_type, const Vector3d &_joint_angles);
117 
124  public: Vector3d SolveSingleLegHipToFootForwardKinematics(const LegType &_leg_type, const Vector3d &_joint_angles);
125 
137  public: bool SolveSingleLegInverseKinematics(const bool &_offset,
138  const Vector3d &_h_pos,
139  const Vector3d &_f_pos,
140  Vector3d &_joint_angles);
141 
152  public: bool SolveSingleLegInverseKinematics(const bool &_offset,
153  const Vector3d &_f_pos,
154  Vector3d &_joint_angles);
155 
163  public: TransMatrix GetDhTransform(const double &_a,
164  const double &_alpha,
165  const double &_d,
166  const double &_theta);
167 
176  public: TransMatrix GetHipToBodyTransform(const LegType &_leg,
177  const BodyType &_body,
178  const double &_theta_hy,
179  const double &_theta_hp,
180  const double &_theta_kp);
181 
190  public: Eigen::Matrix<double, 3, 3> GetRotationMatrixWToB(const double &_roll,
191  const double &_pitch,
192  const double &_yaw);
193 
205  public: Eigen::Matrix<double, 3, 3> GetRotationMatrixWToBDiff(const double &_roll,
206  const double &_pitch,
207  const double &_yaw,
208  const double &_roll_rate,
209  const double &_pitch_rate,
210  const double &_yaw_rate);
211 
221  public: Eigen::Matrix<double, 3, 3> GetRotationMatrixWToC(const double &_roll,
222  const double &_pitch,
223  const double &_yaw);
224 
236  public: Eigen::Matrix<double, 3, 3> GetRotationMatrixWToCDiff(const double &_roll,
237  const double &_pitch,
238  const double &_yaw,
239  const double &_roll_rate,
240  const double &_pitch_rate,
241  const double &_yaw_rate);
242 
252  public: Eigen::Matrix<double, 3, 3> GetRotationMatrixCToB(const double &_roll,
253  const double &_pitch,
254  const double &_yaw);
255 
267  public: Eigen::Matrix<double, 3, 3> GetRotationMatrixCToBDiff(const double &_roll,
268  const double &_pitch,
269  const double &_yaw,
270  const double &_roll_rate,
271  const double &_pitch_rate,
272  const double &_yaw_rate);
273 
281  public: Eigen::Matrix<double, 3, 1> GetPositionBaseToBodyInB(const LegType &_leg,
282  const BodyType &_body,
283  const Eigen::Matrix<double, 18, 1> &_q);
284 
295  public: Eigen::Matrix<double, 3, 3> GetTranslationJacobianInB(const LegType &_leg,
296  const BodyType &_body,
297  const double &_theta_hy,
298  const double &_theta_hp,
299  const double &_theta_kp);
300 
309  public: Eigen::Matrix<double, 3, 12> GetTranslationJacobianInB(const LegType &_leg,
310  const BodyType &_body,
311  const Eigen::Matrix<double, 12, 1> &_q_r);
312 
321  public: Eigen::Matrix<double, 3, 18> GetTranslationJacobianInW(const LegType &_leg,
322  const BodyType &_body,
323  const Eigen::Matrix<double, 18, 1> &_q);
324 
333  public: Eigen::Matrix<double, 3, 18> GetTranslationJacobianInC(const LegType &_leg,
334  const BodyType &_body,
335  const Eigen::Matrix<double, 18, 1> &_q);
336 
348  public: Eigen::Matrix<double, 3, 3> GetTranslationJacobianInBDiff(const LegType &_leg,
349  const BodyType &_body,
350  const double &_theta_hy,
351  const double &_theta_hp,
352  const double &_theta_kp,
353  const double &_dot_theta_hy,
354  const double &_dot_theta_hp,
355  const double &_dot_theta_kp);
356 
364  public: Eigen::Matrix<double, 3, 12> GetTranslationJacobianInBDiff(const LegType &_leg,
365  const BodyType &_body,
366  const Eigen::Matrix<double, 12, 1> &_q_r,
367  const Eigen::Matrix<double, 12, 1> &_dot_q_r);
368 
378  public: Eigen::Matrix<double, 3, 18> GetTranslationJacobianInWDiff(const LegType &_leg,
379  const BodyType &_body,
380  const Eigen::Matrix<double, 18, 1> &_q,
381  const Eigen::Matrix<double, 18, 1> &_u);
382 
392  public: Eigen::Matrix<double, 3, 18> GetTranslationJacobianInCDiff(const LegType &_leg,
393  const BodyType &_body,
394  const Eigen::Matrix<double, 18, 1> &_q,
395  const Eigen::Matrix<double, 18, 1> &_u);
396 
397 
408  public: Eigen::Matrix<double, 3, 3> GetRotationJacobianInB(const LegType &_leg,
409  const BodyType &_body,
410  const double &_theta_hy,
411  const double &_theta_hp,
412  const double &_theta_kp);
413 
422  public: Eigen::Matrix<double, 3, 12> GetRotationJacobianInB(const LegType &_leg,
423  const BodyType &_body,
424  const Eigen::Matrix<double, 12, 1> &_q_r);
425 
434  public: Eigen::Matrix<double, 3, 18> GetRotationJacobianInW(const LegType &_leg,
435  const BodyType &_body,
436  const Eigen::Matrix<double, 18, 1> &_q);
437 
446  public: Eigen::Matrix<double, 3, 18> GetRotationJacobianInC(const LegType &_leg,
447  const BodyType &_body,
448  const Eigen::Matrix<double, 18, 1> &_q);
449 
461  public: Eigen::Matrix<double, 3, 3> GetRotationJacobianInBDiff(const LegType &_leg,
462  const BodyType &_body,
463  const double &_theta_hy,
464  const double &_theta_hp,
465  const double &_theta_kp,
466  const double &_dot_theta_hy,
467  const double &_dot_theta_hp,
468  const double &_dot_theta_kp);
469 
477  public: Eigen::Matrix<double, 3, 12> GetRotationJacobianInBDiff(const LegType &_leg,
478  const BodyType &_body,
479  const Eigen::Matrix<double, 12, 1> &_q_r,
480  const Eigen::Matrix<double, 12, 1> &_dot_q_r);
481 
490  public: Eigen::Matrix<double, 3, 18> GetRotationJacobianInWDiff(const LegType &_leg,
491  const BodyType &_body,
492  const Eigen::Matrix<double, 18, 1> &_q,
493  const Eigen::Matrix<double, 18, 1> &_u);
494 
503  public: Eigen::Matrix<double, 3, 18> GetRotationJacobianInCDiff(const LegType &_leg,
504  const BodyType &_body,
505  const Eigen::Matrix<double, 18, 1> &_q,
506  const Eigen::Matrix<double, 18, 1> &_u);
507 
515  public: Eigen::Matrix<double, 6, 18> GetJacobianInW(const LegType &_leg,
516  const BodyType &_body,
517  const Eigen::Matrix<double, 18, 1> &_q);
518 
525  public: Eigen::Matrix<double, 6, 18> GetJacobianInWDiff(const LegType &_leg,
526  const BodyType &_body,
527  const Eigen::Matrix<double, 18, 1> &_q,
528  const Eigen::Matrix<double, 18, 1> &_u);
529 
537  public: Eigen::Matrix<double, Eigen::Dynamic, 18> GetContactJacobianInW(std::vector<LegType> &_legs,
538  const Eigen::Matrix<double, 18, 1> &_q);
539 
546  public: Eigen::Matrix<double, Eigen::Dynamic, 18> GetContactJacobianInWDiff(std::vector<LegType> &_legs,
547  const Eigen::Matrix<double, 18, 1> &_q,
548  const Eigen::Matrix<double, 18, 1> &_u);
549 
557  public: Eigen::Matrix<double, Eigen::Dynamic, 18> GetSwingJacobianInW(std::vector<LegType> &_legs,
558  const Eigen::Matrix<double, 18, 1> &_q);
559 
567  public: Eigen::Matrix<double, Eigen::Dynamic, 18> GetSwingJacobianInWDiff(std::vector<LegType> &_legs,
568  const Eigen::Matrix<double, 18, 1> &_q,
569  const Eigen::Matrix<double, 18, 1> &_u);
570 
577  public: Eigen::Matrix<double, 18, 18> GetSingleBodyMassMatrix(const LegType &_leg,
578  const BodyType &_body,
579  const Eigen::Matrix<double, 18, 1> &_q);
580 
585  public: Eigen::Matrix<double, 18, 18> GetMassMatrix(const Eigen::Matrix<double, 18, 1> &_q);
586 
587 
588  public: Eigen::Matrix<double, 3, 3> GetSingleLegMassMatrix(const Eigen::Matrix<double, 3, 1> &_q);
589 
597  public: Eigen::Matrix<double, 18, 1> GetSingleBodyCoriolisAndCentrifugalTerms(const LegType &_leg,
598  const BodyType &_body,
599  const Eigen::Matrix<double, 18, 1> &_q,
600  const Eigen::Matrix<double, 18, 1> &_u);
601 
607  public: Eigen::Matrix<double, 18, 1> GetCoriolisAndCentrifugalTerms(const Eigen::Matrix<double, 18, 1> &_q,
608  const Eigen::Matrix<double, 18, 1> &_u);
609 
610 
611  public: Eigen::Matrix<double, 3, 1> GetSingleLegCoriolisAndCentrifugalTerms(const Eigen::Matrix<double, 3, 1> &_q,
612  const Eigen::Matrix<double, 3, 1> &_u);
613 
620  public: Eigen::Matrix<double, 18, 1> GetSingleBodyGravitationalTerms(const LegType &_leg,
621  const BodyType &_body,
622  const Eigen::Matrix<double, 18, 1> &_q);
623 
628  public: Eigen::Matrix<double, 18, 1> GetGravitationalTerms(const Eigen::Matrix<double, 18, 1> &_q);
629 
630  public: Eigen::Matrix<double, 3, 1> GetSingleLegGravitationalTerms(const Eigen::Matrix<double, 3, 1> &_q);
631 
636  public: bool ValidateSolution(const JointSpaceVector &_q_r);
637 
642  public: bool ValidateSolution(const Eigen::Matrix<double, 3, 1> &_q_r);
643 
651  private: Eigen::Matrix<double, 3, 3> GetInertiaMatrix(const double &_I_XX,
652  const double &_I_YY,
653  const double &_I_ZZ,
654  const double &_I_XY,
655  const double &_I_XZ,
656  const double &_I_YZ);
657 
658  private: double GetBodyMass(BodyType _body);
659 
660  private: Eigen::Matrix<double, 3, 3> GetBodyInertia(BodyType _body);
661 
662  private: Eigen::Matrix<double, 3, 3> GetBodyInertia(BodyType _body, LegType _leg);
663 
664  public: bool GetflOffset() {return flOffset;}
665 
666  public: bool GetfrOffset() {return frOffset;}
667 
668  public: bool GetrlOffset() {return rlOffset;}
669 
670  public: bool GetrrOffset() {return rrOffset;}
671 
672  public: Eigen::Matrix<double, 3, 1> GetDistanceFromBaseToFrontLeftHipInB() {return positionBaseToFrontLeftInB;}
673 
674  public: Eigen::Matrix<double, 3, 1> GetDistanceFromBaseToFrontRightHipInB() {return positionBaseToFrontRightInB;}
675 
676  public: Eigen::Matrix<double, 3, 1> GetDistanceFromBaseToRearLeftHipInB() {return positionBaseToRearLeftInB;}
677 
678  public: Eigen::Matrix<double, 3, 1> GetDistanceFromBaseToRearRightHipInB() {return positionBaseToRearRightInB;}
679 
682 
685 
689 
693 
697 
701 
703  private: double L1;
704 
706  private: double L2;
707 
709  private: double L3;
710 
712  private: double LC1;
713 
715  private: double LC2;
716 
718  private: double LC3;
719 
721  private: bool flOffset;
722 
724  private: bool frOffset;
725 
727  private: bool rlOffset;
728 
730  private: bool rrOffset;
731 
733  private: double M0;
734 
736  private: double M1;
737 
739  private: double M2;
740 
742  private: double M3;
743 
745  private: Eigen::Matrix<double, 3, 3> I0;
746 
748  private: Eigen::Matrix<double, 3, 3> I1_fl_rr;
749 
751  private: Eigen::Matrix<double, 3, 3> I1_fr_rl;
752 
754  private: Eigen::Matrix<double, 3, 3> I2;
755 
757  private: Eigen::Matrix<double, 3, 3> I3;
758 };
A class for analytical Kinematics Solving.
Definition: kinematics.h:54
double GetBodyMass(BodyType _body)
Eigen::Matrix< double, 3, 18 > GetTranslationJacobianInW(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetTranslationJacobianInW function returns the 3x18 spatial translation Jacobian mapping generali...
Definition: kinematics.cpp:911
double L3
Leg (Fibula & Tibia) link length.
Definition: kinematics.h:709
Eigen::Matrix< double, Eigen::Dynamic, 18 > GetContactJacobianInW(std::vector< LegType > &_legs, const Eigen::Matrix< double, 18, 1 > &_q)
The GetContactJacobianInW function returns the (3*n_c)x18 support Jacobian mapping reaction forces at...
Eigen::Matrix< double, 18, 18 > GetMassMatrix(const Eigen::Matrix< double, 18, 1 > &_q)
The GetMassMatrix function returns the mass matrix for the floating base system.
bool SolveInverseKinematics(const Twist &_q_b, const FootstepPositions &_f_pos, JointSpaceVector &_q_r)
The SolveInverseKinematics function calculates the Inverse Kinematics, i.e. maps a coordinate point i...
Definition: kinematics.cpp:104
Eigen::Matrix< double, 3, 3 > GetRotationMatrixWToB(const double &_roll, const double &_pitch, const double &_yaw)
The GetRotationMatrixWToB function returns the Euler Angles ZYX rotation matrix from World to Body fr...
Definition: kinematics.cpp:539
Eigen::Matrix< double, 18, 1 > GetSingleBodyCoriolisAndCentrifugalTerms(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetSingleBodyCoriolisAndCentrifugalTerms function returns the coriolis and centrifugal terms for ...
bool frOffset
Front Right offset.
Definition: kinematics.h:724
bool ValidateSolution(const JointSpaceVector &_q_r)
The ValidateSolution function evaluates whether a set of joint angles is within joint limits.
Eigen::Matrix< double, 3, 1 > GetDistanceFromBaseToRearLeftHipInB()
Definition: kinematics.h:676
bool GetrlOffset()
Definition: kinematics.h:668
Eigen::Matrix< double, 3, 3 > GetSingleLegMassMatrix(const Eigen::Matrix< double, 3, 1 > &_q)
Vector3d SolveSingleLegHipToFootForwardKinematics(const LegType &_leg_type, const Vector3d &_joint_angles)
The SolveSingleLegHipToFootForwardKinematics function calculates the foot position in the hip frame.
Definition: kinematics.cpp:262
Eigen::Matrix< double, 3, 18 > GetTranslationJacobianInCDiff(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetTranslationJacobianInCDiff function returns the time derivative of the 3x18 spatial translatio...
Eigen::Matrix< double, 3, 18 > GetRotationJacobianInWDiff(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetRotationJacobianInWDiff function returns the time derivative of the 3x18 spatial Rotation Jaco...
BodyType
Body type enumerator.
Definition: kinematics.h:59
Eigen::Matrix< double, 3, 3 > GetRotationMatrixWToC(const double &_roll, const double &_pitch, const double &_yaw)
The GetRotationMatrixWToC function returns the Euler Angles ZYX rotation matrix from World to Control...
Definition: kinematics.cpp:574
Vector3d positionBaseToFrontLeftInB
Position vector relating the base coordinates to the front left hip.
Definition: kinematics.h:688
TransMatrix GetDhTransform(const double &_a, const double &_alpha, const double &_d, const double &_theta)
The GetDhTransform function returns the Denavit-Hartenberg transformation from frame A to frame B.
Definition: kinematics.cpp:369
TransMatrix GetHipToBodyTransform(const LegType &_leg, const BodyType &_body, const double &_theta_hy, const double &_theta_hp, const double &_theta_kp)
The GetHipToBodyTransform function returns the homogeneous transformation from the hip frame to the s...
Definition: kinematics.cpp:389
bool rrOffset
Rear Right offset.
Definition: kinematics.h:730
Vector3d positionBaseToRearLeftInB
Position vector relating the base coordinates to the rear left hip.
Definition: kinematics.h:696
bool GetfrOffset()
Definition: kinematics.h:666
Eigen::Matrix< double, 3, 3 > I3
Leg link inertia matrix.
Definition: kinematics.h:757
Eigen::Matrix< double, Eigen::Dynamic, 18 > GetSwingJacobianInW(std::vector< LegType > &_legs, const Eigen::Matrix< double, 18, 1 > &_q)
The GetSwingJacobianInW function returns the (3*n_s)x18 support Jacobian mapping swing foot velocitie...
double LC2
Hip pitch joint to thigh CoM length.
Definition: kinematics.h:715
Eigen::Matrix< double, 3, 3 > GetRotationJacobianInBDiff(const LegType &_leg, const BodyType &_body, const double &_theta_hy, const double &_theta_hp, const double &_theta_kp, const double &_dot_theta_hy, const double &_dot_theta_hp, const double &_dot_theta_kp)
The GetRotationJacobianInBDiff function returns the time derivative of the 3x3 Rotation Jacobian matr...
virtual ~Kinematics()
Destructor.
Definition: kinematics.cpp:101
Eigen::Matrix< double, 3, 1 > GetDistanceFromBaseToFrontLeftHipInB()
Definition: kinematics.h:672
bool rlOffset
Rear Left offset.
Definition: kinematics.h:727
Eigen::Matrix< double, 18, 1 > GetSingleBodyGravitationalTerms(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetSingleBodyGravitationalTerms function returns the gravitational terms for a single body in the...
Eigen::Matrix< double, 3, 3 > GetTranslationJacobianInB(const LegType &_leg, const BodyType &_body, const double &_theta_hy, const double &_theta_hp, const double &_theta_kp)
The GetTranslationJacobianInB function returns the 3x3 Jacobian matrix for body linear velocities in ...
Definition: kinematics.cpp:723
Eigen::Matrix< double, 3, 3 > GetInertiaMatrix(const double &_I_XX, const double &_I_YY, const double &_I_ZZ, const double &_I_XY, const double &_I_XZ, const double &_I_YZ)
The GetInertiaMatrix function returns the inertia matrix from the six inertial parameters.
JointSpaceVector max_angles
Maximum joint limits.
Definition: kinematics.h:684
Eigen::Matrix< double, 6, 18 > GetJacobianInW(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetJacobianInW function returns the 6x18 spatial Jacobian mapping generalized velocities to opera...
Eigen::Matrix< double, 3, 3 > GetRotationJacobianInB(const LegType &_leg, const BodyType &_body, const double &_theta_hy, const double &_theta_hp, const double &_theta_kp)
The GetRotationJacobianInB function returns the 3x3 Jacobian matrix for body angular velocities in th...
Eigen::Matrix< double, 3, 1 > GetSingleLegCoriolisAndCentrifugalTerms(const Eigen::Matrix< double, 3, 1 > &_q, const Eigen::Matrix< double, 3, 1 > &_u)
double LC3
Knee pitch joint to leg CoM length.
Definition: kinematics.h:718
Vector3d SolveSingleLegForwardKinematics(const Vector3d &_h_pos, const double &_theta_hy, const double &_theta_hp, const double &_theta_kp)
The SolveSingleLegForwardKinematics function calculates the Forward Kinematics for a single leg.
Definition: kinematics.cpp:229
Vector3d positionBaseToRearRightInB
Position vector relating the base coordinates to the rear right hip.
Definition: kinematics.h:700
Eigen::Matrix< double, 3, 3 > I0
Body link inertia matrix.
Definition: kinematics.h:745
Eigen::Matrix< double, 3, 3 > GetTranslationJacobianInBDiff(const LegType &_leg, const BodyType &_body, const double &_theta_hy, const double &_theta_hp, const double &_theta_kp, const double &_dot_theta_hy, const double &_dot_theta_hp, const double &_dot_theta_kp)
The GetTranslationJacobianDerivativeInB function returns the time derivative of the 3x3 translation J...
Eigen::Matrix< double, 3, 1 > GetDistanceFromBaseToRearRightHipInB()
Definition: kinematics.h:678
Eigen::Matrix< double, 3, 1 > GetDistanceFromBaseToFrontRightHipInB()
Definition: kinematics.h:674
Eigen::Matrix< double, 3, 3 > I1_fr_rl
Front Right & Rear Left Hip link inertia matrix.
Definition: kinematics.h:751
bool SolveForwardKinematics(const GeneralizedCoordinates &_q, FootstepPositions &_f_pos)
The SolveForwardKinematics function calculates the Forward Kinematics, i.e. maps joint angles in Join...
Definition: kinematics.cpp:165
Eigen::Matrix< double, 3, 3 > GetRotationMatrixCToB(const double &_roll, const double &_pitch, const double &_yaw)
The GetRotationMatrixCToB function returns the Euler Angles ZYX rotation matrix from Control to Body ...
Definition: kinematics.cpp:609
Eigen::Matrix< double, 18, 1 > GetGravitationalTerms(const Eigen::Matrix< double, 18, 1 > &_q)
The GetGravitationalTerms function returns the gravitational terms for the floating base system.
double M3
Leg link mass.
Definition: kinematics.h:742
Eigen::Matrix< double, Eigen::Dynamic, 18 > GetContactJacobianInWDiff(std::vector< LegType > &_legs, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetContactJacobianInWDiff function returns the time derivative of the (3*n_c)x18 support Jacobian...
double M1
Hip link mass.
Definition: kinematics.h:736
double L2
Thigh (Femur) link length.
Definition: kinematics.h:706
double M2
Thigh link mass.
Definition: kinematics.h:739
double M0
Body link mass.
Definition: kinematics.h:733
Eigen::Matrix< double, 18, 18 > GetSingleBodyMassMatrix(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetSingleBodyMassMatrix function returns the mass matrix for a single body in the system.
Eigen::Matrix< double, 3, 3 > GetBodyInertia(BodyType _body)
Eigen::Matrix< double, 3, 18 > GetTranslationJacobianInC(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetTranslationJacobianInC function returns the 3x18 spatial translation Jacobian mapping generali...
Definition: kinematics.cpp:969
Eigen::Matrix< double, 3, 1 > GetPositionBaseToBodyInB(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetPositionBaseToBodyInB returns the position vector from base origin to COM position in body-fra...
Definition: kinematics.cpp:644
Eigen::Matrix< double, 3, 18 > GetRotationJacobianInC(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetRotationJacobianInC function returns the 3x18 spatial rotation Jacobian mapping generalized ve...
Vector3d positionBaseToFrontRightInB
Position vector relating the base coordinates to the front right hip.
Definition: kinematics.h:692
bool flOffset
Front Left offset.
Definition: kinematics.h:721
JointSpaceVector min_angles
Minimum joint limits.
Definition: kinematics.h:681
bool GetrrOffset()
Definition: kinematics.h:670
Eigen::Matrix< double, 3, 3 > I1_fl_rr
Front Left & Rear Right Hip link inertia matrix.
Definition: kinematics.h:748
bool GetflOffset()
Definition: kinematics.h:664
Eigen::Matrix< double, 3, 3 > I2
Thigh link inertia matrix.
Definition: kinematics.h:754
bool SolveSingleLegInverseKinematics(const bool &_offset, const Vector3d &_h_pos, const Vector3d &_f_pos, Vector3d &_joint_angles)
The SolveSingeLegInverseKinematics function calculates the inverse kinematics for a single leg.
Definition: kinematics.cpp:296
Eigen::Matrix< double, 3, 3 > GetRotationMatrixCToBDiff(const double &_roll, const double &_pitch, const double &_yaw, const double &_roll_rate, const double &_pitch_rate, const double &_yaw_rate)
The GetRotationMatrixCToBDiff function returns the time derivative of the Euler Angles ZYX rotation m...
Definition: kinematics.cpp:622
Eigen::Matrix< double, 3, 3 > GetRotationMatrixWToCDiff(const double &_roll, const double &_pitch, const double &_yaw, const double &_roll_rate, const double &_pitch_rate, const double &_yaw_rate)
The GetRotationMatrixWToCDiff function returns the time derivative of the Euler Angles ZYX rotation m...
Definition: kinematics.cpp:587
Eigen::Matrix< double, 3, 18 > GetRotationJacobianInCDiff(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetRotationJacobianInCDiff function returns the time derivative of the 3x18 control frame Rotatio...
Eigen::Matrix< double, 3, 3 > GetRotationMatrixWToBDiff(const double &_roll, const double &_pitch, const double &_yaw, const double &_roll_rate, const double &_pitch_rate, const double &_yaw_rate)
The GetRotationMatrixWToBDiff function returns the time derivative of the Euler Angles ZYX rotation m...
Definition: kinematics.cpp:552
Eigen::Matrix< double, 3, 18 > GetTranslationJacobianInWDiff(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetTranslationJacobianInWDiff function returns the time derivative of the 3x18 spatial translatio...
Eigen::Matrix< double, Eigen::Dynamic, 18 > GetSwingJacobianInWDiff(std::vector< LegType > &_legs, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetContactJacobianInWDiff function returns the time derivative of the (3*n_s)x18 support Jacobian...
Eigen::Matrix< double, 3, 18 > GetRotationJacobianInW(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q)
The GetRotationJacobianInW function returns the 3x18 spatial rotation Jacobian mapping generalized ve...
Eigen::Matrix< double, 6, 18 > GetJacobianInWDiff(const LegType &_leg, const BodyType &_body, const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetJacobianInW function returns the time derivative of the 6x18 spatial Jacobian.
Kinematics()
Constructor.
Definition: kinematics.cpp:31
LegType
Leg type enumerator.
Definition: kinematics.h:56
double L1
Hip link length.
Definition: kinematics.h:703
Eigen::Matrix< double, 3, 1 > GetSingleLegGravitationalTerms(const Eigen::Matrix< double, 3, 1 > &_q)
double LC1
Hip yaw joint to hip CoM length.
Definition: kinematics.h:712
Eigen::Matrix< double, 18, 1 > GetCoriolisAndCentrifugalTerms(const Eigen::Matrix< double, 18, 1 > &_q, const Eigen::Matrix< double, 18, 1 > &_u)
The GetCoriolisAndCentrifugalTerms function returns the coriolis and centrifugal terms for the floati...
Eigen::Matrix< double, 18, 1 > GeneralizedCoordinates
Definition: kinematics.h:45
Eigen::Vector3d Vector3d
Definition: kinematics.h:49
Eigen::Matrix< double, 12, 1 > JointSpaceVector
Definition: kinematics.h:47
Eigen::Matrix< Eigen::Vector3d, 4, 1 > FootstepPositions
Definition: kinematics.h:46
kindr::HomTransformMatrixD TransMatrix
Definition: kinematics.h:50
Eigen::Matrix< double, 6, 1 > Twist
Definition: kinematics.h:48