Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITL: modifications to lift in SIM_StratoBlimp #26925

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions libraries/SITL/SIM_StratoBlimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
};
Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 4 additions & 1 deletion libraries/SITL/SIM_StratoBlimp.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ class StratoBlimp : public Aircraft {
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;
Expand All @@ -78,6 +80,7 @@ class StratoBlimp : public Aircraft {
AP_Float moi_pitch;
AP_Float center_of_lift;
AP_Float center_of_drag;
AP_Float free_lift_rate;
};

}
Expand Down
Loading