1+ #!/usr/bin/env python
2+ from rosparam_handler .parameter_generator_catkin import *
3+ gen = ParameterGenerator ()
4+
5+ gen .add ("rate" , paramtype = "int" ,description = "Rate for timer" , default = 2 , min = 1 , max = 10 , configurable = True )
6+
7+ # Parameters with different types
8+ gen .add ("int_param" , paramtype = "int" , description = "An Integer parameter" )
9+ gen .add ("double_param" , paramtype = "double" ,description = "A double parameter" )
10+ gen .add ("str_param" , paramtype = "std::string" , description = "A string parameter" , default = "Hello World" )
11+ gen .add ("bool_param" , paramtype = "bool" , description = "A Boolean parameter" )
12+ gen .add ("vector_param" , paramtype = "std::vector<double>" , description = "A vector parameter" )
13+ gen .add ("map_param" , paramtype = "std::map<std::string,std::string>" , description = "A map parameter" )
14+
15+ # Default min and max values
16+ gen .add ("weight" , paramtype = "double" ,description = "Weight can not be negative" , min = 0.0 )
17+ gen .add ("age" , paramtype = "int" ,description = "Normal age of a human is inbetween 0 and 100" , min = 0 , max = 100 )
18+ gen .add ("default_param" , paramtype = "std::string" ,description = "Parameter with default value" , default = "Hello World" )
19+
20+ # Constant and configurable parameters
21+ gen .add ("optimal_parameter" , paramtype = "double" , description = "Optimal parameter, can not be set via rosparam" , default = 10 , constant = True )
22+ gen .add ("configurable_parameter" , paramtype = "double" , description = "This parameter can be set via dynamic_reconfigure" , configurable = True )
23+
24+ # Defining the namespace
25+ #gen.add("global_parameter", paramtype="std::string", description="This parameter is defined in the global namespace", global_scope=True)
26+
27+ # Full signature
28+ gen .add ("dummy" , paramtype = "double" , description = "My Dummy parameter" , level = 0 , edit_method = "" , default = 5.2 , min = 0 , max = 10 , configurable = True , global_scope = False , constant = False )
29+
30+ # Add an enum:
31+ gen .add_enum ("my_enum" , description = "My first self written enum" , entry_strings = ["Small" , "Medium" , "Large" , "ExtraLarge" ], default = "Medium" )
32+
33+ #Syntax : Package, Node, Config Name(The final name will be MyDummyConfig)
34+ exit (gen .generate ("rosparam_handler_tutorial" , "demo_node" , "Demo" ))
0 commit comments