mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 08:40:30 +08:00
feat(afbrs50): static rate/DFM profiles, pipeline hardening, range offset calibration (#28454)
* feat(afbrs50): static rate/DFM profiles, pipeline hardening, range offset calibration The distance-based short/long range switching only re-evaluates after a valid measurement, so once the target leaves the range the driver latches short-range mode and the sensor stays blind; frames that fail evaluation were never published, leaving consumers on the stale last value. Flight characterization of the LV85D and LX85D showed frame rate is the dominant range knob and DFM 4X beats the mode-default 8X on validity, spread and wrong-window returns at every rate, so the switching is replaced by SENS_AFBR_RATE / SENS_AFBR_DFM / SENS_AFBR_PROF with per-module defaults, SENS_AFBR_MODE gains Auto (module default) with fallback when the API rejects a mode, and the rate is clamped to the API's 5 Hz frame-time floor that previously put CONFIGURE in a silent retry loop. Invalid or quality-gated (SENS_AFBR_QMIN) frames now publish max_distance + 1 with quality 0 so uavcannode emits TOO_FAR, and the max distance is bounded by the configured unambiguous range. Pipeline fixes: measurementReadyCallback dereferenced g_dev after its null check, stop() deleted the object while a callback could still arrive, the DRDY interrupt stayed bound to the destroyed handle, S2PI_Abort left the bus BUSY forever, S2PI_Init leaked on restart, setRateAndDfm spun unbounded, and a lost completion callback or wedged device stalled the state machine for good. Non-OK result codes are counted by name for 'afbrs50 status'. 'afbrs50 cal' runs the vendor absolute range offset calibration on a low-priority task (the sequence busy-waits and would starve the IWDG feeder on wq:uavcan) and persists the offsets to SENS_AFBR_OFS_LO/HI. * fix(afbrs50): evaluate every completed frame and guard CONFIGURE against stale completions Argus_EvaluateData is what releases the API's raw data buffer, and the API refuses new measurements and rejects configuration writes once two buffers are held. An error-status callback skipped it, so two bad frames wedged the driver into the stall recovery with nothing published. The abort completion of that recovery, arriving from the SPI thread, could overwrite CONFIGURE with TRIGGER and skip the reconfigure. Also note the removed parameters in the 1.18 release notes. * refactor(afbrs50): run the driver in its own task and the SPI transfers on the bus work queue The transfer work item ran on wq:SPI0 (which does not exist on STM32 targets) purely for its near-top priority: before API 1.6.6 a DRDY firing within ~60 us of the last SPI clock was lost unless the transfer callback had already run. Since 1.6.6 ADS_SPI_Callback re-checks the IRQ pin and recovers a DRDY that arrives before the callback, so the deadline is gone and the transfer item can live on the work queue of the bus the sensor actually sits on, at its conventional priority. The blocking exchange stays on a work queue because the API requests transfers from hrt interrupt context. The state machine cannot share that thread: the API's configuration calls spin in ADS_AwaitIdle until the transfer they queued completes. It previously borrowed hp_default, whose 2800 byte stack Argus_EvaluateData overflows and whose priority puts the driver's blocking configuration waits ahead of dshot and pwm_out. It now runs as a SCHED_PRIORITY_SLOW_DRIVER task woken by the completion callback through a semaphore, so the range offset calibration no longer needs its own task either: the driver drops to SCHED_PRIORITY_DEFAULT for the duration of the sequence, below the wq:uavcan IWDG feeder, and a stop request aborts it. * fix(afbrs50): publish only NO_OBJECT as too far, reinit on stuck CONFIGURE, protect calibration Every evaluation failure and quality-gated frame went out as max_distance + 1, which collision prevention clamps to max_distance and enters as free space regardless of signal_quality, so a sensor fault on a horizontal mount cleared a real obstacle. Only the device's own STATUS_ARGUS_NO_OBJECT is published that way now; errors and gated frames are counted and left to the consumers' stream timeouts. CONFIGURE drains a raw buffer an abort may leave behind, since the API rejects configuration writes until it is evaluated, and falls back to Argus_ReinitMode after ten consecutive failures because a sticky error status never returns to IDLE on its own. The vendor calibration sequence blocks longer than ModuleBase's 5 s stop deadline while holding pointers into the task stack, so 'afbrs50 stop' is refused while it runs and a stop clears a not-yet-started request. The sequence also rewrites the per-pixel offset tables, which cannot be persisted; they are restored afterwards so the sensor runs in the state the stored global offsets re-create at boot. The destructor now also stops the API's periodic timer, the last path that could reach the completion callback after ModuleBase has deleted the instance. * fix(afbrs50): publish invalid frames with signal quality 0 instead of dropping them Dropping errored and quality-gated frames left a receiver unable to tell a sensor returning invalid readings from one that fell off the bus. Every frame is published again with signal_quality 0 marking the invalid ones. The distance sent with it is chosen for collision prevention, which ignores quality: NO_OBJECT stays beyond max_distance (free space, TOO_FAR on DroneCAN), errors carry min_distance (discarded, UNDEFINED on DroneCAN), and a gated frame keeps its measured distance with the quality floored to 0.
This commit is contained in:
1 parent
c1808fb460
commit
bb75224d6d
9 files changed
+1414
-348
No files matched your search
@@ -7,10 +7,6 @@ param set-default IMU_GYRO_RATEMAX 1000
|
||||
param set-default SENS_FLOW_RATE 150
|
||||
param set-default SENS_IMU_CLPNOTI 0
|
||||
|
||||
param set-default SENS_AFBR_S_RATE 25
|
||||
param set-default SENS_AFBR_L_RATE 5
|
||||
param set-default SENS_AFBR_MODE 1
|
||||
|
||||
# Internal SPI
|
||||
paa3905 -s start -Y 180
|
||||
|
||||
|
||||
-6
@@ -3,12 +3,6 @@
|
||||
# board sensors init
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
param set-default SENS_AFBR_S_RATE 25
|
||||
param set-default SENS_AFBR_L_RATE 5
|
||||
param set-default SENS_AFBR_MODE 1
|
||||
param set-default SENS_AFBR_THRESH 2
|
||||
param set-default SENS_AFBR_HYSTER 1
|
||||
|
||||
param set-default MAV_SYS_ID 158
|
||||
param set-default MAV_COMP_ID 158
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ For users upgrading from v1.17, please take a moment to review the following bef
|
||||
11. **Update AFBR-S50 startup scripts.**
|
||||
The `-r` command-line rotation flag is removed; set the mounting orientation via [SENS_AFBR_ROT](../advanced_config/parameter_reference.md#SENS_AFBR_ROT) instead.
|
||||
([PX4-Autopilot#27385](https://github.com/PX4/PX4-Autopilot/pull/27385))
|
||||
`SENS_AFBR_S_RATE`, `SENS_AFBR_L_RATE`, `SENS_AFBR_THRESH` and `SENS_AFBR_HYSTER` are removed with the distance-based range switching; rate and dual frequency mode are now set per module by [SENS_AFBR_PROF](../advanced_config/parameter_reference.md#SENS_AFBR_PROF), or explicitly with [SENS_AFBR_RATE](../advanced_config/parameter_reference.md#SENS_AFBR_RATE) and [SENS_AFBR_DFM](../advanced_config/parameter_reference.md#SENS_AFBR_DFM).
|
||||
([PX4-Autopilot#28454](https://github.com/PX4/PX4-Autopilot/pull/28454))
|
||||
|
||||
## Hardware Support
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -38,75 +38,203 @@
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/drivers/rangefinder/PX4Rangefinder.hpp>
|
||||
#include <lib/perf/perf_counter.h>
|
||||
#include <px4_platform_common/atomic.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
#include <px4_platform_common/module.h>
|
||||
#include <px4_platform_common/module_params.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
|
||||
#include <px4_platform_common/sem.h>
|
||||
#include <px4_platform_common/tasks.h>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
|
||||
class AFBRS50 : public ModuleParams, public px4::ScheduledWorkItem
|
||||
// Runs in its own task: the API's configuration calls block on SPI
|
||||
// transfers that complete on the bus work queue (s2pi.cpp), and the
|
||||
// measurement completion callback wakes the task through a semaphore.
|
||||
class AFBRS50 : public ModuleBase, public ModuleParams
|
||||
{
|
||||
public:
|
||||
AFBRS50();
|
||||
~AFBRS50() override;
|
||||
|
||||
static Descriptor desc;
|
||||
|
||||
static int task_spawn(int argc, char *argv[]);
|
||||
static AFBRS50 *instantiate(int argc, char *argv[]);
|
||||
static int custom_command(int argc, char *argv[]);
|
||||
static int print_usage(const char *reason = nullptr);
|
||||
static int run_trampoline(int argc, char *argv[]);
|
||||
|
||||
void run() override;
|
||||
int print_status() override;
|
||||
void request_stop() override;
|
||||
|
||||
// 'afbrs50 stop' is refused while the blocking calibration sequence runs.
|
||||
static bool calibrationRunning()
|
||||
{
|
||||
AFBRS50 *instance = get_instance<AFBRS50>(desc);
|
||||
return (instance != nullptr) && instance->calibrationInProgress();
|
||||
}
|
||||
|
||||
enum class STATE : uint8_t {
|
||||
CONFIGURE,
|
||||
TRIGGER,
|
||||
COLLECT,
|
||||
CALIBRATE,
|
||||
};
|
||||
|
||||
int init();
|
||||
void printInfo();
|
||||
// 'afbrs50 cal ...' (AFBRS50_Calibration.cpp), runs on the caller's thread.
|
||||
int calibrationCommand(int argc, char *argv[]);
|
||||
|
||||
private:
|
||||
void Run() override;
|
||||
int init();
|
||||
|
||||
void run_state_configure();
|
||||
void run_state_trigger();
|
||||
void run_state_collect();
|
||||
|
||||
// The CALIBRATE state runs the blocking vendor sequence on this task
|
||||
// (AFBRS50_Calibration.cpp).
|
||||
void run_state_calibrate();
|
||||
void runCalibration();
|
||||
void requestCalibration(float target_range_m);
|
||||
void cancelCalibration();
|
||||
void printCalInfo();
|
||||
bool calibrationInProgress() const { return _cal_state == CalState::RUNNING; }
|
||||
|
||||
void recordCallbackError();
|
||||
void schedule(STATE state);
|
||||
bool processMeasurement();
|
||||
void updateMeasurementRateFromRange();
|
||||
|
||||
// Called from the completion callback: move to `state` and wake the task.
|
||||
void wake(STATE state);
|
||||
|
||||
// Block until the completion callback or a stop request wakes the task,
|
||||
// or `delay` elapses.
|
||||
void waitForWake(hrt_abstime delay);
|
||||
|
||||
void recoverFromTriggerStall(const char *reason);
|
||||
void configureFailed();
|
||||
|
||||
static status_t measurementReadyCallback(status_t status, argus_hnd_t *hnd);
|
||||
|
||||
status_t setRateAndDfm(uint32_t rate_hz, argus_dfm_mode_t dfm_mode);
|
||||
status_t awaitIdle();
|
||||
status_t setDfm(argus_dfm_mode_t dfm_mode);
|
||||
status_t setRate(uint32_t rate_hz);
|
||||
uint32_t defaultRate() const;
|
||||
int defaultDfm() const;
|
||||
argus_mode_t argusModeFromParameter();
|
||||
void updateMaxDistanceFromApi();
|
||||
void printConfiguration();
|
||||
|
||||
void recordMeasurementError(status_t status);
|
||||
static const char *argusStatusName(status_t status);
|
||||
static const char *argusModeName(argus_mode_t mode);
|
||||
|
||||
private:
|
||||
argus_hnd_t *_hnd {nullptr};
|
||||
|
||||
STATE _state{STATE::CONFIGURE};
|
||||
|
||||
PX4Rangefinder _px4_rangefinder;
|
||||
px4_sem_t _wake_sem;
|
||||
|
||||
hrt_abstime _last_rate_switch{0};
|
||||
// Delay before the next state handler runs, set by the handlers; 0 runs
|
||||
// the next state immediately.
|
||||
hrt_abstime _wake_delay{0};
|
||||
|
||||
argus_module_version_t _module{MODULE_NONE};
|
||||
|
||||
// Absolute range offset calibration state (AFBRS50_Calibration.cpp).
|
||||
enum class CalState : uint8_t { IDLE, REQUESTED, RUNNING, DONE, FAILED };
|
||||
px4::atomic_bool _calibration_requested{false};
|
||||
q9_22_t _calibration_target_range{0}; // Q9.22 meter
|
||||
CalState _cal_state{CalState::IDLE};
|
||||
status_t _cal_result_status{STATUS_OK};
|
||||
q0_15_t _cal_offset_low{0}; // last applied offsets, Q0.15 meter
|
||||
q0_15_t _cal_offset_high{0};
|
||||
|
||||
PX4Rangefinder _px4_rangefinder;
|
||||
|
||||
perf_counter_t _sample_perf{perf_alloc(PC_COUNT, MODULE_NAME": sample count")};
|
||||
perf_counter_t _callback_error{perf_alloc(PC_COUNT, MODULE_NAME": callback error")};
|
||||
perf_counter_t _process_measurement_error{perf_alloc(PC_COUNT, MODULE_NAME": process measure error")};
|
||||
perf_counter_t _status_not_ready_perf{perf_alloc(PC_COUNT, MODULE_NAME": not ready")};
|
||||
perf_counter_t _trigger_fail_perf{perf_alloc(PC_COUNT, MODULE_NAME": trigger fail")};
|
||||
perf_counter_t _recovery_perf{perf_alloc(PC_COUNT, MODULE_NAME": pipeline recovery")};
|
||||
perf_counter_t _quality_gated_perf{perf_alloc(PC_COUNT, MODULE_NAME": quality gated")};
|
||||
perf_counter_t _loop_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": loop interval")};
|
||||
|
||||
// Distribution of non-OK measurement results (the Argus_EvaluateData
|
||||
// return or res.Status), dumped by 'afbrs50 status': the raw codes are the
|
||||
// only clue to why frames go invalid in the field.
|
||||
static constexpr unsigned kErrorStatusSlots = 8;
|
||||
struct ErrorStatusCount {
|
||||
status_t status{STATUS_OK};
|
||||
uint32_t count{0};
|
||||
};
|
||||
ErrorStatusCount _error_status_counts[kErrorStatusSlots] {};
|
||||
uint32_t _error_status_other{0};
|
||||
status_t _last_error_status{STATUS_OK};
|
||||
hrt_abstime _last_error_time{0};
|
||||
|
||||
float _current_distance{0};
|
||||
int8_t _current_quality{0};
|
||||
float _min_distance{0.f};
|
||||
float _max_distance{30.f};
|
||||
int _current_rate{0};
|
||||
|
||||
hrt_abstime _trigger_time{0};
|
||||
|
||||
// Consecutive failed trigger cycles (device not idle or trigger rejected),
|
||||
// polled at a quarter frame time: 20 retries = 5 frame times without
|
||||
// progress before recoverFromTriggerStall() aborts and reconfigures.
|
||||
static constexpr uint32_t kMaxTriggerRetries = 20;
|
||||
uint32_t _trigger_retry_count{0};
|
||||
|
||||
// Consecutive CONFIGURE failures (350 ms apart) before the device is
|
||||
// re-initialized instead of retried.
|
||||
static constexpr uint32_t kMaxConfigureFailures = 10;
|
||||
uint32_t _configure_failures{0};
|
||||
|
||||
// The API rejects frame times above 200 ms (Argus_Dev_CheckCfg) with
|
||||
// ERROR_ARGUS_INVALID_CFG, so 5 Hz is a hard rate floor.
|
||||
static constexpr uint32_t kMinRateHz = 5;
|
||||
|
||||
// SENS_AFBR_PROF on the two characterized modules. Frame rate is the
|
||||
// dominant range knob on both: reliable range is flat across a band of
|
||||
// rates and falls off above it, so Range sits at the top of that band and
|
||||
// Fast at the module's native rate. DFM 4X beat the mode-default 8X on
|
||||
// validity, spread and wrong-window returns at every rate flown.
|
||||
struct RateDfmProfile {
|
||||
uint8_t rate_hz;
|
||||
uint8_t dfm;
|
||||
};
|
||||
|
||||
static constexpr unsigned kProfileCount = 2;
|
||||
|
||||
// LV85D: 12-20 Hz reach the same holds, 25 Hz loses ~4 m.
|
||||
static constexpr RateDfmProfile kProfilesLv[kProfileCount] {
|
||||
{20, DFM_MODE_4X}, // 0: Range
|
||||
{50, DFM_MODE_4X}, // 1: Fast
|
||||
};
|
||||
|
||||
// LX85D: 5-15 Hz reach the same holds, 25 Hz loses 3-6 m.
|
||||
static constexpr RateDfmProfile kProfilesLx[kProfileCount] {
|
||||
{15, DFM_MODE_4X}, // 0: Range
|
||||
{25, DFM_MODE_4X}, // 1: Fast
|
||||
};
|
||||
|
||||
// Selected profile for the detected module, nullptr when uncharacterized.
|
||||
const RateDfmProfile *profile() const;
|
||||
|
||||
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
|
||||
|
||||
uint32_t _measurement_inverval {1000000 / 50}; // 50Hz
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamInt<px4::params::SENS_AFBR_MODE>) _p_sens_afbr_mode,
|
||||
(ParamInt<px4::params::SENS_AFBR_S_RATE>) _p_sens_afbr_s_rate,
|
||||
(ParamInt<px4::params::SENS_AFBR_L_RATE>) _p_sens_afbr_l_rate,
|
||||
(ParamInt<px4::params::SENS_AFBR_THRESH>) _p_sens_afbr_thresh,
|
||||
(ParamInt<px4::params::SENS_AFBR_HYSTER>) _p_sens_afbr_hyster,
|
||||
(ParamInt<px4::params::SENS_AFBR_ROT>) _p_sens_afbr_rot
|
||||
(ParamInt<px4::params::SENS_AFBR_MODE>) _p_sens_afbr_mode,
|
||||
(ParamInt<px4::params::SENS_AFBR_RATE>) _p_sens_afbr_rate,
|
||||
(ParamInt<px4::params::SENS_AFBR_DFM>) _p_sens_afbr_dfm,
|
||||
(ParamInt<px4::params::SENS_AFBR_SNM>) _p_sens_afbr_snm,
|
||||
(ParamInt<px4::params::SENS_AFBR_ROT>) _p_sens_afbr_rot,
|
||||
(ParamInt<px4::params::SENS_AFBR_PROF>) _p_sens_afbr_prof,
|
||||
(ParamInt<px4::params::SENS_AFBR_QMIN>) _p_sens_afbr_qmin,
|
||||
(ParamFloat<px4::params::SENS_AFBR_OFS_LO>) _p_sens_afbr_ofs_lo,
|
||||
(ParamFloat<px4::params::SENS_AFBR_OFS_HI>) _p_sens_afbr_ofs_hi
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,276 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2025 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// AFBRS50 absolute range offset calibration (vendor sequence
|
||||
// Argus_ExecuteAbsoluteRangeOffsetCalibrationSequence), driven from NSH:
|
||||
//
|
||||
// afbrs50 cal start <distance_m> flat target, perpendicular to the optical
|
||||
// afbrs50 cal status axis, at a measured distance; offsets
|
||||
// persist to SENS_AFBR_OFS_LO/HI and are
|
||||
// re-applied at every boot (CONFIGURE).
|
||||
//
|
||||
// One run at a single known distance derives the global range offsets for BOTH
|
||||
// laser power stages (low/high) plus the per-pixel relative offsets; the API has
|
||||
// no multi-distance procedure. Motivating case: LX85D units bias low at short
|
||||
// range; calibrate against a short-range target (0.3-1 m works well).
|
||||
//
|
||||
// This file holds every calibration-related AFBRS50 member so the main driver
|
||||
// file stays measurement-oriented.
|
||||
|
||||
#include "AFBRS50.hpp"
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/time.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
void AFBRS50::run_state_calibrate()
|
||||
{
|
||||
_calibration_requested.store(false);
|
||||
_cal_state = CalState::RUNNING;
|
||||
|
||||
// The sequence blocks this task for several seconds and its ADS_AwaitIdle
|
||||
// loops do not yield. SCHED_PRIORITY_SLOW_DRIVER already sits below the
|
||||
// work queues, so drop to SCHED_PRIORITY_DEFAULT to get out of the way of
|
||||
// commander, navigator and the other application tasks too. Nothing is
|
||||
// in flight: TRIGGER intercepts the request before starting a measurement.
|
||||
struct sched_param param {};
|
||||
sched_getparam(0, ¶m);
|
||||
const int task_priority = param.sched_priority;
|
||||
param.sched_priority = SCHED_PRIORITY_DEFAULT;
|
||||
sched_setparam(0, ¶m);
|
||||
|
||||
runCalibration();
|
||||
|
||||
param.sched_priority = task_priority;
|
||||
sched_setparam(0, ¶m);
|
||||
|
||||
_state = STATE::CONFIGURE;
|
||||
_wake_delay = 0;
|
||||
}
|
||||
|
||||
void AFBRS50::runCalibration()
|
||||
{
|
||||
// Runs on the driver task in the CALIBRATE state, so nothing else touches
|
||||
// the device for the duration of the sequence.
|
||||
|
||||
// Make sure the device is idle and no measurement is pending. Bounded so
|
||||
// a wedged device fails the calibration instead of hanging the task
|
||||
// forever (a RUNNING calibration also blocks 'afbrs50 stop').
|
||||
const hrt_abstime wait_start = hrt_absolute_time();
|
||||
|
||||
while (Argus_GetStatus(_hnd) != STATUS_IDLE) {
|
||||
if (hrt_elapsed_time(&wait_start) > 1_s) {
|
||||
_cal_result_status = ERROR_TIMEOUT;
|
||||
_cal_state = CalState::FAILED;
|
||||
PX4_ERR("calibration failed: device not idle");
|
||||
return;
|
||||
}
|
||||
|
||||
px4_usleep(1_ms);
|
||||
}
|
||||
|
||||
// The absolute sequence rewrites the per-pixel relative offset tables as
|
||||
// well as the two global offsets, but only the globals can be persisted:
|
||||
// these boards have no NVM for the API and 64 values do not belong in
|
||||
// params. Restore the factory pixel tables afterwards so the sensor runs
|
||||
// in the same state CONFIGURE re-creates from the params at the next boot.
|
||||
argus_cal_offset_table_t factory_pixel_offsets{};
|
||||
const bool have_pixel_offsets = (Argus_GetCalibrationPixelRangeOffsets(_hnd, &factory_pixel_offsets) == STATUS_OK);
|
||||
|
||||
auto restore_pixel_offsets = [&]() {
|
||||
if (!have_pixel_offsets) {
|
||||
PX4_WARN("factory pixel offsets were not read, the calibrated tables stay until reboot");
|
||||
|
||||
} else if (Argus_SetCalibrationPixelRangeOffsets(_hnd, &factory_pixel_offsets) != STATUS_OK) {
|
||||
PX4_WARN("could not restore the factory pixel offsets, the calibrated tables stay until reboot");
|
||||
}
|
||||
};
|
||||
|
||||
const float target_m = (float)_calibration_target_range / Q9_22_ONE;
|
||||
PX4_INFO("running absolute range offset calibration at %.3f m (takes a few seconds)...", (double)target_m);
|
||||
|
||||
status_t status = Argus_ExecuteAbsoluteRangeOffsetCalibrationSequence(_hnd, _calibration_target_range);
|
||||
|
||||
if (status < STATUS_OK) {
|
||||
_cal_result_status = status;
|
||||
_cal_state = CalState::FAILED;
|
||||
PX4_ERR("calibration start failed: %i", (int)status);
|
||||
return;
|
||||
}
|
||||
|
||||
// The sequence runs asynchronously (driven by background measurement
|
||||
// frames); poll until it returns to idle, matching the vendor reference
|
||||
// flow. Bounded by a timeout so a stalled sequence can't hold the device
|
||||
// forever.
|
||||
const hrt_abstime cal_start = hrt_absolute_time();
|
||||
|
||||
do {
|
||||
status = Argus_GetStatus(_hnd);
|
||||
px4_usleep(1_ms);
|
||||
|
||||
if (should_exit()) {
|
||||
Argus_Abort(_hnd);
|
||||
restore_pixel_offsets();
|
||||
_cal_result_status = ERROR_ABORTED;
|
||||
_cal_state = CalState::FAILED;
|
||||
PX4_WARN("calibration aborted by stop");
|
||||
return;
|
||||
}
|
||||
|
||||
if (hrt_elapsed_time(&cal_start) > 30_s) {
|
||||
restore_pixel_offsets();
|
||||
_cal_result_status = ERROR_TIMEOUT;
|
||||
_cal_state = CalState::FAILED;
|
||||
PX4_ERR("calibration timed out");
|
||||
return;
|
||||
}
|
||||
} while (status > STATUS_IDLE);
|
||||
|
||||
restore_pixel_offsets();
|
||||
_cal_result_status = status;
|
||||
|
||||
if (status < STATUS_OK) {
|
||||
_cal_state = CalState::FAILED;
|
||||
PX4_ERR("calibration failed: %i", (int)status);
|
||||
return;
|
||||
}
|
||||
|
||||
// Read back the offsets the API applied, then persist them (as meters) to
|
||||
// params so the CONFIGURE state re-applies them on the next boot.
|
||||
Argus_GetCalibrationGlobalRangeOffsets(_hnd, &_cal_offset_low, &_cal_offset_high);
|
||||
|
||||
_p_sens_afbr_ofs_lo.commit_no_notification((float)_cal_offset_low / 32768.f);
|
||||
_p_sens_afbr_ofs_hi.commit_no_notification((float)_cal_offset_high / 32768.f);
|
||||
|
||||
_cal_state = CalState::DONE;
|
||||
PX4_INFO("calibration done, offsets persisted: low=%.4f m high=%.4f m",
|
||||
(double)((float)_cal_offset_low / 32768.f),
|
||||
(double)((float)_cal_offset_high / 32768.f));
|
||||
}
|
||||
|
||||
void AFBRS50::requestCalibration(float target_range_m)
|
||||
{
|
||||
_calibration_target_range = (q9_22_t)(target_range_m * Q9_22_ONE);
|
||||
_cal_result_status = STATUS_OK;
|
||||
_cal_state = CalState::REQUESTED;
|
||||
_calibration_requested.store(true);
|
||||
}
|
||||
|
||||
void AFBRS50::cancelCalibration()
|
||||
{
|
||||
_calibration_requested.store(false);
|
||||
|
||||
// Only meaningful if it has not started yet; a running sequence is
|
||||
// blocking and cannot be interrupted from here.
|
||||
if (_cal_state == CalState::REQUESTED) {
|
||||
_cal_state = CalState::IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void AFBRS50::printCalInfo()
|
||||
{
|
||||
const char *state_str = "IDLE";
|
||||
|
||||
switch (_cal_state) {
|
||||
case CalState::IDLE: state_str = "IDLE"; break;
|
||||
|
||||
case CalState::REQUESTED: state_str = "REQUESTED"; break;
|
||||
|
||||
case CalState::RUNNING: state_str = "RUNNING"; break;
|
||||
|
||||
case CalState::DONE: state_str = "DONE"; break;
|
||||
|
||||
case CalState::FAILED: state_str = "FAILED"; break;
|
||||
}
|
||||
|
||||
PX4_INFO_RAW("calibration: %s\n", state_str);
|
||||
PX4_INFO_RAW(" target: %.3f m\n", (double)((float)_calibration_target_range / Q9_22_ONE));
|
||||
PX4_INFO_RAW(" last status: %i\n", (int)_cal_result_status);
|
||||
PX4_INFO_RAW(" offset_low: %.4f m\n", (double)((float)_cal_offset_low / 32768.f));
|
||||
PX4_INFO_RAW(" offset_high: %.4f m\n", (double)((float)_cal_offset_high / 32768.f));
|
||||
PX4_INFO_RAW(" stored (params, applied at boot): low=%.4f m high=%.4f m\n",
|
||||
(double)_p_sens_afbr_ofs_lo.get(), (double)_p_sens_afbr_ofs_hi.get());
|
||||
}
|
||||
|
||||
int AFBRS50::calibrationCommand(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 1) {
|
||||
PX4_ERR("usage: afbrs50 cal start <distance_m> | status | stop");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[0], "start")) {
|
||||
if (argc < 2) {
|
||||
PX4_ERR("usage: afbrs50 cal start <distance_m>");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
if (calibrationInProgress()) {
|
||||
PX4_ERR("calibration already in progress");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
float range_m = strtof(argv[1], nullptr);
|
||||
|
||||
if (!(range_m > 0.f) || (range_m > 50.f)) {
|
||||
PX4_ERR("invalid distance: %s", argv[1]);
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
requestCalibration(range_m);
|
||||
PX4_INFO("calibration requested at %.3f m; poll with 'afbrs50 cal status'", (double)range_m);
|
||||
return PX4_OK;
|
||||
|
||||
} else if (!strcmp(argv[0], "status")) {
|
||||
printCalInfo();
|
||||
return PX4_OK;
|
||||
|
||||
} else if (!strcmp(argv[0], "stop")) {
|
||||
if (calibrationInProgress()) {
|
||||
PX4_ERR("sequence already running; it cannot be interrupted");
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
cancelCalibration();
|
||||
PX4_INFO("calibration request cancelled");
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
PX4_ERR("unknown cal subcommand: %s", argv[0]);
|
||||
return PX4_ERROR;
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <board_config.h>
|
||||
|
||||
#include <lib/drivers/device/Device.hpp>
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
@@ -15,6 +16,7 @@
|
||||
#include <lib/perf/perf_counter.h>
|
||||
|
||||
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
|
||||
#include <px4_platform_common/px4_work_queue/WorkQueueManager.hpp>
|
||||
|
||||
/*! A structure to hold all internal data required by the S2PI module. */
|
||||
typedef struct {
|
||||
@@ -41,6 +43,17 @@ typedef struct {
|
||||
uint8_t *spi_rx_data;
|
||||
size_t spi_frame_size;
|
||||
|
||||
/*! Incremented by S2PI_Abort to invalidate a transfer that is already
|
||||
* in flight on the work queue. */
|
||||
volatile uint8_t Generation;
|
||||
|
||||
/*! Set while the work queue thread is inside the SPI exchange. */
|
||||
volatile bool InFlight;
|
||||
|
||||
/*! Callback of an aborted in-flight transfer, invoked with ERROR_ABORTED
|
||||
* once the exchange physically completes. */
|
||||
s2pi_callback_t AbortedCallback;
|
||||
|
||||
/*! The mapping of the GPIO blocks and pins for this device. */
|
||||
const uint32_t GPIOs[ S2PI_IRQ + 1 ];
|
||||
}
|
||||
@@ -59,7 +72,7 @@ static perf_counter_t irq_perf = NULL;
|
||||
class AFBRS50_SPI : public px4::ScheduledWorkItem
|
||||
{
|
||||
public:
|
||||
AFBRS50_SPI();
|
||||
explicit AFBRS50_SPI(const px4::wq_config_t &wq_config);
|
||||
void schedule_now();
|
||||
void schedule_clear();
|
||||
|
||||
@@ -69,42 +82,61 @@ private:
|
||||
|
||||
};
|
||||
|
||||
AFBRS50_SPI::AFBRS50_SPI():
|
||||
// WARNING: SPI0 only exists for nxp and raspberry pi, so we hijack it here
|
||||
|
||||
// NOTE: we use SPI0 WQ since it is the 2nd highest priority thread (behind rate_ctrl).
|
||||
// TODO: we should fix how SPI comms work. Async SPI comms is
|
||||
// undesirable. We should use SPI TX DMA complete callback
|
||||
// instead of relying on a high priority thread.
|
||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::SPI0)
|
||||
AFBRS50_SPI::AFBRS50_SPI(const px4::wq_config_t &wq_config):
|
||||
// Transfers can be requested from interrupt context (the API's periodic
|
||||
// timer runs on an hrt callout), so the blocking exchange is deferred to
|
||||
// the work queue of the bus the sensor sits on. Since API v1.6.6 the
|
||||
// library recovers a data-ready interrupt that fires before the transfer
|
||||
// callback has run, so the callback is no longer deadline-critical and
|
||||
// needs no elevated thread priority.
|
||||
ScheduledWorkItem(MODULE_NAME, wq_config)
|
||||
{
|
||||
// Anything to do?
|
||||
}
|
||||
|
||||
void AFBRS50_SPI::Run()
|
||||
{
|
||||
IRQ_LOCK();
|
||||
|
||||
if (s2pi_.Status != STATUS_BUSY) {
|
||||
// Transfer was aborted before it started.
|
||||
IRQ_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t generation = s2pi_.Generation;
|
||||
uint8_t *tx_data = s2pi_.spi_tx_data;
|
||||
uint8_t *rx_data = s2pi_.spi_rx_data;
|
||||
const size_t frame_size = s2pi_.spi_frame_size;
|
||||
s2pi_.InFlight = true;
|
||||
|
||||
IRQ_UNLOCK();
|
||||
|
||||
px4_arch_gpiowrite(s2pi_.GPIOs[S2PI_CS], 0);
|
||||
SPI_EXCHANGE(s2pi_.spidev, s2pi_.spi_tx_data, s2pi_.spi_rx_data, s2pi_.spi_frame_size);
|
||||
SPI_EXCHANGE(s2pi_.spidev, tx_data, rx_data, frame_size);
|
||||
px4_arch_gpiowrite(s2pi_.GPIOs[S2PI_CS], 1);
|
||||
|
||||
//// WARNING!
|
||||
// After the last SPI TX we have ~60us to execute the below
|
||||
// callback otherwise the IRQ will fire and we're screwed.
|
||||
// The proper way to solve this problem is to either fix
|
||||
// the API or to configure SPI TX DMA callback complete
|
||||
// to execute the below callback immediately.
|
||||
|
||||
|
||||
// If we are pre-empted here and the IRQ fires before the
|
||||
// callback has been invoked -- we're screwed.
|
||||
|
||||
IRQ_LOCK();
|
||||
s2pi_.Status = STATUS_IDLE;
|
||||
s2pi_.InFlight = false;
|
||||
|
||||
if (s2pi_.Callback != 0) {
|
||||
s2pi_callback_t callback = s2pi_.Callback;
|
||||
s2pi_.Callback = 0;
|
||||
callback(STATUS_OK, s2pi_.CallbackData);
|
||||
if (s2pi_.Generation == generation) {
|
||||
s2pi_.Status = STATUS_IDLE;
|
||||
|
||||
if (s2pi_.Callback != 0) {
|
||||
s2pi_callback_t callback = s2pi_.Callback;
|
||||
s2pi_.Callback = 0;
|
||||
callback(STATUS_OK, s2pi_.CallbackData);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Aborted mid-exchange: the bus only now became free, so complete
|
||||
// the abort here (see S2PI_Abort).
|
||||
s2pi_.Status = STATUS_IDLE;
|
||||
|
||||
if (s2pi_.AbortedCallback != 0) {
|
||||
s2pi_callback_t callback = s2pi_.AbortedCallback;
|
||||
s2pi_.AbortedCallback = 0;
|
||||
callback(ERROR_ABORTED, s2pi_.CallbackData);
|
||||
}
|
||||
}
|
||||
|
||||
IRQ_UNLOCK();
|
||||
@@ -137,8 +169,6 @@ static AFBRS50_SPI *_spi_iface = nullptr;
|
||||
*****************************************************************************/
|
||||
status_t S2PI_Init(s2pi_slave_t defaultSlave, uint32_t baudRate_Bps)
|
||||
{
|
||||
(void)defaultSlave;
|
||||
|
||||
px4_arch_configgpio(BROADCOM_AFBR_S50_S2PI_CS);
|
||||
|
||||
s2pi_.spidev = px4_spibus_initialize(BROADCOM_AFBR_S50_S2PI_SPI_BUS);
|
||||
@@ -159,9 +189,17 @@ status_t S2PI_Init(s2pi_slave_t defaultSlave, uint32_t baudRate_Bps)
|
||||
// has been configured. This prevents erroneous interrupts from occuring.
|
||||
px4_arch_gpiosetevent(BROADCOM_AFBR_S50_S2PI_IRQ, false, true, false, callback, NULL);
|
||||
|
||||
irq_perf = perf_alloc(PC_ELAPSED, MODULE_NAME": irq callback");
|
||||
if (irq_perf == NULL) {
|
||||
irq_perf = perf_alloc(PC_ELAPSED, MODULE_NAME": irq callback");
|
||||
}
|
||||
|
||||
_spi_iface = new AFBRS50_SPI();
|
||||
if (_spi_iface == nullptr) {
|
||||
device::Device::DeviceId device_id{};
|
||||
device_id.devid_s.bus_type = device::Device::DeviceBusType::DeviceBusType_SPI;
|
||||
device_id.devid_s.bus = defaultSlave;
|
||||
|
||||
_spi_iface = new AFBRS50_SPI(px4::device_bus_to_wq(device_id.devid));
|
||||
}
|
||||
|
||||
return S2PI_SetBaudRate(baudRate_Bps);
|
||||
}
|
||||
@@ -448,18 +486,42 @@ status_t S2PI_Abort(s2pi_slave_t slave)
|
||||
{
|
||||
(void)slave;
|
||||
|
||||
status_t status = s2pi_.Status;
|
||||
IRQ_LOCK();
|
||||
|
||||
/* Check if something is ongoing. */
|
||||
if (status == STATUS_IDLE) {
|
||||
if (s2pi_.Status != STATUS_BUSY) {
|
||||
IRQ_UNLOCK();
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
/* Abort SPI transfer. */
|
||||
if (status == STATUS_BUSY) {
|
||||
s2pi_.Generation++;
|
||||
|
||||
if (s2pi_.InFlight) {
|
||||
/* The exchange is physically on the wires and cannot be stopped
|
||||
* (and must not be waited on: abort may run in interrupt context).
|
||||
* Keep the status BUSY so nobody touches the bus and defer the
|
||||
* ERROR_ABORTED completion to the work item's tail. A repeated
|
||||
* abort leaves the already-stashed callback in place. */
|
||||
if (s2pi_.Callback != 0) {
|
||||
s2pi_.AbortedCallback = s2pi_.Callback;
|
||||
s2pi_.Callback = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Not started yet: cancel the pending work item and complete. */
|
||||
_spi_iface->schedule_clear();
|
||||
s2pi_.Status = STATUS_IDLE;
|
||||
|
||||
s2pi_callback_t callback = s2pi_.Callback;
|
||||
s2pi_.Callback = 0;
|
||||
|
||||
if (callback != 0) {
|
||||
callback(ERROR_ABORTED, s2pi_.CallbackData);
|
||||
}
|
||||
}
|
||||
|
||||
IRQ_UNLOCK();
|
||||
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ px4_add_module(
|
||||
Inc
|
||||
SRCS
|
||||
AFBRS50.cpp
|
||||
AFBRS50_Calibration.cpp
|
||||
AFBRS50.hpp
|
||||
API/Src/irq.c
|
||||
API/Src/s2pi.cpp
|
||||
|
||||
@@ -4,58 +4,73 @@ parameters:
|
||||
definitions:
|
||||
SENS_AFBR_MODE:
|
||||
description:
|
||||
short: AFBR Rangefinder Mode
|
||||
long: This parameter defines the mode of the AFBR Rangefinder.
|
||||
short: AFBR Rangefinder Measurement Mode
|
||||
long: |-
|
||||
Auto selects the module's default measurement mode as defined by the
|
||||
AFBR-S50 API (LV85D/LX85D: Long Range). A mode the API rejects for
|
||||
the detected module falls back to the module default.
|
||||
type: enum
|
||||
values:
|
||||
-1: Auto (module default)
|
||||
0: Short Range Mode
|
||||
1: Long Range Mode
|
||||
2: High Speed Short Range Mode
|
||||
3: High Speed Long Range Mode
|
||||
4: High Precision Short Range Mode
|
||||
default: -1
|
||||
reboot_required: true
|
||||
min: -1
|
||||
max: 4
|
||||
SENS_AFBR_RATE:
|
||||
description:
|
||||
short: AFBR Rangefinder Measurement Rate
|
||||
long: |-
|
||||
0 selects the per-module default: on the LV85D and LX85D the rate of
|
||||
the SENS_AFBR_PROF profile, on other modules the measurement mode's
|
||||
default frame time. Lower rates increase the exposure budget per
|
||||
frame and thus the radiometric range. The API limits the frame time
|
||||
to 200 ms, so values below 5 Hz are clamped to 5 Hz.
|
||||
type: int32
|
||||
default: 0
|
||||
unit: Hz
|
||||
reboot_required: true
|
||||
min: 0
|
||||
max: 100
|
||||
SENS_AFBR_DFM:
|
||||
description:
|
||||
short: AFBR Rangefinder Dual Frequency Mode
|
||||
long: |-
|
||||
Dual frequency mode multiplies the module's base unambiguous range
|
||||
(LV85D 12.5 m, LX85D 25 m) by 4 or 8, at the cost of frame time and,
|
||||
at low signal, of wrong-window returns when the subframes disagree.
|
||||
Auto selects DFM 4X on the LV85D and LX85D, which measured better
|
||||
than the mode-default 8X on validity, spread and wrong-window returns
|
||||
at every rate flown, and the measurement mode's default elsewhere.
|
||||
type: enum
|
||||
values:
|
||||
-1: Auto
|
||||
0: DFM Off
|
||||
1: DFM 4X
|
||||
2: DFM 8X
|
||||
default: -1
|
||||
reboot_required: true
|
||||
min: -1
|
||||
max: 2
|
||||
SENS_AFBR_SNM:
|
||||
description:
|
||||
short: AFBR Rangefinder Shot Noise Monitor Mode
|
||||
long: This parameter defines the mode of the AFBR Rangefinder's shot noise
|
||||
monitor.
|
||||
type: enum
|
||||
values:
|
||||
0: Static Indoor Mode
|
||||
1: Static Outdoor Mode
|
||||
2: Dynamic Mode
|
||||
3: Dynamic Plus Mode
|
||||
default: 3
|
||||
reboot_required: true
|
||||
min: 0
|
||||
max: 3
|
||||
SENS_AFBR_S_RATE:
|
||||
description:
|
||||
short: AFBR Rangefinder Short Range Rate
|
||||
long: This parameter defines measurement rate of the AFBR Rangefinder in short
|
||||
range mode.
|
||||
type: int32
|
||||
default: 50
|
||||
min: 1
|
||||
max: 100
|
||||
SENS_AFBR_L_RATE:
|
||||
description:
|
||||
short: AFBR Rangefinder Long Range Rate
|
||||
long: This parameter defines measurement rate of the AFBR Rangefinder in long
|
||||
range mode.
|
||||
type: int32
|
||||
default: 25
|
||||
min: 1
|
||||
max: 100
|
||||
SENS_AFBR_THRESH:
|
||||
description:
|
||||
short: AFBR Rangefinder Short/Long Range Threshold
|
||||
long: |-
|
||||
This parameter defines the threshold for switching between short and long range mode.
|
||||
The mode will switch from short to long range when the distance is greater than the threshold plus the hysteresis.
|
||||
The mode will switch from long to short range when the distance is less than the threshold minus the hysteresis.
|
||||
type: int32
|
||||
default: 4
|
||||
unit: m
|
||||
min: 1
|
||||
max: 50
|
||||
SENS_AFBR_HYSTER:
|
||||
description:
|
||||
short: AFBR Rangefinder Short/Long Range Threshold Hysteresis
|
||||
long: This parameter defines the hysteresis for switching between short and
|
||||
long range mode.
|
||||
type: int32
|
||||
default: 1
|
||||
unit: m
|
||||
min: 1
|
||||
max: 10
|
||||
SENS_AFBR_ROT:
|
||||
description:
|
||||
short: AFBR Rangefinder Orientation
|
||||
@@ -76,3 +91,59 @@ parameters:
|
||||
reboot_required: true
|
||||
min: 0
|
||||
max: 25
|
||||
SENS_AFBR_PROF:
|
||||
description:
|
||||
short: AFBR Rangefinder Performance Profile
|
||||
long: |-
|
||||
Trades detection range against update rate on the LV85D and LX85D;
|
||||
other modules ignore it. Range: the highest rate that does not cost
|
||||
reliable range (LV85D 20 Hz, LX85D 15 Hz). Fast: the module's native
|
||||
rate (LV85D 50 Hz, LX85D 25 Hz) for optical flow and terrain
|
||||
following near the ground; costs a few metres of reliable range in
|
||||
bright light, none in low ambient light. Both profiles use DFM 4X.
|
||||
An explicit SENS_AFBR_RATE or SENS_AFBR_DFM overrides the profile.
|
||||
type: enum
|
||||
values:
|
||||
0: Range
|
||||
1: Fast
|
||||
default: 0
|
||||
reboot_required: true
|
||||
min: 0
|
||||
max: 1
|
||||
SENS_AFBR_QMIN:
|
||||
description:
|
||||
short: AFBR Rangefinder Minimum Signal Quality
|
||||
long: |-
|
||||
Measurements with a signal quality below this value are published
|
||||
with signal quality 0 (invalid) so consumers drop them but still see
|
||||
the sensor alive. Raising it rejects unreliable readings but also the
|
||||
weak long-range returns, since those are the low quality ones.
|
||||
0 publishes every measurement with its reported quality.
|
||||
type: int32
|
||||
default: 0
|
||||
min: 0
|
||||
max: 100
|
||||
SENS_AFBR_OFS_LO:
|
||||
description:
|
||||
short: AFBR Rangefinder Range Offset (low power)
|
||||
long: |-
|
||||
Global range offset for the low laser power stage, applied on top of
|
||||
the factory calibration at startup. Written by 'afbrs50 cal'.
|
||||
0 leaves the factory offset unchanged.
|
||||
type: float
|
||||
default: 0.0
|
||||
unit: m
|
||||
decimal: 5
|
||||
reboot_required: true
|
||||
SENS_AFBR_OFS_HI:
|
||||
description:
|
||||
short: AFBR Rangefinder Range Offset (high power)
|
||||
long: |-
|
||||
Global range offset for the high laser power stage, applied on top of
|
||||
the factory calibration at startup. Written by 'afbrs50 cal'.
|
||||
0 leaves the factory offset unchanged.
|
||||
type: float
|
||||
default: 0.0
|
||||
unit: m
|
||||
decimal: 5
|
||||
reboot_required: true
|
||||
Reference in new issue
Block a user