- 3.0.2 models module.
QuadrotorLinear.hpp
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 #include <Eigen/Dense>
9 #include <ct/core/core.h>
10 #include "Quadrotor.hpp"
11 
12 namespace ct {
13 namespace models {
14 
15 class QuadrotorLinear final : public ct::core::LinearSystem<quadrotor::nStates, quadrotor::nControls>
16 {
17 public:
20 
21  typedef Eigen::Matrix<double, quadrotor::nStates, quadrotor::nStates> state_matrix_t;
22  typedef Eigen::Matrix<double, quadrotor::nStates, quadrotor::nControls> state_control_matrix_t;
23 
24 
25  QuadrotorLinear* clone() const override { return new QuadrotorLinear(*this); }
26  const state_matrix_t& getDerivativeState(const state_vector_t& x,
27  const control_vector_t& u,
28  const ct::core::Time t = 0.0) override
29  {
30  A_ = A_quadrotor(x, u);
31  return A_;
32  }
33 
34  const state_control_matrix_t& getDerivativeControl(const state_vector_t& x,
35  const control_vector_t& u,
36  const ct::core::Time t = 0.0) override
37  {
38  B_ = B_quadrotor(x, u);
39  return B_;
40  }
41 
42 private:
43  state_matrix_t A_;
44  state_control_matrix_t B_;
45 };
46 }
47 }
Eigen::Matrix< double, quadrotor::nStates, quadrotor::nStates > state_matrix_t
Definition: QuadrotorLinear.hpp:21
Eigen::Matrix< double, quadrotor::nStates, quadrotor::nControls > state_control_matrix_t
Definition: QuadrotorLinear.hpp:22
Definition: QuadrotorLinear.hpp:15
const state_matrix_t & getDerivativeState(const state_vector_t &x, const control_vector_t &u, const ct::core::Time t=0.0) override
Definition: QuadrotorLinear.hpp:26
ct::core::ControlVector< quadrotor::nControls > control_vector_t
Definition: QuadrotorLinear.hpp:19
ct::core::StateVector< quadrotor::nStates > state_vector_t
Definition: QuadrotorLinear.hpp:18
QuadrotorLinear * clone() const override
Definition: QuadrotorLinear.hpp:25
quadrotor::control_gain_matrix_t B_quadrotor(const quadrotor::state_vector_t &x, const quadrotor::control_vector_t &u)
Definition: B_quadrotor.cpp:15
const state_control_matrix_t & getDerivativeControl(const state_vector_t &x, const control_vector_t &u, const ct::core::Time t=0.0) override
Definition: QuadrotorLinear.hpp:34
double Time
quadrotor::state_matrix_t A_quadrotor(const quadrotor::state_vector_t &x, const quadrotor::control_vector_t &u)
Definition: A_quadrotor.cpp:14