diff --git a/src/drivers/distance_sensor/tfmini/TFMINI.cpp b/src/drivers/distance_sensor/tfmini/TFMINI.cpp index 150d1c486d..63853c6cf2 100644 --- a/src/drivers/distance_sensor/tfmini/TFMINI.cpp +++ b/src/drivers/distance_sensor/tfmini/TFMINI.cpp @@ -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() _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; diff --git a/src/drivers/distance_sensor/tfmini/TFMINI.hpp b/src/drivers/distance_sensor/tfmini/TFMINI.hpp index 027d73fa52..4dd52db737 100644 --- a/src/drivers/distance_sensor/tfmini/TFMINI.hpp +++ b/src/drivers/distance_sensor/tfmini/TFMINI.hpp @@ -53,6 +53,7 @@ #include #include #include +#include #include "tfmini_parser.h" diff --git a/src/drivers/distance_sensor/tfmini/module.yaml b/src/drivers/distance_sensor/tfmini/module.yaml index 770cbe979c..56f1d0c2d3 100644 --- a/src/drivers/distance_sensor/tfmini/module.yaml +++ b/src/drivers/distance_sensor/tfmini/module.yaml @@ -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