17 #ifndef ROTORS_GAZEBO_PLUGINS_FW_PARAMETERS_H_ 18 #define ROTORS_GAZEBO_PLUGINS_FW_PARAMETERS_H_ 20 #include <Eigen/Dense> 21 #include <yaml-cpp/yaml.h> 26 struct ControlSurface;
39 Eigen::Vector3d(0.1360, -0.6737, 5.4546);
41 Eigen::Vector3d(0.0195, 0.0, -0.3842);
43 Eigen::Vector3d(0.0195, 1.4205e-4, 7.5037e-6);
45 Eigen::Vector3d(0.0195, 2.7395e-4, 1.23e-5);
48 Eigen::Vector2d(0.0, -0.3073);
51 Eigen::Vector4d(0.2127, 10.8060, -46.8324, 60.6017);
53 Eigen::Vector2d(0.3304, 0.0048);
55 Eigen::Vector2d(0.3304, 0.0073);
58 Eigen::Vector2d(0.0, -0.0154);
60 Eigen::Vector2d(0.0, -0.1647);
62 Eigen::Vector2d(0.0, 0.0117);
64 Eigen::Vector2d(0.0, 0.0570);
66 Eigen::Vector2d(0.0, 0.001);
69 Eigen::Vector2d(0.0435, -2.9690);
71 Eigen::Vector2d(-0.1173, -106.1541);
73 Eigen::Vector2d(-0.1173, -6.1308);
76 Eigen::Vector2d(0.0, 0.0430);
78 Eigen::Vector2d(0.0, -0.0827);
80 Eigen::Vector2d(0.0, 0.06);
83 Eigen::Vector3d(0.0, 14.7217, 0.0);
101 const std::string& name,
106 template <
typename Derived>
108 const std::string& name,
109 Eigen::MatrixBase<Derived>& value);
112 template <
typename T>
114 const std::string& name,
118 #define READ_CONTROL_SURFACE(node, item) \ 119 YAMLReadControlSurface(node, #item, item); 120 #define READ_EIGEN_VECTOR(node, item) YAMLReadEigenVector(node, #item, item); 121 #define READ_PARAM(node, item) YAMLReadParam(node, #item, item); 124 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
181 const YAML::Node node = YAML::LoadFile(yaml_path);
217 double defl_min = kDefaultControlSurfaceDeflectionMin,
218 double defl_max = kDefaultControlSurfaceDeflectionMax)
219 : channel(cs_channel),
220 deflection_min(defl_min),
221 deflection_max(defl_max) {}
237 : wing_span(kDefaultWingSpan),
238 wing_surface(kDefaultWingSurface),
239 chord_length(kDefaultChordLength),
240 thrust_inclination(kDefaultThrustInclination),
241 throttle_channel(kDefaultThrottleChannel),
242 aileron_left(kDefaultAileronLeftChannel),
243 aileron_right(kDefaultAileronRightChannel),
244 elevator(kDefaultElevatorChannel),
245 flap(kDefaultFlapChannel),
246 rudder(kDefaultRudderChannel) {}
262 const YAML::Node node = YAML::LoadFile(yaml_path);
280 const std::string& name,
282 const YAML::Node surface_node = node[name];
286 template <
typename Derived>
288 const std::string& name,
289 Eigen::MatrixBase<Derived>& value) {
290 std::vector<typename Derived::RealScalar> vec =
291 node[name].as<std::vector<typename Derived::RealScalar>>();
292 assert(vec.size() == Derived::SizeAtCompileTime);
293 value = Eigen::Map<Derived>(&vec[0], vec.size());
296 template <
typename T>
298 const std::string& name,
300 value = node[name].as<T>();
Eigen::Vector2d c_roll_moment_p
Eigen::Vector3d c_drag_alpha
static const Eigen::Vector2d kDefaultCPitchMomentAlpha
Eigen::Vector2d c_side_force_beta
void LoadVehicleParamsYAML(const std::string &yaml_path)
void YAMLReadControlSurface(const YAML::Node &node, const std::string &name, ControlSurface &surface)
Wrapper function for extracting control surface parameters from a YAML node.
Eigen::Vector2d c_roll_moment_delta_flp
ControlSurface aileron_right
EIGEN_MAKE_ALIGNED_OPERATOR_NEW FWAerodynamicParameters()
static const Eigen::Vector4d kDefaultCLiftAlpha
static const Eigen::Vector2d kDefaultCRollMomentBeta
static constexpr double kDefaultAlphaMin
static constexpr int kDefaultElevatorChannel
void YAMLReadParam(const YAML::Node &node, const std::string &name, T &value)
This function reads a parameter from a YAML node.
static const Eigen::Vector2d kDefaultCRollMomentP
static const Eigen::Vector3d kDefaultCThrust
static constexpr int kDefaultAileronLeftChannel
Eigen::Vector3d c_drag_delta_ail
Eigen::Vector2d c_roll_moment_r
static constexpr double kDefaultControlSurfaceDeflectionMin
#define READ_CONTROL_SURFACE(node, item)
Macros to reduce copies of names.
static const Eigen::Vector3d kDefaultCDragBeta
static constexpr double kDefaultControlSurfaceDeflectionMax
static constexpr double kDefaultWingSurface
static constexpr double kDefaultThrustInclination
#define READ_PARAM(node, item)
static const Eigen::Vector3d kDefaultCDragDeltaAil
static constexpr double kDefaultChordLength
static const Eigen::Vector2d kDefaultCPitchMomentQ
static constexpr int kDefaultRudderChannel
static const Eigen::Vector2d kDefaultCRollMomentDeltaFlp
Eigen::Vector3d c_drag_beta
Eigen::Vector2d c_roll_moment_delta_ail
static constexpr double kDefaultWingSpan
Eigen::Vector2d c_pitch_moment_q
Eigen::Vector2d c_pitch_moment_delta_elv
Eigen::Vector3d c_drag_delta_flp
static const Eigen::Vector2d kDefaultCLiftDeltaAil
Eigen::Vector2d c_yaw_moment_beta
static constexpr int kDefaultAileronRightChannel
static const Eigen::Vector2d kDefaultCYawMomentR
static const Eigen::Vector2d kDefaultCPitchMomentDeltaElv
void LoadControlSurfaceNode(const YAML::Node &node)
Eigen::Vector2d c_roll_moment_beta
void LoadAeroParamsYAML(const std::string &yaml_path)
static const Eigen::Vector2d kDefaultCLiftDeltaFlp
static constexpr int kDefaultFlapChannel
static constexpr int kDefaultThrottleChannel
static const Eigen::Vector2d kDefaultCYawMomentDeltaRud
Eigen::Vector4d c_lift_alpha
Eigen::Vector2d c_lift_delta_ail
void YAMLReadEigenVector(const YAML::Node &node, const std::string &name, Eigen::MatrixBase< Derived > &value)
This function reads a vector from a YAML node and converts it into a vector of type Eigen...
static const Eigen::Vector2d kDefaultCSideForceBeta
ControlSurface aileron_left
Eigen::Vector2d c_lift_delta_flp
#define READ_EIGEN_VECTOR(node, item)
Eigen::Vector2d c_yaw_moment_delta_rud
static constexpr double kDefaultAlphaMax
double thrust_inclination
static const Eigen::Vector2d kDefaultCRollMomentDeltaAil
Eigen::Vector2d c_yaw_moment_r
static const Eigen::Vector3d kDefaultCDragAlpha
Eigen::Vector2d c_pitch_moment_alpha
static const Eigen::Vector2d kDefaultCRollMomentR
ControlSurface(int cs_channel, double defl_min=kDefaultControlSurfaceDeflectionMin, double defl_max=kDefaultControlSurfaceDeflectionMax)
static const Eigen::Vector3d kDefaultCDragDeltaFlp
static const Eigen::Vector2d kDefaultCYawMomentBeta