mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-07 08:21:36 +08:00
[tfmini] Configure range and FoV via parameters
This commit is contained in:
committed by
Niklas Hauser
parent
43ef690254
commit
effb9dee11
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "TFMINI.hpp"
|
#include "TFMINI.hpp"
|
||||||
|
|
||||||
|
#include <lib/parameters/param.h>
|
||||||
#include <lib/drivers/device/Device.hpp>
|
#include <lib/drivers/device/Device.hpp>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -72,7 +73,8 @@ TFMINI::~TFMINI()
|
|||||||
int
|
int
|
||||||
TFMINI::init()
|
TFMINI::init()
|
||||||
{
|
{
|
||||||
int32_t hw_model = 1; // only one model so far...
|
int32_t hw_model = 1;
|
||||||
|
param_get(param_find("SENS_TFMINI_HW"), &hw_model);
|
||||||
|
|
||||||
switch (hw_model) {
|
switch (hw_model) {
|
||||||
case 1: // TFMINI (12m, 100 Hz)
|
case 1: // TFMINI (12m, 100 Hz)
|
||||||
@@ -83,8 +85,19 @@ TFMINI::init()
|
|||||||
// So we set 0.4 as valid minimum.
|
// So we set 0.4 as valid minimum.
|
||||||
_px4_rangefinder.set_min_distance(0.4f);
|
_px4_rangefinder.set_min_distance(0.4f);
|
||||||
_px4_rangefinder.set_max_distance(12.0f);
|
_px4_rangefinder.set_max_distance(12.0f);
|
||||||
_px4_rangefinder.set_fov(math::radians(1.15f));
|
_px4_rangefinder.set_fov(math::radians(2.3f));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // ISTRA24 (50m, 100 Hz)
|
||||||
|
_px4_rangefinder.set_min_distance(0.3f);
|
||||||
|
_px4_rangefinder.set_max_distance(50.0f);
|
||||||
|
_px4_rangefinder.set_fov(math::radians(20));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // ISTRA24 (100m, 100 Hz)
|
||||||
|
_px4_rangefinder.set_min_distance(0.3f);
|
||||||
|
_px4_rangefinder.set_max_distance(100.0f);
|
||||||
|
_px4_rangefinder.set_fov(math::radians(20));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -4,3 +4,20 @@ serial_config:
|
|||||||
port_config_param:
|
port_config_param:
|
||||||
name: SENS_TFMINI_CFG
|
name: SENS_TFMINI_CFG
|
||||||
group: Sensors
|
group: Sensors
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
- group: Sensors
|
||||||
|
definitions:
|
||||||
|
SENS_TFMINI_HW:
|
||||||
|
description:
|
||||||
|
short: Hardware Model
|
||||||
|
long: Models differ in range and FoV.
|
||||||
|
type: enum
|
||||||
|
values:
|
||||||
|
1: TFMINI
|
||||||
|
2: ISTRA24
|
||||||
|
3: ISTRA24_100m
|
||||||
|
min: 1
|
||||||
|
max: 3
|
||||||
|
default: 1
|
||||||
|
reboot_required: true
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ $ tfmini stop
|
|||||||
PRINT_MODULE_USAGE_PARAM_INT('R', 25, 0, 25, "Sensor rotation - downward facing by default", true);
|
PRINT_MODULE_USAGE_PARAM_INT('R', 25, 0, 25, "Sensor rotation - downward facing by default", true);
|
||||||
PRINT_MODULE_USAGE_COMMAND_DESCR("status","Driver status");
|
PRINT_MODULE_USAGE_COMMAND_DESCR("status","Driver status");
|
||||||
PRINT_MODULE_USAGE_COMMAND_DESCR("stop","Stop driver");
|
PRINT_MODULE_USAGE_COMMAND_DESCR("stop","Stop driver");
|
||||||
PRINT_MODULE_USAGE_COMMAND_DESCR("test","Test driver (basic functional tests)");
|
|
||||||
PRINT_MODULE_USAGE_COMMAND_DESCR("status","Print driver status");
|
PRINT_MODULE_USAGE_COMMAND_DESCR("status","Print driver status");
|
||||||
return PX4_OK;
|
return PX4_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user