SITL: modifications to lift in SIM_StratoBlimp (#3)

* Update SIM_StratoBlimp.cpp

* Update SIM_StratoBlimp.h
This commit is contained in:
Daniel Field 2024-04-30 10:33:30 +10:00 committed by Peter Barker
parent c08d982c0c
commit 33892aa049
2 changed files with 28 additions and 14 deletions

View File

@ -60,10 +60,15 @@ const AP_Param::GroupInfo StratoBlimp::var_info[] = {
// @Description: drag on X axis
AP_GROUPINFO("DRAG_FWD", 5, StratoBlimp, drag_fwd, 0.27),
// @Param: DRAG_SIDE
// @DisplayName: drag in sidewards direction
// @Description: drag on Y axis
AP_GROUPINFO("DRAG_SIDE", 16, StratoBlimp, drag_side, 0.5),
// @Param: DRAG_UP
// @DisplayName: drag in upward direction
// @Description: drag on Z axis
AP_GROUPINFO("DRAG_UP", 6, StratoBlimp, drag_up, 0.1),
AP_GROUPINFO("DRAG_UP", 6, StratoBlimp, drag_up, 0.4),
// @Param: MOI_YAW
// @DisplayName: moment of inertia in yaw
@ -87,10 +92,10 @@ const AP_Param::GroupInfo StratoBlimp::var_info[] = {
AP_GROUPINFO("ALT_TARG", 10, StratoBlimp, altitude_target, 20000),
// @Param: CLMB_RT
// @DisplayName: climb rate
// @Description: climb rate
// @DisplayName: target climb rate
// @Description: target climb rate
// @Units: m/s
AP_GROUPINFO("CLMB_RT", 11, StratoBlimp, climb_rate, 5),
AP_GROUPINFO("CLMB_RT", 11, StratoBlimp, target_climb_rate, 5),
// @Param: YAW_RT
// @DisplayName: yaw rate
@ -114,7 +119,12 @@ const AP_Param::GroupInfo StratoBlimp::var_info[] = {
// @DisplayName: weathervaning offset
// @Description: center of drag for weathervaning
// @Units: m
AP_GROUPINFO("WVANE", 15, StratoBlimp, center_of_drag, 2),
AP_GROUPINFO("WVANE", 15, StratoBlimp, center_of_drag, 0.3),
// @Param: FLR
// @DisplayName: free lift rate
// @Description: amount of additional lift generated by the helper balloon (for the purpose of ascent), as a proportion of the 'neutral buoyancy' lift
AP_GROUPINFO("FLR", 17, StratoBlimp, free_lift_rate, 0.12),
AP_GROUPEND
};
@ -201,14 +211,15 @@ float StratoBlimp::get_lift(float altitude)
// start with neutral buoyancy
float lift_accel = GRAVITY_MSS;
// assume lift will equal drag at the given climb rate
float climb_accel = 0.5 * air_density * sq(climb_rate) * drag_up;
// ramp down lift as we approach target alt
lift_accel += linear_interpolate(climb_accel, 0,
altitude,
altitude_target-1000, altitude_target);
// add lift from helper balloon if still attached
if (helper_balloon_attached) {
// helper balloon additional lift amount based on Free Lift Ratio
lift_accel += GRAVITY_MSS*free_lift_rate;
// detach helper balloon if the target altitude has been reached
if (altitude >= altitude_target) {
helper_balloon_attached = false;
}
}
return mass * lift_accel;
}

View File

@ -61,15 +61,17 @@ private:
float EAS2TAS;
float drag_yaw;
bool released;
bool helper_balloon_attached = true;
AP_Float mass;
AP_Float helium_mass;
AP_Float arm_length;
AP_Float motor_thrust;
AP_Float drag_fwd;
AP_Float drag_side;
AP_Float drag_up;
AP_Float altitude_target;
AP_Float climb_rate;
AP_Float target_climb_rate;
AP_Float turn_rate;
AP_Float motor_angle;
AP_Float yaw_rate_max;
@ -78,6 +80,7 @@ private:
AP_Float moi_pitch;
AP_Float center_of_lift;
AP_Float center_of_drag;
AP_Float free_lift_rate;
};
}