7 from respeaker_node
import PARAMETERS, init_respeaker
11 dev = init_respeaker()
13 print(
'No device found. Please connect a device.')
15 with open(out,
"w")
as f:
20 # This file is automatically generated. 21 # DO NOT MODIFY THIS FILE! 23 # To generate this file, please run: 24 # cd /path/to/this/package 25 # python ./scripts/respeaker_gencfg.py 28 from dynamic_reconfigure.parameter_generator_catkin import * 30 gen = ParameterGenerator() 32 # name type level description default min max""")
34 for key, val
in PARAMETERS.items():
35 type_, max_, min_, rw_ = val[2:6]
36 desc_ =
" ".join(val[6:])
40 if type_ ==
"int" and max_ == 1
and min_ == 0:
46 gen.add("{name}", bool_t, 0, "{desc}", {def_})""".format(
47 name=key, desc=desc_, def_=def_))
50 gen.add("{name}", int_t, 0, "{desc}", {def_}, {min_}, {max_})""".format(
51 name=key, desc=desc_, def_=def_, min_=min_, max_=max_))
52 elif type_ ==
"float":
54 gen.add("{name}", double_t, 0, "{desc}", {def_:f}, {min_:f}, {max_:f})""".format(
55 name=key, desc=desc_, def_=def_, min_=min_, max_=max_))
57 print "Param '{name}' is ignored.".format(name=key)
61 exit(gen.generate("respaker_ros", "respeaker_ros", "Respeaker")) 66 print "Saved cfg to %s" % out
69 if __name__ ==
'__main__':
73 outpath = os.path.join(
74 os.path.abspath(os.path.dirname(__file__)),
75 "..",
"cfg",
"Respeaker.cfg")