multirotor_forces_and_moments.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Daniel Koch, James Jackson and Gary Ellingson, BYU MAGICC Lab.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * * Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef ROSFLIGHT_SIM_MULTIROTOR_FORCES_AND_MOMENTS_H
33 #define ROSFLIGHT_SIM_MULTIROTOR_FORCES_AND_MOMENTS_H
34 
35 #include <eigen3/Eigen/Dense>
36 #include <ros/ros.h>
37 
39 
40 namespace rosflight_sim
41 {
42 
44 private:
46  Eigen::Vector3d wind_;
47 
48  double prev_time_;
49 
50  struct Rotor{
51  double max;
52  std::vector<double> F_poly;
53  std::vector<double> T_poly;
54  double tau_up; // time constants for response
55  double tau_down;
56  };
57 
58  struct Motor{
60  Eigen::Vector3d position;
61  Eigen::Vector3d normal;
62  int direction; // 1 for CW -1 for CCW
63  };
64 
66  std::vector<Motor> motors_;
67 
68  double linear_mu_;
69  double angular_mu_;
70  std::vector<double> ground_effect_;
71 
72  double mass_;
73 
74  // Container for an Actuator
75  struct Actuator{
76  double max;
77  double tau_up;
78  double tau_down;
79  };
80 
81  // Struct of Actuators
82  // This organizes the physical limitations of the abstract torques and Force
83  struct Actuators{
88  } actuators_;
89 
90  Eigen::MatrixXd rotor_position_;
91  Eigen::MatrixXd rotor_plane_normal_;
92  Eigen::VectorXd rotor_rotation_direction_;
93 
94  Eigen::MatrixXd force_allocation_matrix_;
95  Eigen::MatrixXd torque_allocation_matrix_;
96  Eigen::VectorXd desired_forces_;
97  Eigen::VectorXd desired_torques_;
98  Eigen::VectorXd actual_forces_;
99  Eigen::VectorXd actual_torques_;
100 
101 public:
103  ~Multirotor();
104 
105  Eigen::Matrix<double, 6, 1> updateForcesAndTorques(Current_State x, const int act_cmds[]);
106  void set_wind(Eigen::Vector3d wind);
107 };
108 
109 } // namespace rosflight_sim
110 
111 #endif // ROSFLIGHT_SIM_MULTIROTOR_FORCES_AND_MOMENTS_H
Eigen::Matrix< double, 6, 1 > updateForcesAndTorques(Current_State x, const int act_cmds[])
struct rosflight_sim::Multirotor::Actuators actuators_


rosflight_sim
Author(s): James Jackson, Gary Ellingson, Daniel Koch
autogenerated on Wed Jul 3 2019 20:00:29