From 47c88940b9e3bc8decdd5a52c929d94e851e5fa9 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Mon, 3 Feb 2020 18:28:36 +0100
Subject: [PATCH] Added a new parameter to select the operational mode of the
 sensor.

---
 cfg/Bno055Imu.cfg | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/cfg/Bno055Imu.cfg b/cfg/Bno055Imu.cfg
index bfce5cc..d21d2be 100755
--- a/cfg/Bno055Imu.cfg
+++ b/cfg/Bno055Imu.cfg
@@ -38,12 +38,28 @@ from dynamic_reconfigure.parameter_generator_catkin import *
 
 gen = ParameterGenerator()
 
+enum_operation_mode = gen.enum([ 
+gen.const("accel_only",  int_t, 1, "Only enable the accelerometer"),
+gen.const("mag_only",  int_t, 2, "Only enable the magnetometer"),
+gen.const("gyro_only", int_t, 3, "Only enable the gyroscope"),
+gen.const("accel_mag", int_t, 4, "Enable both accelerometer and magnetometer"),
+gen.const("accel_gyro", int_t, 5, "Enable both accelerometer and gyroscope"),
+gen.const("mag_gyro", int_t, 6, "Enable both magnetometer and gyroscope"),
+gen.const("accel_mag_gyro", int_t, 7, "Enable all sensors"),
+gen.const("imu", int_t, 8, "IMU"),
+gen.const("compass", int_t, 9, "Compass"),
+gen.const("m4g", int_t, 10, "M4G"),
+gen.const("ndof_off", int_t, 11, "ndof off"),
+gen.const("ndof", int_t, 12, "ndof")
+], "Possible operation modes.")
+
 #       Name                       Type       Reconfiguration level            Description                       Default   Min   Max
-gen.add("update_rate",             double_t,  SensorLevels.RECONFIGURE_STOP,   "Data update rate in Hz",         20.0,     1.0,  100.0)
-gen.add("serial_device",           str_t,     SensorLevels.RECONFIGURE_STOP,   "Device serial port",             "/dev/ttyUSB0")
+gen.add("update_rate",             double_t,  SensorLevels.RECONFIGURE_CLOSE,   "Data update rate in Hz",         20.0,     1.0,  100.0)
+gen.add("serial_device",           str_t,     SensorLevels.RECONFIGURE_CLOSE,  "Device serial port",             "/dev/ttyUSB1")
 gen.add("cal_filename",            str_t,     SensorLevels.RECONFIGURE_STOP,   "Sensor calibration data",        "")
 gen.add("tf_prefix",               str_t,     SensorLevels.RECONFIGURE_STOP,   "TF prefix",                      "")
 gen.add("frame_id",                str_t,     SensorLevels.RECONFIGURE_STOP,   "IMU frame_id in the urdf file",  "")
+gen.add("mode",                    int_t,     SensorLevels.RECONFIGURE_CLOSE,  "Operation mode",                 12,       1,    12, edit_method=enum_operation_mode)
 #gen.add("velocity_scale_factor",  double_t,  SensorLevels.RECONFIGURE_STOP,   "Maximum velocity scale factor",  0.5,      0.0,  1.0)
 
 exit(gen.generate(PACKAGE, "Bno055ImuDriver", "Bno055Imu"))
-- 
GitLab