Browse Source

distance_sensor:Add rotation parameter in TFMINI

pr-sensor-distance
Zebulon 3 years ago
parent
commit
779ba2fb48
  1. 6
      src/drivers/distance_sensor/tfmini/TFMINI.cpp
  2. 1
      src/drivers/distance_sensor/tfmini/TFMINI.hpp
  3. 19
      src/drivers/distance_sensor/tfmini/module.yaml

6
src/drivers/distance_sensor/tfmini/TFMINI.cpp

@ -73,6 +73,11 @@ int @@ -73,6 +73,11 @@ int
TFMINI::init()
{
int32_t hw_model = 1; // only one model so far...
param_t _param_tf_rot = param_find("SENS_TFMINI_ROT");
int32_t tf_rotation;
if (_param_tf_rot != PARAM_INVALID) {
param_get(_param_tf_rot, &tf_rotation);
}
switch (hw_model) {
case 1: // TFMINI (12m, 100 Hz)
@ -84,6 +89,7 @@ TFMINI::init() @@ -84,6 +89,7 @@ TFMINI::init()
_px4_rangefinder.set_min_distance(0.4f);
_px4_rangefinder.set_max_distance(12.0f);
_px4_rangefinder.set_fov(math::radians(1.15f));
_px4_rangefinder.set_orientation(tf_rotation);
break;

1
src/drivers/distance_sensor/tfmini/TFMINI.hpp

@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <lib/drivers/rangefinder/PX4Rangefinder.hpp>
#include <uORB/topics/distance_sensor.h>
#include <px4_platform_common/module_params.h>
#include "tfmini_parser.h"

19
src/drivers/distance_sensor/tfmini/module.yaml

@ -5,3 +5,22 @@ serial_config: @@ -5,3 +5,22 @@ serial_config:
name: SENS_TFMINI_CFG
group: Sensors
parameters:
- group: Sensors
definitions:
SENS_TFMINI_ROT:
description:
short: Distance Sensor Rotation
long: |
Distance Sensor Rotation as MAV_SENSOR_ORIENTATION enum
type: enum
values:
25: ROTATION_DOWNWARD_FACING
24: ROTATION_UPWARD_FACING
4: ROTATION_BACKWARD_FACING
0: ROTATION_FORWARD_FACING
6: ROTATION_LEFT_FACING
2: ROTATION_RIGHT_FACING
reboot_required: true
default: 25

Loading…
Cancel
Save