26 : initialized_params_(false),
27 controller_active_(false) {
56 assert(rotor_velocities);
62 *rotor_velocities = Eigen::VectorXd::Zero(rotor_velocities->rows());
66 Eigen::Vector3d acceleration;
69 Eigen::Vector3d angular_acceleration;
75 Eigen::Vector4d angular_acceleration_thrust;
76 angular_acceleration_thrust.block<3, 1>(0, 0) = angular_acceleration;
77 angular_acceleration_thrust(3) = thrust;
80 *rotor_velocities = rotor_velocities->cwiseMax(Eigen::VectorXd::Zero(rotor_velocities->rows()));
81 *rotor_velocities = rotor_velocities->cwiseSqrt();
97 Eigen::Vector3d position_error;
103 Eigen::Vector3d velocity_error;
106 Eigen::Vector3d e_3(Eigen::Vector3d::UnitZ());
116 Eigen::Vector3d* angular_acceleration)
const {
117 assert(angular_acceleration);
122 Eigen::Vector3d b1_des;
124 b1_des << cos(yaw), sin(yaw), 0;
126 Eigen::Vector3d b3_des;
127 b3_des = -acceleration / acceleration.norm();
129 Eigen::Vector3d b2_des;
130 b2_des = b3_des.cross(b1_des);
133 Eigen::Matrix3d R_des;
134 R_des.col(0) = b2_des.cross(b3_des);
135 R_des.col(1) = b2_des;
136 R_des.col(2) = b3_des;
139 Eigen::Matrix3d angle_error_matrix = 0.5 * (R_des.transpose() * R - R.transpose() * R_des);
140 Eigen::Vector3d angle_error;
144 Eigen::Vector3d angular_rate_des(Eigen::Vector3d::Zero());
mav_msgs::EigenTrajectoryPoint command_trajectory_
void ComputeDesiredAcceleration(Eigen::Vector3d *acceleration) const
Eigen::Vector3d acceleration_W
void ComputeDesiredAngularAcc(const Eigen::Vector3d &acceleration, Eigen::Vector3d *angular_acceleration) const
Eigen::MatrixX4d angular_acc_to_rotor_velocities_
Eigen::Vector3d normalized_attitude_gain_
Eigen::Vector3d angular_velocity
Eigen::Vector3d position_gain_
Eigen::Vector3d angular_rate_gain_
RotorConfiguration rotor_configuration_
void SetTrajectoryPoint(const mav_msgs::EigenTrajectoryPoint &command_trajectory)
Eigen::Vector3d normalized_angular_rate_gain_
void vectorFromSkewMatrix(Eigen::Matrix3d &skew_matrix, Eigen::Vector3d *vector)
double getYawRate() const
Eigen::Matrix4Xd allocation_matrix_
Eigen::Vector3d velocity_W
std::vector< Rotor > rotors
void SetOdometry(const EigenOdometry &odometry)
VehicleParameters vehicle_parameters_
Eigen::Quaterniond orientation
void CalculateRotorVelocities(Eigen::VectorXd *rotor_velocities) const
Eigen::Vector3d position_W
Eigen::Vector3d velocity_gain_
Eigen::Vector3d attitude_gain_
void calculateAllocationMatrix(const RotorConfiguration &rotor_configuration, Eigen::Matrix4Xd *allocation_matrix)
void InitializeParameters()
LeePositionControllerParameters controller_parameters_