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

Implement assisted autorotation for Heli’s #22871

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
99adf3e
AC_Autorotation: Assisted Autorotation Implementation
Ferruccio1984 Mar 24, 2022
18df15c
Copter: Assisted Autorotation Implementation
Ferruccio1984 Mar 24, 2022
9147f2f
AP_Motors: Support for Assisted Autorotation
Ferruccio1984 Aug 29, 2023
9b09716
AC_Autorotation: fix error for autotest
bnsgeyer Dec 23, 2023
4c9e076
AC_Autorotation: fix parameter naming
bnsgeyer Dec 23, 2023
e31ea19
Copter: fix style on mode_autorotate.cpp
bnsgeyer Dec 24, 2023
4053ff8
AC_Autorotation: fix style on AC_Autorotation.cpp
bnsgeyer Dec 24, 2023
079c189
Heli: Simplify passing rangefinder measurement to autorotation
MattKear Jan 4, 2024
321bb44
AP_Motors_Heli: Add helper to get hover col angle
MattKear Jan 4, 2024
9dcec13
AC_Autorotation: Create Init function and directly access AP_Motors_H…
MattKear Jan 4, 2024
006a3b6
Copter: Pass motors ptr to autorotation object
MattKear Jan 4, 2024
3959534
Copter: Remove now unused function calls to Autorotate object
MattKear Jan 4, 2024
e7887eb
AC_Autorotation: White space changes and minor formatting
MattKear Jan 4, 2024
a9e2c26
AC_Autorotation: Fix and rename average z accel function
MattKear Jan 4, 2024
ed8d1aa
Copter: Update average z accel function name in autorotation
MattKear Jan 4, 2024
6cfd4bb
AC_Autorotation: tidy up logging
MattKear Jan 4, 2024
aa3d54a
AC_Autorotation: Consolidate controller inits
MattKear Jan 4, 2024
af175b9
Copter: Autorotation: Consolidate controller inits
MattKear Jan 4, 2024
4ce4e2c
AC_Autorotation
Ferruccio1984 Jan 20, 2024
5549244
AC_Autorotation: update name of altitude estimation function
Ferruccio1984 Jan 23, 2024
1aba9ad
AC_Autorotation: squared gravitational acc const
Ferruccio1984 Jan 23, 2024
b61eee3
AC_Autorotation: remove array zeroing of sink rate derivative
Ferruccio1984 Jan 23, 2024
b2fe6a3
Copter: move time_to_impact to local float
bnsgeyer Jan 27, 2024
ee2dff7
Copter: Autorotation mode: simplify time_to_impact
MattKear Jan 25, 2024
71c92af
AC_Autorotation: Tidy up time to impact calculation
MattKear Jan 25, 2024
651e3f7
AC_Autorotation: Add helper functions to move phase init functionaili…
MattKear Jan 25, 2024
9aece05
Copter: autorotation mode: Move phase init functions down into autoro…
MattKear Jan 25, 2024
e314f5c
Copter: autorotation mode: remove unused variables
MattKear Jan 25, 2024
e3fa52d
Copter: autorotation mode: simplify hover autorotation check
MattKear Jan 25, 2024
26659ad
Copter: Autorotation Mode: rename get_flare_status to is_flare_comple…
MattKear Jan 28, 2024
93ddcc4
AC_Autorotation: Rename get_flare_status to is_flare_complete to impr…
MattKear Jan 28, 2024
e153490
AC_Autorotation: Add flare height helper
MattKear Feb 6, 2024
ea61936
Copter: remove land detector in mode autorotate and fix for disarm delay
Ferruccio1984 Jan 29, 2024
afff5a1
AC_Autorotation: add touchdown complete check and subsequent lowering…
Ferruccio1984 Jan 29, 2024
0887aff
AC_Autorotation: Remove touch down complete bool and just use the tim…
MattKear Feb 6, 2024
ee06b79
AC_Autorotation: Let copter do all of the height above ground estimat…
MattKear Feb 6, 2024
9214267
Copter: Use copters inertial navigation interpolation of the rangefin…
MattKear Feb 6, 2024
c2b8589
Copter: Autorotation Mode: Make the hover autorotation it's own fligh…
MattKear Feb 6, 2024
ee7b895
AC_Autorotation: Add helpers for state machine logic tidy up and remo…
MattKear Feb 6, 2024
a42288d
Copter: Autorotation Mode: Rework logic machine to make it easier to …
MattKear Feb 6, 2024
29c2d35
AC_Autorotation: Make param defaults numeric values if the defines ar…
MattKear Feb 6, 2024
ad64639
AC_Autorotation: Added Comments and whitespace fixups
MattKear Feb 6, 2024
f101a21
AC_Autorotation: Fix data type for time_on_ground
MattKear Feb 6, 2024
61c6e60
Copter: Autorotation Mode: Whitespace changes, comments updated, and …
MattKear Feb 6, 2024
0798ca6
Copter: Autorotation Mode: Use standard earth_to_body2D velocity rota…
MattKear Feb 7, 2024
ba3fbaf
AC_Autorotation: Add options param and give roll-yaw control scheme o…
MattKear Feb 7, 2024
a1b0725
Copter: Autorotation mode: Make control schemes for roll and yaw opti…
MattKear Feb 7, 2024
3384684
AC_Autorotation: Remove sink derivative and only use filtered accel.
MattKear Feb 7, 2024
64829ac
Copter: Autorotation Mode: Remove calls to update derive sink rate
MattKear Feb 7, 2024
72553f7
Copter: Autorotation mode: Simplify rpm warning message code structur…
MattKear Feb 7, 2024
7fddf29
Copter: Autorotation Mode: Update comments and white space change
MattKear Feb 7, 2024
bbebd62
AC_Autorotation: update comments
MattKear Feb 7, 2024
a895d15
AC_Autorotation: Remove unused variables
MattKear Feb 7, 2024
aaee063
AC_Autorotation: fix options param index
MattKear Feb 14, 2024
9e110c9
Copter: Always update the ground distance in the autorotation library…
MattKear Feb 14, 2024
7fd07b4
AP_Motors: Heli: Add helper to calculated norm collective from a giv…
MattKear Feb 14, 2024
533e202
AC_Autorotation: Simplify bad RPM handling, leaving to RPM lib to det…
MattKear Feb 14, 2024
6547e24
Copter: Autorotation mode: remove bad rpm handling
MattKear Feb 14, 2024
6f3eff1
AP_Motors: temporary fix to prevent I-term decay during autorotations
Ferruccio1984 Feb 16, 2024
2cde571
AP_Motors: return collective land position
Ferruccio1984 Feb 16, 2024
241959e
AC_Autorotation: fix for post touchdown disarming
Ferruccio1984 Feb 16, 2024
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
33 changes: 22 additions & 11 deletions libraries/AC_Autorotation/AC_Autorotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ void AC_Autorotation::init(AP_MotorsHeli* motors, float gnd_clear) {
// Store the ground clearance on the lidar sensor for use in touch down calculations
_ground_clearance = gnd_clear;

// reset on ground timer
_time_on_ground = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ms?


// initialize radar altitude estimator
init_est_rangefinder_alt();
}
Expand Down Expand Up @@ -423,10 +426,9 @@ void AC_Autorotation::initial_flare_estimate(void)
float des_spd_fwd = _param_target_speed * 0.01f;
calc_flare_alt(-_est_rod, des_spd_fwd);

// Initialize sink rate monitor and flare/touchdown bools
// Initialize sink rate monitor and flare bools
_flare_complete = false;
_flare_update_check = false;
_touchdown_complete = false;
_avg_sink_deriv = 0.0f;
_avg_sink_deriv_sum = 0.0f;
_index_sink_rate = 0;
Expand Down Expand Up @@ -696,19 +698,28 @@ void AC_Autorotation::touchdown_controller(void)
// Update forward speed for logging
_speed_forward = calc_speed_forward(); // (cm/s)

_collective_out = constrain_value((_p_coll_tch.get_p(_desired_sink_rate - _current_sink_rate))*0.01f + _ff_term_hs, 0.0f, 1.0f);
col_trim_lpf.set_cutoff_frequency(_col_cutoff_freq);
_ff_term_hs = col_trim_lpf.apply(_collective_out, _dt);
if(_current_sink_rate < 10.0 && _radar_alt<=_ground_clearance && !_touchdown_complete){
// Check to see if we think the aircraft is on the ground
if(_current_sink_rate < 10.0 && _radar_alt<=_ground_clearance && _time_on_ground == 0){
_time_on_ground = AP_HAL::millis();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could const uint32_t now = AP_HAL::millis(); Its used again on 673

_touchdown_complete = true;
}
float now = AP_HAL::millis();
if((now - _time_on_ground) > MIN_TIME_ON_GROUND && _touchdown_complete){
//on ground, collective can be bottomed now
_collective_out = 0;

// Use a timer to get confidence that the aircraft is on the ground.
// Note: The landing detector uses the zero thust collective as an indicator for being on the ground. The touch down controller will have
// driven the collective high to cushion the landing so the landing detector will not trip until we drive the collective back to zero thrust and below.
if ((_time_on_ground > 0) && ((AP_HAL::millis() - _time_on_ground) > MIN_TIME_ON_GROUND)) {
// On ground, smoothly lower collective to just bellow zero thrust, to make sure we trip the landing detector
float desired_col = _motors_heli->get_coll_mid() * 0.95;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs changed to use H_COL_LAND_MIN instead of zero thrust collective, since the landing detector looks for "motors->get_below_land_min_coll()"

_collective_out = _collective_out*0.9 + desired_col*0.1;

} else {
_collective_out = constrain_value((_p_coll_tch.get_p(_desired_sink_rate - _current_sink_rate))*0.01f + _ff_term_hs, 0.0f, 1.0f);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_collective_out = constrain_value((_p_coll_tch.get_p(_desired_sink_rate - _current_sink_rate))*0.01f + _ff_term_hs, 0.0f, 1.0f);
_collective_out = constrain_float((_p_coll_tch.get_p(_desired_sink_rate - _current_sink_rate))*0.01f + _ff_term_hs, 0.0f, 1.0f);

col_trim_lpf.set_cutoff_frequency(_col_cutoff_freq);
_ff_term_hs = col_trim_lpf.apply(_collective_out, _dt);
}

set_collective(HS_CONTROLLER_COLLECTIVE_CUTOFF_FREQ);

// Smoothly scale the pitch target back to zero (level)
_pitch_target *= 0.95f;
}

Expand Down
1 change: 0 additions & 1 deletion libraries/AC_Autorotation/AC_Autorotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ class AC_Autorotation
bool _flare_complete; // Flare completed
bool _flare_update_check; // Check for flare altitude updating
float _time_on_ground; // Time elapsed after touch down
bool _touchdown_complete; // Touchdown completed check

LowPassFilterFloat _accel_target_filter; // acceleration target filter

Expand Down