Skip to content

Sub: allow SURFACE mode to work with no altitude data #29996

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

Merged
merged 3 commits into from
May 27, 2025

Conversation

Williangalvani
Copy link
Contributor

This fixes an issue where SURFACE mode doesn't work on vehicles with no baros for altitude sensor.

@Hwurzburg
Copy link
Contributor

LGTM...sims fine...did not think you would want to get rid of requires GPS in the mode....if you are happy, I am happy

@@ -95,8 +95,8 @@ bool Sub::set_mode(Mode::Number mode, ModeReason reason)

// check for valid altitude if old mode did not require it but new one does
// we only want to stop changing modes if it could make things worse
if (flightmode->has_manual_throttle() &&
Copy link
Contributor

Choose a reason for hiding this comment

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

this rename makes it inconsistent with Copter. That's not necessarily a blocker but as we try to move vehicles closer to each other, let's try not to move in the opposite direction unless it's really necessary

Copy link
Contributor Author

@Williangalvani Williangalvani May 7, 2025

Choose a reason for hiding this comment

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

initially I had just created a new requires_altitude, which is what ardusub actually wants to know.
but that made has_manual_throttle unused, which is why the PR ended up like this.

I'm quite set on making the code "make sense" for someone reading (which means using the new name). but I don't mind keeping has_manual_throttle() for compatibility. Note that for surface mode, these are not equivalent.

@rmackay9
Copy link
Contributor

rmackay9 commented May 7, 2025

It's really great to see this!

I'm not the Sub maintainer so please take my comments with a grain of salt. I'm just being as pedantic as I would be if the code were Copter or Rover.

Copy link
Contributor

@rmackay9 rmackay9 left a comment

Choose a reason for hiding this comment

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

looks fine, thanks!

@tridge tridge merged commit 7c0f01b into ArduPilot:master May 27, 2025
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants