TurtleQUAD 2.0
Loading...
Searching...
No Matches
Chassis.hpp
Go to the documentation of this file.
1
4
5#pragma once
6
7#include "Leg.hpp"
8#include "spatial.hpp"
9#include <array>
10
21class Chassis {
22public:
31 Chassis(Eigen::Matrix6d &G, Eigen::Isometry3d &Ms,
32 std::array<Eigen::Isometry3d, 4> &M01)
33 : G{G}, Ms{Ms}, M01{M01} {}
34
46 bool ik(const Eigen::Isometry3d &Ts0,
47 const std::array<Eigen::Isometry3d, 4> &T4,
48 std::array<Eigen::Vector3d, 4> &pf,
49 Eigen::Matrix<double, 6, 12> *Jinv);
59 bool ivk(const Eigen::Vector6d &Vb, const Eigen::Matrix<double, 6, 12> &Jinv,
60 std::array<Eigen::Vector3d, 4> &vf);
61
69 bool id(std::array<Eigen::Vector3d, 4> &ff);
70
82 bool nvp(const Eigen::Vector6d &F,
83 const std::array<std::shared_ptr<Leg>, 4> &legs, double &K);
84
85 void run();
86
87 /* Chassis state */
88 Eigen::Isometry3d Ts0;
89 Eigen::Vector6d Vb;
90 Eigen::Vector6d dVb;
91 Eigen::Vector6d Fb;
92
93 /* Rollover */
94 double K;
96
97 /* Legs */
98 std::array<Eigen::Isometry3d, 4> T4;
99 std::array<std::shared_ptr<Leg>, 4> legs;
100
101 Eigen::Hyperplane<double, 3> footPlane;
102
103private:
104 const Eigen::Matrix6d G;
105
106 // Body Frame in Home Configuration
107 const Eigen::Isometry3d Ms;
108 const std::array<Eigen::Isometry3d, 4>
110
111 Eigen::Matrix<double, 6, 12> Jinv;
112
113 const Eigen::Vector3d g{0, 0, 9.81};
114};
Eigen::Hyperplane< double, 3 > footPlane
Foot Plane.
Definition Chassis.hpp:101
Chassis(Eigen::Matrix6d &G, Eigen::Isometry3d &Ms, std::array< Eigen::Isometry3d, 4 > &M01)
Chassis Constructor.
Definition Chassis.hpp:31
const Eigen::Isometry3d Ms
Tf chassis home in the space frame [SE(3)].
Definition Chassis.hpp:107
Eigen::Vector6d Fb
Chassis wrench [N*m; m].
Definition Chassis.hpp:91
Eigen::Isometry3d Ts0
Tf chassis in home frame [SE(3)].
Definition Chassis.hpp:88
std::array< Eigen::Isometry3d, 4 > T4
Tf legs in the space frame [SE(3)].
Definition Chassis.hpp:98
std::array< std::shared_ptr< Leg >, 4 > legs
Array of Leg shared pointers.
Definition Chassis.hpp:99
bool nvp(const Eigen::Vector6d &F, const std::array< std::shared_ptr< Leg >, 4 > &legs, double &K)
Margin of Static Stability.
Definition Chassis.cpp:41
const std::array< Eigen::Isometry3d, 4 > M01
Tf legs in the chassis body frame [SE(3)].
Definition Chassis.hpp:109
bool ik(const Eigen::Isometry3d &Ts0, const std::array< Eigen::Isometry3d, 4 > &T4, std::array< Eigen::Vector3d, 4 > &pf, Eigen::Matrix< double, 6, 12 > *Jinv)
Inverse Kinematics.
Definition Chassis.cpp:6
const Eigen::Matrix6d G
Spatial inertia matrix [kg*m^2; m].
Definition Chassis.hpp:104
Eigen::Matrix< double, 6, 12 > Jinv
6x12 Inverse Jacobian
Definition Chassis.hpp:111
bool id(std::array< Eigen::Vector3d, 4 > &ff)
Inverse Dynamics.
Definition Chassis.cpp:32
Eigen::Vector6d dVb
Chassis spatial acceleration [rad/s^2; m/s^2].
Definition Chassis.hpp:90
double K
Lowest normalized virtual power.
Definition Chassis.hpp:94
int iRolloverLeg
Index of leg with lowest bordering K (next leg to step).
Definition Chassis.hpp:95
Eigen::Vector6d Vb
Chassis twist [rad/s; m/s].
Definition Chassis.hpp:89
const Eigen::Vector3d g
Gravity vector [m/s^2].
Definition Chassis.hpp:113
bool ivk(const Eigen::Vector6d &Vb, const Eigen::Matrix< double, 6, 12 > &Jinv, std::array< Eigen::Vector3d, 4 > &vf)
Inverse Velocity Kinematics.
Definition Chassis.cpp:22