commit 277050c7ec4f49a986629cf2df80b77c03d685f4
Author: sschulz <sschulz@techfak.uni-bielefeld.de>
Date:   Wed Feb 24 12:11:09 2016 +0100

    added dyn reconfig

diff --git a/cfg/humotion.cfg b/cfg/humotion.cfg
index 4b292b7..2ed13fe 100755
--- a/cfg/humotion.cfg
+++ b/cfg/humotion.cfg
@@ -1,84 +1,60 @@
 #!/usr/bin/env python
+import re
 PACKAGE = "humotion"
 from dynamic_reconfigure.parameter_generator_catkin import *
 
-gen = ParameterGenerator()
+def fetch_default(param_name):
+    for line in open("../src/server/config.cpp"):
+        if param_name in line:
+            result = re.findall("=\s*([\d.]+)", line)
+            print result
+            if result:
+                return float(result[0])
+            else:
+                print("ERROR: could not find parameter %s in config.cpp" % (param_name))
+                sys.exit(1)
+
+def add_entry(group, param_name, descr, min, max):
+    default_val = fetch_default(param_name)
+    if (default_val > max):
+        print("ERROR: default value %f for %s exceeds max value (%f)" % (default_val, param_name, max))
+        sys.exit(1)
+    if (default_val < min):
+        print("ERROR: default value %f for %s is under min value (%f)" % (default_val, param_name, min))
+        sys.exit(1)
+
+    group.add(param_name, double_t, 0, descr, default_val, min, max)
 
-general_group = gen.add_group("general")
-general_group.add("eye_saccade_velocity_threshold", double_t, 0, "eye velocity threshold for saccade detection (in deg/s)", 15.0, 1.0, 30.0)
-general_group.add("neck_saccade_threshold", double_t, 0, "magnitude of gaze change that triggers neck saccade (in deg)", 15.0, 1.0, 30.0)
-general_group.add("neck_saccade_omr_trigger", double_t, 0, "a deflection exceeding <VAL> * OMR will trigger a correction neck saccade", 0.95, 0.1, 1.0)
+gen = ParameterGenerator()
 
-neck_group = gen.add_group("neck")
-neck_group.add("neck_max_acceleration", int_t, 0, "maximum neck acceleration limit (in deg/s^2)", 1000, 100, 4000)
-neck_group.add("neck_max_velocity", int_t, 0, "maximum neck velocity limit (in deg/s)", 1000, 100, 800)
-neck_group.add("neck_velocity_scale", double_t, 0, "scaling factor for neck accelerations (1.0 = full human velocities)", 0.7, 0.1, 1.0)
+general_group = gen.add_group("thresholds")
+add_entry(general_group, "threshold_velocity_eye_saccade", "velocity threshold for eye saccade detection (in deg/s)", 1.0, 30.0)
+add_entry(general_group, "threshold_angle_neck_saccade", "magnitude of gaze change that triggers neck saccade (in deg)", 1.0, 30.0)
+add_entry(general_group, "threshold_angle_omr_limit", "threshold for a deflection that triggers a correction neck saccade (in percent of OMR)", 0.1, 1.0)
 
-#float max_speed = (CONST_GUITTON87_A * distance_abs + CONST_GUITTON87_B);
-neck_group.add("neck_velocity_lin_eq_const_a", double_t, 0, "constant A (scale) for linear velocity equation (guitton 4.39)", 4.39 / 2.0, 1.0, 10.0)
-neck_group.add("neck_velocity_lin_eq_const_b", double_t, 0, "constant B (offset) for linear velocity equation (guitton 4.39)", 106.0 / 2.0, 1, 200)
 
-#others
-neck_group.add("neck_breath_period", int_t, 0, "breath period (inhale+pause+exhale) in ms)", 3*1500, 3000, 5000)
-neck_group.add("neck_breath_amplitude", double_t, 0, "amplitude of head tilt deflection during breath (given in deg)", 1.0, 0.0, 5.0)
+neck_group = gen.add_group("neck")
+add_entry(neck_group, "scale_velocity_neck", "scaling factor for neck velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0)
+add_entry(neck_group, "scale_acceleration_neck", "scaling factor for neck acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
+add_entry(neck_group, "limit_velocity_neck", "limit for neck velocity (in deg/s)", 100.0, 800.0)
+add_entry(neck_group, "limit_acceleration_neck", "limit for neck acceleration (in deg/s^2)", 100.0, 10000.0)
 
 eye_group = gen.add_group("eye")
-eye_group.add("eye_max_acceleration", int_t, 0, "maximum eye acceleration limit (in deg/s^2)", 80000, 1000, 80000)
-eye_group.add("eye_max_velocity", int_t, 0, "maximum eye velocity limit (in deg/s)", 700, 100, 700)
-eye_group.add("eye_velocity_scale", double_t, 0, "scaling factor for eye accelerations (1.0 = full human velocities)", 1.0, 0.1, 1.0)
+add_entry(eye_group, "scale_velocity_eye", "scaling factor for eye velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0)
+add_entry(eye_group, "scale_acceleration_eye", "scaling factor for eye acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
+add_entry(eye_group, "limit_velocity_eye", "limit for eye velocity (in deg/s)", 100.0, 1000.0)
+add_entry(eye_group, "limit_acceleration_eye", "limit for eye acceleration (in deg/s^2)", 100.0, 80000.0)
 
 eyeblink_group = gen.add_group("eyeblink")
-eyeblink_group.add("eyeblink_duration", int_t, 0, "eyeblink duration (in ms)", 150, 50, 500)
-eyeblink_group.add("eyeblink_every_min", int_t, 0, "eyeblink every n ms, lower bound (in ms)",  2000, 1000, 10000)
-eyeblink_group.add("eyeblink_every_max", int_t, 0, "eyeblink every n ms, upper bound (in ms)", 10000, 1000, 20000)
-eyeblink_group.add("eyeblink_blocking_time", int_t, 0, "eyeblink blocked timeout (in ms)", 1000, 100, 5000)
-
-
-
-
-#eyelid:
-# static const float SACCADE_SPEED_THRESHOLD;
-#    static const float EYEBLINK_DURATION_MS;
-#    static const float EYEBLINK_EYERY_MS_MIN;
-#    static const float EYEBLINK_EYERY_MS_MAX;
-#    static const float EYEBLINK_BLOCKING_TIME;
-#
-
-# static const float MOUTH_MIN_OPENING;
-#
-#neck
-#    static const float CONST_GUITTON87_A;
-#    static const float CONST_GUITTON87_B;
-#
-#    static const float CONST_BREATH_PERIOD;
-#    static const float CONST_BREATH_AMPLITUDE;
-#
-#misc for neck and eyes:
-#max accel
-#v_scale
-
-#timing_mode_enum = gen.enum([
-#    gen.const("free_running", int_t, 0, "camera acquires images at a maximum possible framerate"),
-#    gen.const("frame_rate", int_t, 1, "please refer to xiAPI Frame Rate Control support page")], "enum to configure timing mode")
-#gen.add("acq_timing_mode", int_t, 0, "A size parameter which is edited via an enum", 1, 0, 3, edit_method=timing_mode_enum)######
-#
-#gen.add("framerate", double_t, 0, "Defines frames per second of sensor. see also acq_timint_mode", 30, 1.0, 200.0)
-#
-#gen.add("gain", double_t, 0, "Gain in dB", 0, -1.5, 6)
-#gen.add("exposure", double_t, 0, "Exposure time in us", 26, 26, 1e+04)
-#gen.add("aeag", bool_t, 0, "Automatic exposure/gain", False)
-#gen.add("aeag_roi_offset_x", int_t, 0, "Automatic exposure/gain ROI offset X", 0, 0, 2040)
-#gen.add("aeag_roi_offset_y", int_t, 0, "Automatic exposure/gain ROI offset Y", 0, 0, 1080)
-#gen.add("aeag_roi_width", int_t, 0, "Automatic exposure/gain ROI Width", 2040, 0, 2040)
-#gen.add("aeag_roi_height", int_t, 0, "Automatic exposure/gain ROI Height", 1080, 0, 1080)
-#gen.add("bpc", bool_t, 0, "Correction of bad pixels", False)
-#gen.add("auto_wb", bool_t, 0, "Automatic white balance", False)
-#gen.add("width", int_t, 0, "Width of the Image provided by the device (in pixels)", 2040, 16, 2040)
-#gen.add("height", int_t, 0, "Height of the Image provided by the device (in pixels)", 1080, 2, 1080)
-#gen.add("offsetX", int_t, 0, "Horizontal offset from the origin to the area of interest (in pixels)", 0, 0, 2040)
-##gen.add("offsetY", int_t, 0, "Vertical offset from the origin to the area of interest (in pixels)", 0, 0, 1080)
-#
-#gen.add("recent_frame", bool_t, 0, "Retrieve the most recent frame instead of the next in buffer", False);
+add_entry(eyeblink_group, "eyeblink_duration", "duration for an eyeblink (in seconds)", 0.01, 1.0)
+add_entry(eyeblink_group, "eyeblink_periodic_distribution_lower", "lower bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0)
+add_entry(eyeblink_group, "eyeblink_periodic_distribution_upper", "upper bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0)
+add_entry(eyeblink_group, "eyeblink_probability_after_saccade", "probability for an eyeblink after a saccade (in percent)", 0.01, 1.0)
+add_entry(eyeblink_group, "eyeblink_blocked_time", "blocking time for further eyeblinks (in seconds)", 0.1, 100.0)
+
+breath_group = gen.add_group("breath")
+add_entry(breath_group, "breath_period", "duration for a full breath periond: inhale, pause and exhale (in seconds)", 1.0, 100.0)
+add_entry(breath_group, "breath_amplitude", "amplitude for breath animation (in deg)", 0.0, 10.0)
 
 exit(gen.generate(PACKAGE, "humotion", "humotion"))
 
