Line data Source code
1 : /* 2 : This program is free software: you can redistribute it and/or modify 3 : it under the terms of the GNU General Public License as published by 4 : the Free Software Foundation, either version 3 of the License, or 5 : (at your option) any later version. 6 : 7 : This program is distributed in the hope that it will be useful, 8 : but WITHOUT ANY WARRANTY; without even the implied warranty of 9 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 : GNU General Public License for more details. 11 : 12 : You should have received a copy of the GNU General Public License 13 : along with this program. If not, see <http://www.gnu.org/licenses/>. 14 : */ 15 : /* 16 : a stratospheric blimp simulator class 17 : */ 18 : 19 : #pragma once 20 : 21 : #include "SIM_config.h" 22 : 23 : #if AP_SIM_STRATOBLIMP_ENABLED 24 : 25 : #include "SIM_Aircraft.h" 26 : #include <AP_Param/AP_Param.h> 27 : 28 : namespace SITL { 29 : 30 : /* 31 : a stratospheric blimp simulator 32 : */ 33 : 34 : class StratoBlimp : public Aircraft { 35 : public: 36 : StratoBlimp(const char *frame_str); 37 : 38 : /* update model by one time step */ 39 : void update(const struct sitl_input &input) override; 40 : 41 : /* static object creator */ 42 0 : static Aircraft *create(const char *frame_str) { 43 0 : return NEW_NOTHROW StratoBlimp(frame_str); 44 : } 45 : 46 : static const struct AP_Param::GroupInfo var_info[]; 47 : 48 : protected: 49 : void calculate_forces(const struct sitl_input &input, Vector3f &rot_accel, Vector3f &body_accel); 50 : 51 : private: 52 : void calculate_coefficients(); 53 : void handle_motor(float throttle, float tilt, Vector3f &body_acc, Vector3f &rot_accel, float lateral_position); 54 : void get_drag(const Vector3f &velocity_linear, 55 : const Vector3f &velocity_rot, 56 : float altitude, 57 : Vector3f &drag_linear, Vector3f &drag_rotaccel); 58 : float get_lift(float altitude); 59 : 60 : float drag_yaw; 61 : bool released; 62 : bool helper_balloon_attached = true; 63 : 64 : AP_Float mass; 65 : AP_Float helium_mass; 66 : AP_Float arm_length; 67 : AP_Float motor_thrust; 68 : AP_Float drag_fwd; 69 : AP_Float drag_side; 70 : AP_Float drag_up; 71 : AP_Float altitude_target; 72 : AP_Float target_climb_rate; 73 : AP_Float turn_rate; 74 : AP_Float motor_angle; 75 : AP_Float yaw_rate_max; 76 : AP_Float moi_roll; 77 : AP_Float moi_yaw; 78 : AP_Float moi_pitch; 79 : AP_Float center_of_lift; 80 : AP_Float center_of_drag; 81 : AP_Float free_lift_rate; 82 : }; 83 : 84 : } 85 : 86 : #endif // AP_SIM_STRATOBLIMP_ENABLED