2024-04-26 05:47:28 -03:00
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
a stratospheric blimp simulator class
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "SIM_config.h"
|
|
|
|
|
|
|
|
#if AP_SIM_STRATOBLIMP_ENABLED
|
|
|
|
|
|
|
|
#include "SIM_Aircraft.h"
|
|
|
|
#include <AP_Param/AP_Param.h>
|
|
|
|
|
|
|
|
namespace SITL {
|
|
|
|
|
|
|
|
/*
|
|
|
|
a stratospheric blimp simulator
|
|
|
|
*/
|
|
|
|
|
|
|
|
class StratoBlimp : public Aircraft {
|
|
|
|
public:
|
|
|
|
StratoBlimp(const char *frame_str);
|
|
|
|
|
|
|
|
/* update model by one time step */
|
|
|
|
void update(const struct sitl_input &input) override;
|
|
|
|
|
|
|
|
/* static object creator */
|
|
|
|
static Aircraft *create(const char *frame_str) {
|
2024-05-26 22:24:16 -03:00
|
|
|
return NEW_NOTHROW StratoBlimp(frame_str);
|
2024-04-26 05:47:28 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void calculate_forces(const struct sitl_input &input, Vector3f &rot_accel, Vector3f &body_accel);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void calculate_coefficients();
|
|
|
|
void handle_motor(float throttle, float tilt, Vector3f &body_acc, Vector3f &rot_accel, float lateral_position);
|
|
|
|
void get_drag(const Vector3f &velocity_linear,
|
|
|
|
const Vector3f &velocity_rot,
|
|
|
|
float altitude,
|
|
|
|
Vector3f &drag_linear, Vector3f &drag_rotaccel);
|
|
|
|
float get_lift(float altitude);
|
|
|
|
|
|
|
|
float air_density;
|
|
|
|
float EAS2TAS;
|
|
|
|
float drag_yaw;
|
|
|
|
bool released;
|
2024-04-29 21:33:30 -03:00
|
|
|
bool helper_balloon_attached = true;
|
2024-04-26 05:47:28 -03:00
|
|
|
|
|
|
|
AP_Float mass;
|
|
|
|
AP_Float helium_mass;
|
|
|
|
AP_Float arm_length;
|
|
|
|
AP_Float motor_thrust;
|
|
|
|
AP_Float drag_fwd;
|
2024-04-29 21:33:30 -03:00
|
|
|
AP_Float drag_side;
|
2024-04-26 05:47:28 -03:00
|
|
|
AP_Float drag_up;
|
|
|
|
AP_Float altitude_target;
|
2024-04-29 21:33:30 -03:00
|
|
|
AP_Float target_climb_rate;
|
2024-04-26 05:47:28 -03:00
|
|
|
AP_Float turn_rate;
|
|
|
|
AP_Float motor_angle;
|
|
|
|
AP_Float yaw_rate_max;
|
|
|
|
AP_Float moi_roll;
|
|
|
|
AP_Float moi_yaw;
|
|
|
|
AP_Float moi_pitch;
|
|
|
|
AP_Float center_of_lift;
|
|
|
|
AP_Float center_of_drag;
|
2024-04-29 21:33:30 -03:00
|
|
|
AP_Float free_lift_rate;
|
2024-04-26 05:47:28 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // AP_SIM_STRATOBLIMP_ENABLED
|