-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
Add AP_Periph support for Proximity sensors #21822
Conversation
Tested with 3 Cygbot connected to 3 Matek L431 and ARKFlow on Cube Orange = Logs are available |
1a0aa47
to
1efd687
Compare
afae7cb
to
2ada4ae
Compare
6e24039
to
4590caf
Compare
} | ||
} | ||
|
||
// update Object Avoidance database with Earth-frame point | ||
// pitch can be optionally provided if needed | ||
void AP_Proximity_Backend::database_push(float angle, float pitch, float distance, uint32_t timestamp_ms, const Vector3f ¤t_pos, const Matrix3f &body_to_ned) | ||
{ | ||
|
||
#if !APM_BUILD_TYPE(APM_BUILD_AP_Periph) |
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.
#if !APM_BUILD_TYPE(APM_BUILD_AP_Periph) | |
#if AP_OADATABASE_ENABLED |
and all related changes
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.
If it's okay I would like to do this as another PR to not increase the scope of this one
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.
should be in build_options.py
Tools/AP_Periph/can.cpp
Outdated
static uint32_t last_probe_ms; | ||
if (now - last_probe_ms >= 1000) { | ||
last_probe_ms = now; | ||
proximity.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.
how long does init() take? could stall other tasks on the main thread
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.
Init takes about 400-500 microseconds on my L431, depending on the sensor selected
|
||
if (is_zero(prx.params[i].max_m) && is_zero(prx.params[i].min_m)) { | ||
// GCS reporting will be incorrect if min/max are not set | ||
gcs().send_text(MAV_SEVERITY_CRITICAL, "Configure PRX%u_MIN and PRX%u_MAX", |
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 suppose this message is unlikely to be seen. An alternative would be to make it appear when prearm_healthy() is called somehow. This is a bit optional though.
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 agree, but I think I will do this as part of another PR perhaps
I've added some comments mostly around naming (as per usual) but in any case, this looks pretty good to me. |
56e1cb9
to
f2d4920
Compare
I think the build_options.py bit needs to be done in another PR. We haven't listed any Proximity devices in that script |
f2d4920
to
a12799d
Compare
PR autotest fails because of bug solved here: dronecan/DSDL#19 |
0dc8225
to
e23b3fd
Compare
5ec551a
to
bf23e9a
Compare
bf23e9a
to
b888112
Compare
This needs: dronecan/DSDL#15 to be merged first