36 QuadrotorDynamicsSolver::QuadrotorDynamicsSolver()
43 J_.diagonal() = Eigen::Vector3d(0.0023, 0.0023, 0.004);
46 J_inv_.diagonal() = Eigen::Vector3d(1. / 0.0023, 1. / 0.0023, 1. / 0.0040);
49 void QuadrotorDynamicsSolver::AssignScene(
ScenePtr scene_in)
51 const int num_positions_in = scene_in->GetKinematicTree().GetNumControlledJoints();
53 if ((num_positions_in) != 6 || scene_in->GetKinematicTree().GetControlledBaseType() != BaseType::FLOATING)
85 Eigen::MatrixXd
Rx(3, 3),
Ry(3, 3),
Rz(3, 3),
R;
94 Ftot << 0, 0, F_1 + F_2 + F_3 +
F_4;
100 tau <<
L_ * (F_1 -
F_2),
102 (M_1 - M_2 + M_3 -
M_4);
107 Iy = 2 * mass_ * (radius * radius) / 5.0 + 2 * radius * radius *
mass_,
108 Iz = 2 * mass_ * (radius *
radius) / 5.0 + 4 * radius * radius * mass_;
110 Eigen::Matrix3d
I,
Iinv;
111 I <<
Ix, 0, 0, 0,
Iy, 0, 0, 0,
Iz;
112 Iinv << 1 /
Ix, 0, 0, 0, 1 /
Iy, 0, 0, 0, 1 /
Iz;
114 omega_dot = Iinv * (tau - omega.cross(I * omega));
139 Eigen::MatrixXd
fx(num_positions_ + num_velocities_, num_positions_ + num_velocities_);
141 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
142 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
143 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
144 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
147 0, 0, 0, (
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))*
sin_psi*
cos_phi*
cos_theta/
mass_, (-sin_phi*
sin_psi*
sin_theta +
cos_psi*
cos_theta)*(
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))/
mass_, (sin_phi*
cos_psi*cos_theta -
sin_psi*
sin_theta)*(
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))/
mass_, 0, 0, 0, 0, 0, 0,
148 0, 0, 0, -(
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))*
cos_phi*
cos_psi*cos_theta/
mass_, (sin_phi*sin_theta*
cos_psi +
sin_psi*cos_theta)*(
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))/
mass_, (sin_phi*
sin_psi*cos_theta + sin_theta*
cos_psi)*(
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))/
mass_, 0, 0, 0, 0, 0, 0,
149 0, 0, 0, -(
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))*sin_phi*cos_theta/
mass_, -(
k_f_*u(0) +
k_f_*u(1) +
k_f_*u(2) +
k_f_*u(3))*sin_theta*
cos_phi/
mass_, 0, 0, 0, 0, 0, 0, 0,
150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.833333333333334*
psi_dot, -0.833333333333334*
theta_dot,
151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.833333333333334*
psi_dot, 0, 0.833333333333334*
phi_dot,
152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
169 Eigen::MatrixXd
fu(num_positions_ + num_velocities_, num_controls_);
#define REGISTER_DYNAMICS_SOLVER_TYPE(TYPE, DERIV)
std::shared_ptr< Scene > ScenePtr
Quadrotor dynamics with quaternion representation Based on D. Mellinger, N. Michael, and V. Kumar, "Trajectory generation and control for precise aggressive maneuvers with quadrotors", Proceedings of the 12th International Symposium on Experimental Robotics (ISER 2010), 2010. Cf. https://journals.sagepub.com/doi/abs/10.1177/0278364911434236.
Eigen::Matrix< T, NU, 1 > ControlVector
Eigen::Matrix< T, NX, 1 > StateVector