Statistics
| Branch: | Tag: | Revision:

humotion / cfg / humotion.cfg @ e71325d1

History | View | Annotate | Download (3.806 KB)

1 b6e7118f sschulz
#!/usr/bin/env python
2 277050c7 sschulz
import re
3 b6e7118f sschulz
PACKAGE = "humotion"
4
from dynamic_reconfigure.parameter_generator_catkin import *
5
6 277050c7 sschulz
def fetch_default(param_name):
7
    for line in open("../src/server/config.cpp"):
8
        if param_name in line:
9 6491eeeb sschulz
            result = re.findall("=\s*([\d.]+);", line)
10 277050c7 sschulz
            print result
11
            if result:
12 e71325d1 sschulz
                return result[0]
13 277050c7 sschulz
            else:
14
                print("ERROR: could not find parameter %s in config.cpp" % (param_name))
15
                sys.exit(1)
16
17
def add_entry(group, param_name, descr, min, max):
18 e71325d1 sschulz
    default_str = fetch_default(param_name)
19
    default_val = float(default_str)
20 277050c7 sschulz
    if (default_val > max):
21
        print("ERROR: default value %f for %s exceeds max value (%f)" % (default_val, param_name, max))
22
        sys.exit(1)
23
    if (default_val < min):
24
        print("ERROR: default value %f for %s is under min value (%f)" % (default_val, param_name, min))
25
        sys.exit(1)
26
27
    group.add(param_name, double_t, 0, descr, default_val, min, max)
28 b6e7118f sschulz
29 e71325d1 sschulz
def add_entry_bool(group, param_name, descr):
30
    default = fetch_default(param_name)
31
32
    default_val = True
33
    if (default == "false"):
34
        default_val = False
35
36
    group.add(param_name, bool_t, 0, descr, default_val)
37
38
39 277050c7 sschulz
gen = ParameterGenerator()
40 6d13138a sschulz
41 277050c7 sschulz
general_group = gen.add_group("thresholds")
42
add_entry(general_group, "threshold_velocity_eye_saccade", "velocity threshold for eye saccade detection (in deg/s)", 1.0, 30.0)
43
add_entry(general_group, "threshold_angle_neck_saccade", "magnitude of gaze change that triggers neck saccade (in deg)", 1.0, 30.0)
44
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)
45 6d13138a sschulz
46 277050c7 sschulz
neck_group = gen.add_group("neck")
47
add_entry(neck_group, "scale_velocity_neck", "scaling factor for neck velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0)
48
add_entry(neck_group, "scale_acceleration_neck", "scaling factor for neck acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
49
add_entry(neck_group, "limit_velocity_neck", "limit for neck velocity (in deg/s)", 100.0, 800.0)
50
add_entry(neck_group, "limit_acceleration_neck", "limit for neck acceleration (in deg/s^2)", 100.0, 10000.0)
51 6d13138a sschulz
52
eye_group = gen.add_group("eye")
53 277050c7 sschulz
add_entry(eye_group, "scale_velocity_eye", "scaling factor for eye velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0)
54
add_entry(eye_group, "scale_acceleration_eye", "scaling factor for eye acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
55
add_entry(eye_group, "limit_velocity_eye", "limit for eye velocity (in deg/s)", 100.0, 1000.0)
56
add_entry(eye_group, "limit_acceleration_eye", "limit for eye acceleration (in deg/s^2)", 100.0, 80000.0)
57 6d13138a sschulz
58
eyeblink_group = gen.add_group("eyeblink")
59 277050c7 sschulz
add_entry(eyeblink_group, "eyeblink_duration", "duration for an eyeblink (in seconds)", 0.01, 1.0)
60
add_entry(eyeblink_group, "eyeblink_periodic_distribution_lower", "lower bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0)
61
add_entry(eyeblink_group, "eyeblink_periodic_distribution_upper", "upper bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0)
62
add_entry(eyeblink_group, "eyeblink_probability_after_saccade", "probability for an eyeblink after a saccade (in percent)", 0.01, 1.0)
63
add_entry(eyeblink_group, "eyeblink_blocked_time", "blocking time for further eyeblinks (in seconds)", 0.1, 100.0)
64
65 e71325d1 sschulz
eyelids_group = gen.add_group("eyelids")
66
add_entry_bool(eyelids_group, "eyelids_follow_eyemotion", "should the eyelids follow the eye tilt motion?")
67
68 277050c7 sschulz
breath_group = gen.add_group("breath")
69
add_entry(breath_group, "breath_period", "duration for a full breath periond: inhale, pause and exhale (in seconds)", 1.0, 100.0)
70
add_entry(breath_group, "breath_amplitude", "amplitude for breath animation (in deg)", 0.0, 10.0)
71 b6e7118f sschulz
72
exit(gen.generate(PACKAGE, "humotion", "humotion"))