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

AP_Motors: Heli: Fix SWSH logging for reversed collectives #27234

Merged
merged 2 commits into from
Jun 9, 2024
Merged
Changes from 1 commit
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
11 changes: 6 additions & 5 deletions libraries/AP_Motors/AP_MotorsHeli_Swash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,17 @@ void AP_MotorsHeli_Swash::add_servo_raw(uint8_t num, float roll, float pitch, fl
// calculates servo output
void AP_MotorsHeli_Swash::calculate(float roll, float pitch, float collective)
{
// Collective control direction. Swash moves up for negative collective pitch, down for positive collective pitch
if (_collective_direction == COLLECTIVE_DIRECTION_REVERSED){
collective = 1 - collective;
}

// Store inputs for logging
// Store inputs for logging, store col before col reversal to ensure logging comes out with the correct sign (+/-)
_roll_input = roll;
_pitch_input = pitch;
_collective_input_scaled = collective;

// Collective control direction. Swash moves up for negative collective pitch, down for positive collective pitch
if (_collective_direction == COLLECTIVE_DIRECTION_REVERSED){
bnsgeyer marked this conversation as resolved.
Show resolved Hide resolved
collective = 1 - collective;
}

for (uint8_t i = 0; i < _max_num_servos; i++) {
if (!_enabled[i]) {
// This servo is not enabled
Expand Down
Loading