-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
introduce uORB::SubscriptionBlocking and use in navigator and simulator #12371
Conversation
0f9e282
to
f9be191
Compare
One point to discuss is the desired timeout behavior. There might be exceptions that I haven't come across, but in our orb related poll usage there's a timeout that does nothing but a fresh poll setup. So the question is if we need to preserve the ability to do anything else on a timeout, and if that timeout even needs to configurable. |
@AuterionWrikeBot keeps helpfully clobbering the formatting in my example. |
df3e449
to
e6787e7
Compare
Out of flash on fmu-v2 again. |
@dagar ok what do you need me to do here? Review or do we need to disable something else for v2? |
I'll ping you again once it's been resolved. |
e6787e7
to
440d307
Compare
0e0773f
to
0c401f7
Compare
e6fde64
to
e059b39
Compare
e059b39
to
42c17eb
Compare
Updated LPE to kill off uORB::SubscriptionPollable entirely. |
42c17eb
to
d403620
Compare
if (poll_return < 0) { | ||
PX4_ERR("poll error %d %d", poll_return, errno); | ||
// wait for new data on the local position state topic | ||
if (!_local_pos_sub.updateBlocking(_local_pos)) { |
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.
With the previous implementation we still ran this loop on timeout, with the new one we're just continuing, right? Do we know the implications?
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.
Partially, but we need to be careful and think it through module by module. In the past for mc_pos_control this was important for stabilized/manual mode, but that's been moved.
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.
@MaEtUgR could you check?
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.
This is solved in a different way now right? https://github.com/PX4/Firmware/blob/f956bafa4eda7ceb298790ef0fff5540fd3c589f/src/modules/mc_pos_control/mc_pos_control_main.cpp#L535
I think it's much better to run the controller up on new estimation data but we need to make sure there's instant and reliable emergency handling in case of a timeout. Last resort the attitude controller should keep the vehicle stable level if attitude setpoints are missing.
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.
Yes it will need to be updated, although that entire topic needs to be reviewed. Commander and mc_pos_control have separate notions of position and velocity validity.
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.
Actually, mc_pos_control was pulled out of this PR (moved to a WQ).
int ret_mutex_init = pthread_mutex_init(&_mutex, &attr); | ||
{ | ||
PX4_ERR("pthread_mutex_init failed, status=%d", ret_mutex_init); | ||
} |
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 pthread_mutexattr_destroy
is missing here.
// otherwise wait with timeout based on interval | ||
struct timespec ts; | ||
|
||
if (px4_clock_gettime(CLOCK_REALTIME, &ts) != 0) { |
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.
Shouldn't this be based on the monotonic clock?
And then we need to set pthread_condattr_setclock (&cond_attr, CLOCK_MONOTONIC)
but that's probably only possible on Posix but not NuttX.
https://github.com/PX4/Firmware/blob/07d656e971a72d1202651dfd3b4642736fb078d7/platforms/posix/src/px4/common/px4_sem.cpp#L65
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.
CLOCK_MONOTONIC is available on NuttX, but needs to be added to several boards. Trying it 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.
CLOCK_MONOTONIC hangs pthread_cond_timedwait, which appears to use CLOCK_REALTIME internally.
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.
Right but can we use it for Posix then?
eb1cdc6
to
790cd1f
Compare
The estimators (attq and lpe) might as well transition straight to a WQ with callbacks. #13287 |
790cd1f
to
4dcd9c2
Compare
Moving camera_feedback to a WQ. #13044 |
4dcd9c2
to
94d091f
Compare
94d091f
to
50f89bc
Compare
50f89bc
to
f85f314
Compare
I'm going to merge |
This PR introduces a new uORB Subscription class that has a blocking update. This can be used in place of the traditional orb subscriptions and polling.
Also contained in this PR are the other minor uORB changes needed for logger. #12123
Example
Existing orb + poll usage
Simplifies to this (using PR)