humotion / cfg / humotion.cfg @ 843b8674
History | View | Annotate | Download (4.067 KB)
1 |
#!/usr/bin/env python |
---|---|
2 |
import re |
3 |
PACKAGE = "humotion" |
4 |
from dynamic_reconfigure.parameter_generator_catkin import * |
5 |
|
6 |
def fetch_default(param_name): |
7 |
for line in open("../src/server/config.cpp"): |
8 |
if param_name in line: |
9 |
result = re.findall("=\s*([\d\w.]+);", line) |
10 |
print result |
11 |
if result: |
12 |
return 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_str = fetch_default(param_name) |
19 |
default_val = float(default_str) |
20 |
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 |
|
29 |
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 |
gen = ParameterGenerator() |
40 |
|
41 |
debug_group = gen.add_group("debug") |
42 |
add_entry_bool(debug_group, "publish_internals", "publish debugging data on different topics") |
43 |
|
44 |
general_group = gen.add_group("thresholds") |
45 |
add_entry(general_group, "threshold_velocity_eye_saccade", "velocity threshold for eye saccade detection (in deg/s)", 1.0, 30.0) |
46 |
add_entry(general_group, "threshold_angle_neck_saccade", "magnitude of gaze change that triggers neck saccade (in deg)", 1.0, 30.0) |
47 |
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) |
48 |
|
49 |
neck_group = gen.add_group("neck") |
50 |
add_entry(neck_group, "scale_velocity_neck", "scaling factor for neck velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0) |
51 |
add_entry(neck_group, "scale_acceleration_neck", "scaling factor for neck acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0) |
52 |
add_entry(neck_group, "limit_velocity_neck", "limit for neck velocity (in deg/s)", 100.0, 800.0) |
53 |
add_entry(neck_group, "limit_acceleration_neck", "limit for neck acceleration (in deg/s^2)", 100.0, 10000.0) |
54 |
|
55 |
eye_group = gen.add_group("eye") |
56 |
add_entry(eye_group, "scale_velocity_eye", "scaling factor for eye velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0) |
57 |
add_entry(eye_group, "scale_acceleration_eye", "scaling factor for eye acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0) |
58 |
add_entry(eye_group, "limit_velocity_eye", "limit for eye velocity (in deg/s)", 100.0, 1000.0) |
59 |
add_entry(eye_group, "limit_acceleration_eye", "limit for eye acceleration (in deg/s^2)", 100.0, 80000.0) |
60 |
add_entry_bool(eye_group, "use_neck_target_instead_of_position_eye", "use neck target in difference calc instead of real position") |
61 |
|
62 |
|
63 |
eyeblink_group = gen.add_group("eyeblink") |
64 |
add_entry(eyeblink_group, "eyeblink_duration", "duration for an eyeblink (in seconds)", 0.01, 1.0) |
65 |
add_entry(eyeblink_group, "eyeblink_periodic_distribution_lower", "lower bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0) |
66 |
add_entry(eyeblink_group, "eyeblink_periodic_distribution_upper", "upper bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0) |
67 |
add_entry(eyeblink_group, "eyeblink_probability_after_saccade", "probability for an eyeblink after a saccade (in percent)", 0.01, 1.0) |
68 |
add_entry(eyeblink_group, "eyeblink_blocked_time", "blocking time for further eyeblinks (in seconds)", 0.1, 100.0) |
69 |
|
70 |
eyelids_group = gen.add_group("eyelids") |
71 |
add_entry_bool(eyelids_group, "eyelids_follow_eyemotion", "should the eyelids follow the eye tilt motion?") |
72 |
|
73 |
breath_group = gen.add_group("breath") |
74 |
add_entry(breath_group, "breath_period", "duration for a full breath periond: inhale, pause and exhale (in seconds)", 1.0, 100.0) |
75 |
add_entry(breath_group, "breath_amplitude", "amplitude for breath animation (in deg)", 0.0, 10.0) |
76 |
|
77 |
exit(gen.generate(PACKAGE, "humotion", "humotion")) |
78 |
|