mav_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_MAV_FORCES_AND_MOMENTS_H
33 #define ROSFLIGHT_SIM_MAV_FORCES_AND_MOMENTS_H
34 
35 #include <eigen3/Eigen/Core>
36 
37 namespace rosflight_sim
38 {
39 
41 protected:
42  double sat(double x, double max, double min)
43  {
44  if(x > max)
45  return max;
46  else if(x < min)
47  return min;
48  else
49  return x;
50  }
51 
52  double max(double x, double y)
53  {
54  return (x > y) ? x : y;
55  }
56 
57 public:
58 
59  struct Current_State{
60  Eigen::Vector3d pos; // Position of MAV in NED wrt initial position
61  Eigen::Matrix3d rot; // Rotation of MAV in NED wrt initial position
62  Eigen::Vector3d vel; // Body-fixed velocity of MAV wrt initial position (NED)
63  Eigen::Vector3d omega; // Body-fixed angular velocity of MAV (NED)
64  double t; // current time
65  };
66 
67  virtual Eigen::Matrix<double, 6, 1> updateForcesAndTorques(Current_State x, const int act_cmds[]) = 0;
68  virtual void set_wind(Eigen::Vector3d wind) = 0;
69 };
70 
71 } // namespace rosflight_sim
72 
73 #endif // ROSFLIGHT_SIM_MAV_FORCES_AND_MOMENTS_H
virtual void set_wind(Eigen::Vector3d wind)=0
double sat(double x, double max, double min)
virtual Eigen::Matrix< double, 6, 1 > updateForcesAndTorques(Current_State x, const int act_cmds[])=0


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