def test_make_topic_strings_quaterion(self): strings = ez_model.make_topic_strings(geo_msgs.Quaternion(), '/pose/orientation') self.assertEqual(len(strings), 4) strings = ez_model.make_topic_strings(geo_msgs.Quaternion(), '/pose/orientation', modules=[quaternion_module.QuaternionModule()]) self.assertEqual(len(strings), 1) self.assertEqual(strings[0], '/pose/orientation')
def test_make_topic_strings(self): strings = ez_model.make_topic_strings(geo_msgs.Twist(), '/cmd_vel') self.assertEqual(len(strings), 6) self.assertTrue('/cmd_vel/linear/x' in strings) self.assertTrue('/cmd_vel/linear/y' in strings) self.assertTrue('/cmd_vel/linear/z' in strings) self.assertTrue('/cmd_vel/angular/x' in strings) self.assertTrue('/cmd_vel/angular/y' in strings) self.assertTrue('/cmd_vel/angular/z' in strings)
def test_make_topic_strings_with_header(self): strings = ez_model.make_topic_strings(geo_msgs.PointStamped(), '/cmd_vel') self.assertEqual(len(strings), 7) self.assertTrue('/cmd_vel/header/seq' in strings) self.assertTrue('/cmd_vel/header/stamp/secs' in strings) self.assertTrue('/cmd_vel/header/stamp/nsecs' in strings) self.assertTrue('/cmd_vel/header/frame_id' in strings) self.assertTrue('/cmd_vel/point/x' in strings) self.assertTrue('/cmd_vel/point/y' in strings) self.assertTrue('/cmd_vel/point/z' in strings)
def test_make_topic_strings_with_array_builtin(self): strings = ez_model.make_topic_strings(sen_msgs.JointState(), '/joint_states') self.assertEqual(len(strings), 8) self.assertEqual('/joint_states/name[0]' in strings, True) self.assertEqual('/joint_states/position[0]' in strings, True)
def test_make_topic_strings_with_array_non_builtin(self): strings = ez_model.make_topic_strings(geo_msgs.Polygon(), '/polygon') self.assertEqual(len(strings), 3) self.assertEqual(strings[0], '/polygon/points[0]/x') self.assertEqual(strings[1], '/polygon/points[0]/y') self.assertEqual(strings[2], '/polygon/points[0]/z')