-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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_Arming: Allow arming when forcing DCM and no GPS configured #29012
base: master
Are you sure you want to change the base?
AP_Arming: Allow arming when forcing DCM and no GPS configured #29012
Conversation
I think I would argue that having home is so fundamental to the way AP works that trying to fly without it is going to cause lots of unusual issues. All of planes altitude handling is relative to home for example. If we did want to make the decision to allow flying without home we would need to update all the modes than need it to refuse entry. So you would not even be allowed to enter RTL for example. |
Yea, if we could refuse entry, it would prevent the flyaway risk if we allow our users to fly without home/gps. Similar to Copter's current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'd also need some changes in Plane::calc_speed_scaler() and some failsafe checking
I also think you will find situations where the attitude goes badly off, really does need an airspeed estimate based on drag+throttle
3a6ecb3
to
a327d34
Compare
ArduPlane/system.cpp
Outdated
@@ -286,6 +286,12 @@ bool Plane::set_mode(Mode &new_mode, const ModeReason reason) | |||
return false; | |||
} | |||
|
|||
if (new_mode.requires_home() && | |||
!ahrs.home_is_set()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I need to use quadplane.ahrs
in the condition, or is this sufficient? AHRS is a singleton, so I am not really sure why it would matter which one you used.
I've rescoped just to cover no-home (instead of no-gps no-airspeed) to make it a smaller scope change. inverse TECS and improving no-airspeed no-gps airspeed scaling can come later. This now includes mode change rejection. Additionally, you can now arm without home set in modes that don't require home if you set AHRS_OPTIONS bit 3. The method to do mode rejection was copied from Copter Because |
@@ -636,7 +636,8 @@ bool AP_Arming::gps_checks(bool report) | |||
} | |||
} | |||
|
|||
if (!AP::ahrs().home_is_set()) { | |||
// Plane uses an option to allow users to fly without a home. | |||
if (!AP::ahrs().allows_arming_without_home() && !AP::ahrs().home_is_set()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should move this check to the vehicle. On plane, I would like should check whether our current mode requires home. If it does, and we don't have a home yet, arming should be blocked.
In chat with Randy:
- In copter, you can switch modes while disarmed. AUTO missions should start execution, but not make progress till you arm.
- AHRS home is the RTL point, position estimate is from EKF origin. It should be safe to treat having a home and having an ekf origin as the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* AHRS home is the RTL point, position estimate is from EKF origin. It should be safe to treat having a home and having an ekf origin as the same.
... or, you know, you could check to see if you have a navigation origin instead....
If your failsafes include "RTL", then you might go further and require home to be set then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying we might want to add two methods to the mode class to prevent mode entry:
- The one I currently have of
requires_home
, which usesAP_AHRS::home_is_set()
- Another of
requires_navigation_origin
, which usesAP_AHRS::get_origin()
I agree that some of the modes only need the navigation origin, and I'm happy to add that to that check to mode entry if we are ok with the flash.
a327d34
to
da40b24
Compare
ArduPlane/mode.h
Outdated
@@ -837,6 +879,8 @@ class ModeTakeoff: public Mode | |||
|
|||
bool does_auto_throttle() const override { return true; } | |||
|
|||
bool requires_home() const override { return true; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does TAKEOFF mode need home? This is an example question applicable to other modes you've marked as "true".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TAKEOFF surprised me. When I tested it, the plane did not take off without home. It just sits armed on the runway drawing 0A.
This is because takeoff mode relies on having home here in the update()
call:
ardupilot/ArduPlane/mode_takeoff.cpp
Line 74 in 20c77ae
if (!(plane.current_loc.initialised() && AP::ahrs().home_is_set())) { |
It would be nice if Takeoff could just climb to the altitude using baro alt above arm height, but that doesn't work yet. Happy to change that in a future PR.
I need to test each of the Q* modes; they are all biased to requiring home right now till I confirm they are safe without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, bad example; TAKEOFF is home-relative, so that one makes sense :-)
@@ -636,7 +636,8 @@ bool AP_Arming::gps_checks(bool report) | |||
} | |||
} | |||
|
|||
if (!AP::ahrs().home_is_set()) { | |||
// Plane uses an option to allow users to fly without a home. | |||
if (!AP::ahrs().allows_arming_without_home() && !AP::ahrs().home_is_set()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* AHRS home is the RTL point, position estimate is from EKF origin. It should be safe to treat having a home and having an ekf origin as the same.
... or, you know, you could check to see if you have a navigation origin instead....
If your failsafes include "RTL", then you might go further and require home to be set then.
* If we force AP to use DCM, and disable all GPS's, we never expect a home location unless a user uses the GCS to arm * Allow users to arm DCM with all pre-arm checks enabled in this special case * This allows using AP as a simple stabilizer (FBWA) on plane GPS), they can now arm * Existing behavior isn't changed because it's gated by an option bit Signed-off-by: Ryan Friedman <[email protected]>
da40b24
to
3e64ee5
Compare
I attempted an AP_Airspeed backend for synthetic airspeed. For the throttle effect on airspeed, I wanted to use the plane parameters Branch: https://github.com/Ryanf55/ardupilot/tree/airspeed-synthetic |
Purpose
If I do not have a GPS and don't use "Set Home Here” in mission planner because I'm just flying FPV without a GCS, I want to be able to keep all arming checks enabled. This is for running AP as a simple stabilizer (FBWA) with minimal peripherals.
I never expect a home location, and do NOT expect AUTO, RTL, and other GPS-reliant modes to be allowed.
Seems like having a home location is merely a convenience for the GCS, and I shouldn't rely on global position or local position if I only fly in FBWA and ACRO, so why do we make it required?
Approach
This PR introduces mode transition rejection into Plane based on needing a home. I have re-used the mode rejection from Copter, modeled after
ArduCopter/Mode::requires_GPS()
. Mode changes in plane can now be rejected, but only while armed.While disarmed, like Copter, you can change to any mode, but arming checks in Plane now check whether your mode requires a home. If home is not set, you can't arm.
Note - without changes to the EKF, I recommend using DCM to fly without any position aiding. It won't fly as well.
Wiki
This change will allow this wiki to be complete: ArduPilot/ardupilot_wiki#6508
Details
Testing performed
This sets up a no-gps plane that is locked to DCM, and then demonstrates we can now arm.
If you cause an RC failsafe, then you see it will stay in circle, instead of have a flyaway in RTL. This is because the short failsafe is circle, and the long failsafe is RTL. I assert this is an improvement to not fly to 0, 0.
To discuss
Follow up
Improve mode transitions to cope with some modes not having a home, such as RTL long action should go to GLIDE rather than stay in circle.