def test_xml_and_urdfdom_robot_only_supported_since_melodic(self): robot = urdf.Robot(name='test', version='1.0') link = urdf.Link(name='link') link.add_aggregate( 'visual', urdf.Visual(geometry=urdf.Cylinder(length=1, radius=1), material=urdf.Material(name='mat'))) link.add_aggregate( 'visual', urdf.Visual(geometry=urdf.Cylinder(length=4, radius=0.5), material=urdf.Material(name='mat2'))) link.add_aggregate( 'collision', urdf.Collision(geometry=urdf.Cylinder(length=1, radius=1))) link.add_aggregate( 'collision', urdf.Collision(geometry=urdf.Cylinder(length=4, radius=0.5))) robot.add_link(link) link = urdf.Link(name='link2') robot.add_link(link) # robot_xml_string = robot.to_xml_string() robot_xml = minidom.parseString(robot_xml_string) orig_xml = minidom.parseString(self.xml) self.assertTrue(xml_matches(robot_xml, orig_xml))
def test_xml_and_urdfdom_robot_compatible_with_kinetic(self): robot = urdf.Robot(name='test', version='1.0') link = urdf.Link(name='link') link.visual = urdf.Visual(geometry=urdf.Cylinder(length=1, radius=1), material=urdf.Material(name='mat')) link.visual = urdf.Visual(geometry=urdf.Cylinder(length=4, radius=0.5), material=urdf.Material(name='mat2')) link.collision = urdf.Collision(geometry=urdf.Cylinder(length=1, radius=1)) link.collision = urdf.Collision(geometry=urdf.Cylinder(length=4, radius=0.5)) robot.add_link(link) link = urdf.Link(name='link2') robot.add_link(link) # robot_xml_string = robot.to_xml_string() robot_xml = minidom.parseString(robot_xml_string) orig_xml = minidom.parseString(self.xml) self.assertTrue(xml_matches(robot_xml, orig_xml))
def parse_and_compare(self, orig): xml = minidom.parseString(orig) robot = urdf.Robot.from_xml_string(orig) rewritten = minidom.parseString(robot.to_xml_string()) self.assertTrue(xml_matches(xml, rewritten))
def xml_and_compare(self, robot, xml): robot_xml_string = robot.to_xml_string() robot_xml = minidom.parseString(robot_xml_string) orig_xml = minidom.parseString(xml) self.assertTrue(xml_matches(robot_xml, orig_xml))