#! /usr/bin/env python

PACKAGE='miniking_ros'
NODE='miniking_node'
CONFIG='MiniKing'

from driver_base.msg import SensorLevels
from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

sonar_type_enum = gen.enum([ gen.const("Imaging",  int_t, 2, "Imaging"),
                             gen.const("Sidescan", int_t, 3, "Sidescan"),
                             gen.const("Profiling",int_t, 5, "Profiling")], "Sets sonar functionality.")
freq_enum = gen.enum([gen.const("f0",   int_t,    0,    "0 kHz"),
                      gen.const("f325", int_t,  325,  "325 kHz"),
                      gen.const("f580", int_t,  580,  "580 kHz"),
                      gen.const("f675", int_t,  675,  "675 kHz"),
                      gen.const("f795", int_t,  795,  "795 kHz"),
                      gen.const("f935", int_t,  935,  "935 kHz"),
                      gen.const("f1210",int_t, 1210, "1210 kHz"),
                      gen.const("f200", int_t,  200,  "200 kHz"),
                      gen.const("f1700",int_t, 1700, "1700 kHz"),
                      gen.const("f2000",int_t, 2000, "2000 kHz"),
                      gen.const("f500", int_t,  500,  "500 kHz"),
                      gen.const("f1500",int_t, 1500, "1500 kHz"),
                      gen.const("f295", int_t,  295,  "295 kHz")], "Sets frequency of scan. Frequency value in kHz")
resolution_enum = gen.enum( [ gen.const("Low",     int_t, 32, "1.8 degrees"),
                              gen.const("Medium",  int_t, 16, "0.9 degrees"),
                              gen.const("High",    int_t,  8, "0.45 degrees"),
                              gen.const("Ultimate",int_t,  4, " 0.225 degrees")], "Sets the scanning motor step angle between pings.")

#       Name             Type    Reconfiguration level             Description  Default   Min   Max
gen.add("resolution",    int_t,  SensorLevels.RECONFIGURE_RUNNING, "Sets the scanning motor step angle between pings.", 16, edit_method=resolution_enum)
gen.add("continuous",    bool_t, SensorLevels.RECONFIGURE_RUNNING, "Set continuous scan.", True)
gen.add("inverted",      bool_t, SensorLevels.RECONFIGURE_RUNNING, "True when sonar is mounted inverted.", False)
gen.add("stare",         bool_t, SensorLevels.RECONFIGURE_RUNNING, "This option allows a scanning sonar to 'stare' in a fixed direction, defined by left limit parameter. True for fixed direction.", False)
gen.add("disable_motor", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Allows the power to the scanning motor to be switched off for test purposes, or for power saving. True for disable motor.", False)
gen.add("disable_trans", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Allows the sonar transmitter to be disabled for test purposes. True for no sonar transmissions.", False)
gen.add("type",          int_t,  SensorLevels.RECONFIGURE_RUNNING, "Sets sonar functionality.", 2, edit_method=sonar_type_enum)
gen.add("frequency",     int_t,  SensorLevels.RECONFIGURE_RUNNING, "Sets frequency of scan.", 675, edit_method=freq_enum)
gen.add("range",         int_t,  SensorLevels.RECONFIGURE_RUNNING, "Sets maximum distance to scan for each ping.", 30, 0, 80)
gen.add("left_limit",    int_t,  SensorLevels.RECONFIGURE_RUNNING, "Sets left limit for a sector scan operation. It's used for scan a fixed direction in conjunction with setStare method too.", 90, 0, 360)
gen.add("right_limit",   int_t,  SensorLevels.RECONFIGURE_RUNNING, "Sets right limit for a sector scan operation.", 180, 0, 360)
gen.add("gain",          int_t,  SensorLevels.RECONFIGURE_RUNNING, "Sets the gain of the receiver.", 40, 0, 100)
gen.add("bins",          int_t,  SensorLevels.RECONFIGURE_RUNNING, "Number of range bins that the sonar will generate for the reply data message. ", 200, 0, 800)

exit(gen.generate(PACKAGE, NODE, CONFIG))
