2 from rosparam_handler.param.DefaultsParameters
import DefaultsParameters
9 tests defaults on server 12 params = DefaultsParameters()
13 self.assertEqual(params.int_param_w_default, 1)
14 self.assertAlmostEqual(params.double_param_w_default, 1.1)
15 self.assertEqual(params.str_param_w_default,
"Hello World")
16 self.assertEqual(params.bool_param_w_default,
True)
18 self.assertEqual(params.vector_int_param_w_default, [1, 2, 3])
19 self.assertEqual(params.vector_double_param_w_default, [1.1, 1.2, 1.3])
20 self.assertEqual(params.vector_string_param_w_default, [
"Hello",
"World"])
22 self.assertEqual(params.map_param_w_default, {
"Hello":
"World"})
23 self.assertEqual(params.enum_param_w_default, 1)
26 params = DefaultsParameters()
28 self.assertEqual(params.int_param_w_default, rospy.get_param(
"~int_param_w_default"))
29 self.assertAlmostEqual(params.double_param_w_default, rospy.get_param(
"~double_param_w_default"))
30 self.assertEqual(params.str_param_w_default, rospy.get_param(
"~str_param_w_default"))
31 self.assertEqual(params.bool_param_w_default, rospy.get_param(
"~bool_param_w_default"))
33 self.assertEqual(params.vector_int_param_w_default, rospy.get_param(
"~vector_int_param_w_default"))
34 self.assertEqual(params.vector_double_param_w_default, rospy.get_param(
"~vector_double_param_w_default"))
35 self.assertEqual(params.vector_string_param_w_default, rospy.get_param(
"~vector_string_param_w_default"))
37 self.assertEqual(params.map_param_w_default, rospy.get_param(
"~map_param_w_default"))
38 self.assertEqual(params.enum_param_w_default, rospy.get_param(
"~enum_param_w_default"))
41 params = DefaultsParameters()
43 params.int_param_w_default = 2
44 params.double_param_w_default = 2.2
45 params.str_param_w_default =
"World Hello" 46 params.bool_param_w_default =
False 47 params.vector_int_param_w_default = [3, 2, 1];
48 params.vector_double_param_w_default = [1.3, 1.2, 1.2];
49 params.vector_bool_param_w_default = [
True,
False];
50 params.vector_string_param_w_default = [
"World",
"Hello"];
51 params.map_param_w_default = {
"World":
"Hello"};
52 params.enum_param_w_default = 2;
55 params.to_param_server()
58 self.assertEqual(params.int_param_w_default, rospy.get_param(
"~int_param_w_default"))
59 self.assertAlmostEqual(params.double_param_w_default, rospy.get_param(
"~double_param_w_default"))
60 self.assertEqual(params.str_param_w_default, rospy.get_param(
"~str_param_w_default"))
61 self.assertEqual(params.bool_param_w_default, rospy.get_param(
"~bool_param_w_default"))
63 self.assertEqual(params.vector_int_param_w_default, rospy.get_param(
"~vector_int_param_w_default"))
64 self.assertEqual(params.vector_double_param_w_default, rospy.get_param(
"~vector_double_param_w_default"))
65 self.assertEqual(params.vector_string_param_w_default, rospy.get_param(
"~vector_string_param_w_default"))
67 self.assertEqual(params.map_param_w_default, rospy.get_param(
"~map_param_w_default"))
68 self.assertEqual(params.enum_param_w_default, rospy.get_param(
"~enum_param_w_default"))
def test_set_parameters_on_server(self)
def test_defaults_on_server(self)