|
|
|
@ -88,7 +88,7 @@ const AP_Param::GroupInfo RangeFinder::var_info[] = {
@@ -88,7 +88,7 @@ const AP_Param::GroupInfo RangeFinder::var_info[] = {
|
|
|
|
|
|
|
|
|
|
// @Group: 4_
|
|
|
|
|
// @Path: AP_RangeFinder_Wasp.cpp
|
|
|
|
|
AP_SUBGROUPVARPTR(drivers[0], "4_", 60, RangeFinder, backend_var_info[3]), |
|
|
|
|
AP_SUBGROUPVARPTR(drivers[3], "4_", 60, RangeFinder, backend_var_info[3]), |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if RANGEFINDER_MAX_INSTANCES > 4 |
|
|
|
@ -556,16 +556,23 @@ bool RangeFinder::has_orientation(enum Rotation orientation) const
@@ -556,16 +556,23 @@ bool RangeFinder::has_orientation(enum Rotation orientation) const
|
|
|
|
|
// find first range finder instance with the specified orientation
|
|
|
|
|
AP_RangeFinder_Backend *RangeFinder::find_instance(enum Rotation orientation) const |
|
|
|
|
{ |
|
|
|
|
// first try for a rangefinder that is in range
|
|
|
|
|
for (uint8_t i=0; i<num_instances; i++) { |
|
|
|
|
AP_RangeFinder_Backend *backend = get_backend(i); |
|
|
|
|
if (backend == nullptr) { |
|
|
|
|
continue; |
|
|
|
|
if (backend != nullptr && |
|
|
|
|
backend->orientation() == orientation && |
|
|
|
|
backend->status() == RangeFinder_Good) { |
|
|
|
|
return backend; |
|
|
|
|
} |
|
|
|
|
if (backend->orientation() != orientation) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// if none in range then return first with correct orientation
|
|
|
|
|
for (uint8_t i=0; i<num_instances; i++) { |
|
|
|
|
AP_RangeFinder_Backend *backend = get_backend(i); |
|
|
|
|
if (backend != nullptr && |
|
|
|
|
backend->orientation() == orientation) { |
|
|
|
|
return backend; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -676,8 +683,7 @@ void RangeFinder::Log_RFND()
@@ -676,8 +683,7 @@ void RangeFinder::Log_RFND()
|
|
|
|
|
if (s == nullptr) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (i == 0) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
const struct log_RFND pkt = { |
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_RFND_MSG), |
|
|
|
|
time_us : AP_HAL::micros64(), |
|
|
|
@ -688,19 +694,6 @@ void RangeFinder::Log_RFND()
@@ -688,19 +694,6 @@ void RangeFinder::Log_RFND()
|
|
|
|
|
}; |
|
|
|
|
AP::logger().WriteBlock(&pkt, sizeof(pkt)); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
const struct log_RFND pkt2 = { |
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_RFND2_MSG), |
|
|
|
|
time_us : AP_HAL::micros64(), |
|
|
|
|
instance : i, |
|
|
|
|
dist : s->distance_cm(), |
|
|
|
|
status : (uint8_t)s->status(), |
|
|
|
|
orient : s->orientation(), |
|
|
|
|
}; |
|
|
|
|
AP::logger().WriteBlock(&pkt2, sizeof(pkt2)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool RangeFinder::prearm_healthy(char *failure_msg, const uint8_t failure_msg_len) const |
|
|
|
|