humotion / cfg / humotion.cfg @ 25400c71
History | View | Annotate | Download (3.409 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 | return float(result[0]) |
||
13 | 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 | default_val = fetch_default(param_name) |
||
19 | if (default_val > max): |
||
20 | print("ERROR: default value %f for %s exceeds max value (%f)" % (default_val, param_name, max)) |
||
21 | sys.exit(1) |
||
22 | if (default_val < min): |
||
23 | print("ERROR: default value %f for %s is under min value (%f)" % (default_val, param_name, min)) |
||
24 | sys.exit(1) |
||
25 | |||
26 | group.add(param_name, double_t, 0, descr, default_val, min, max) |
||
27 | b6e7118f | sschulz | |
28 | 277050c7 | sschulz | gen = ParameterGenerator() |
29 | 6d13138a | sschulz | |
30 | 277050c7 | sschulz | general_group = gen.add_group("thresholds") |
31 | add_entry(general_group, "threshold_velocity_eye_saccade", "velocity threshold for eye saccade detection (in deg/s)", 1.0, 30.0) |
||
32 | add_entry(general_group, "threshold_angle_neck_saccade", "magnitude of gaze change that triggers neck saccade (in deg)", 1.0, 30.0) |
||
33 | 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) |
||
34 | 6d13138a | sschulz | |
35 | |||
36 | 277050c7 | sschulz | neck_group = gen.add_group("neck") |
37 | add_entry(neck_group, "scale_velocity_neck", "scaling factor for neck velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0) |
||
38 | add_entry(neck_group, "scale_acceleration_neck", "scaling factor for neck acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0) |
||
39 | add_entry(neck_group, "limit_velocity_neck", "limit for neck velocity (in deg/s)", 100.0, 800.0) |
||
40 | add_entry(neck_group, "limit_acceleration_neck", "limit for neck acceleration (in deg/s^2)", 100.0, 10000.0) |
||
41 | 6d13138a | sschulz | |
42 | eye_group = gen.add_group("eye") |
||
43 | 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) |
44 | add_entry(eye_group, "scale_acceleration_eye", "scaling factor for eye acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0) |
||
45 | add_entry(eye_group, "limit_velocity_eye", "limit for eye velocity (in deg/s)", 100.0, 1000.0) |
||
46 | add_entry(eye_group, "limit_acceleration_eye", "limit for eye acceleration (in deg/s^2)", 100.0, 80000.0) |
||
47 | 6d13138a | sschulz | |
48 | eyeblink_group = gen.add_group("eyeblink") |
||
49 | 277050c7 | sschulz | add_entry(eyeblink_group, "eyeblink_duration", "duration for an eyeblink (in seconds)", 0.01, 1.0) |
50 | add_entry(eyeblink_group, "eyeblink_periodic_distribution_lower", "lower bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0) |
||
51 | add_entry(eyeblink_group, "eyeblink_periodic_distribution_upper", "upper bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0) |
||
52 | add_entry(eyeblink_group, "eyeblink_probability_after_saccade", "probability for an eyeblink after a saccade (in percent)", 0.01, 1.0) |
||
53 | add_entry(eyeblink_group, "eyeblink_blocked_time", "blocking time for further eyeblinks (in seconds)", 0.1, 100.0) |
||
54 | |||
55 | breath_group = gen.add_group("breath") |
||
56 | add_entry(breath_group, "breath_period", "duration for a full breath periond: inhale, pause and exhale (in seconds)", 1.0, 100.0) |
||
57 | add_entry(breath_group, "breath_amplitude", "amplitude for breath animation (in deg)", 0.0, 10.0) |
||
58 | b6e7118f | sschulz | |
59 | exit(gen.generate(PACKAGE, "humotion", "humotion")) |