-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Airspeed selector follow-up #12887
Airspeed selector follow-up #12887
Conversation
f7c0748
to
9ba7418
Compare
9ba7418
to
a1cd0e5
Compare
so far only sitl and bench tested, will go testflying soon |
7a8cb3c
to
08647c9
Compare
Flight tested on standard VTOL: https://review.px4.io/plot_app?log=efbe527d-cb51-46e7-9264-ee0c0450494f I set: At 3.30min I set the stallspeed to 100, thus triggering a failure detection. The selector then switched automatically to the groundspeed minus windspeed airspeed estimate (as defined in ASPD_FALLBACK = 1). No change change in behavior noticeable to the pilot, it kept flying in position control mode with airspeed and altitude controllable separately. |
@@ -182,7 +182,7 @@ void Standard::update_vtol_state() | |||
} else if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_TO_FW) { | |||
// continue the transition to fw mode while monitoring airspeed for a final switch to fw mode | |||
if (((_params->airspeed_disabled || | |||
_airspeed->indicated_airspeed_m_s >= _params->transition_airspeed) && |
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.
@sfuhrer I think we need to check for airspeed validity here as well. I assume we can just remove the check on "_params->airspeed_disabled" and check if airspeed is finite, correct?
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.
Same holds for everywhere else in the vtol code.
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.
I've added a PX4_ISFINITE(airpseed) everywhere airspeed is used, and if it's invalid it does the same as when "_params->airspeed_disabled". I've not yet removed the parameter, not 100% if we should do so with this PR, or if that's fuel for another PR (I was also thinking about removing the CBRK_AIRSPD_CHECK, but this then needs some further thoughts.
deafc41
to
cf02894
Compare
cf02894
to
280dcad
Compare
@sfuhrer Please have a look at my last three commits. I cleaned up the airspeed usage for all three vtol types for the transition. |
910e7dd
to
b1fb8a7
Compare
@sfuhrer I also rebased on master btw. |
a8a61a6
to
63de4a0
Compare
- FW attitude controller, FW position controller and VTOL attitude controller subscribe to airspeed_validated topic - add possibility to switch off the airspeed valid checks - remove airspeed valid checks from commander - clean up of VTOL transition logic Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
…depending on number of connected sensors) but do it statically for the maximum number allowed. Check for number of connected sensors not only during start up, but always when vehicle is disarmed. Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
63de4a0
to
8e4992d
Compare
* @reboot_required true | ||
* @group Airspeed Validator | ||
*/ | ||
PARAM_DEFINE_INT32(ASPD_PRIMARY, 1); |
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.
We'll probably need to find a better way to do this later. We can't rely on the ordering being maintained in all cases.
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.
Agree. As we currently though anyway just support 1 sensor it's not yet that critical.
src/modules/commander/Commander.cpp
Outdated
@@ -578,7 +578,7 @@ Commander::Commander() : | |||
|
|||
Commander::~Commander() | |||
{ | |||
delete[] _airspeed_fault_type; | |||
|
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 can delete this entirely, then in the header set the destructor to = default
.
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.
done
&& PX4_ISFINITE(as.true_airspeed_m_s) | ||
&& (as.indicated_airspeed_m_s > 0.0f) | ||
&& !_vehicle_status.aspd_use_inhibit) { | ||
if (PX4_ISFINITE(airspeed_validated.equivalent_airspeed_m_s) |
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.
I think we should be able to drop these checks and trust our "validated airspeed".
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.
The way it works currently is that the airspeed validated is set to NAN inside the airspeed module if it is detected to be invalid (or user has disabled it by setting PRIMARY to -1). As I see it we either keep it this way and check for the finiteness of the airspeed_validated where it's used, or build in some logic in commander that sets a "airspeed_inhibited" flag in vehicle_status, or make this flag part of the airpseed_validated message (as it was at some point, but was removed because it then contains redundant information (setting it to NAN should be equal to "don't use airspeed)".
I'd vote for bringing it in as it is now.
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.
That's fine as long as every consumer ends up with the same notion of airspeed validity.
I would change the work queue thread if this is now flight critical.
This is where the controllers and estimator run. |
4b0cdae
to
9794449
Compare
Sounds reasonable, changed it. |
This needs to be included in px4_fmu-v2_default. Note for later, we should probably do something to require the airspeed selector is active and healthy at arming for FW and VTOL (preflight check). |
src/modules/commander/Commander.hpp
Outdated
@@ -285,6 +270,7 @@ class Commander : public ModuleBase<Commander>, public ModuleParams | |||
uORB::Subscription _vehicle_acceleration_sub{ORB_ID(vehicle_acceleration)}; | |||
|
|||
uORB::SubscriptionData<airspeed_s> _airspeed_sub{ORB_ID(airspeed)}; | |||
uORB::SubscriptionData<airspeed_validated_s> _airspeed_validated_sub{ORB_ID(airspeed_validated)}; |
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.
Is any of this still being used in commander?
_airspeed_sub, _airspeed_validated_sub, _airspeed_fault_declared, _time_airspeed_fault_declared
…module is safety-critical Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
…peed_validated subscription Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
b8cd03d
to
f327c9b
Compare
This PR enables the airspeed validation & selection module (#12353) by making the controllers listen to the airspeed_validated topic and no longer to the airspeed topic.
Changes:
After this gets merged, we should think about this stuff:
Fixes: #13144.