#!/usr/bin/env python

# Software License Agreement (BSD License)
#
# Copyright (c) 2015, CITEC, Bielefeld University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
#   copyright notice, this list of conditions and the following
#   disclaimer in the documentation and/or other materials provided
#   with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

PACKAGE = 'tactile_marker_publisher'

from dynamic_reconfigure.parameter_generator_catkin import ParameterGenerator, int_t, double_t
from tactile import TactileValue

gen = ParameterGenerator()

mode_enum = gen.enum([ gen.const('rawCurrent', int_t, TactileValue.rawCurrent, 'raw value as measured'),
                       gen.const('rawMean',    int_t, TactileValue.rawMean,    'raw value averaged over time'),
                       gen.const('absCurrent', int_t, TactileValue.absCurrent, 'measured value normalized to observed range'),
                       gen.const('absMean',    int_t, TactileValue.absMean,    'abs averaged over time'),
                       gen.const('dynCurrent', int_t, TactileValue.dynCurrent, 'measured value normalized to dynamically adapted range'),
                       gen.const('dynMean',    int_t, TactileValue.dynMean,    'relative averaged over time'),
                       gen.const('dynCurrentRelease', int_t, TactileValue.dynCurrentRelease, 'show release as red, press as green'),
                       gen.const('dynMeanRelease',    int_t, TactileValue.dynMeanRelease,    'release averaged over time')],
                     'visualization mode')

gen.add('mode', int_t, 1, 'visualization mode',
        TactileValue.absCurrent, TactileValue.rawCurrent, TactileValue.dynMeanRelease,
        edit_method=mode_enum)

gen.add('value_smoothing',   double_t, 1, 'degree of smoothing of sensor values over time', 0.7, 0, 1)
gen.add('range_habituation', double_t, 1, 'degree of habituation of the dynamic range to current value',  0.0005, 0, 1)
gen.add('release_decay',     double_t, 1, '(linear) speed of release decay as fraction of range', 0.05, 0, 1)

exit(gen.generate(PACKAGE, 'tactile_marker_publisher', 'TactileValue'))
