test_openni_desc.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 PKG = 'openni_description'
00005 
00006 import os
00007 import subprocess
00008 import unittest
00009 
00010 import rospkg
00011 import xacro
00012 
00013 
00014 class TestOpenniDescription(unittest.TestCase):
00015 
00016     def setUp(self):
00017         pass
00018 
00019     def tearDown(self):
00020         True
00021 
00022     def test_urdf_turtlebot(self):
00023         """
00024         Check if check_urdf command passes with the urdf that is generated in
00025         the .test file this test case is called from.
00026         """
00027         resulted_urdf_file_relpath = "./sample_kobuki.urdf"
00028         kobuki_xacro_file_path = rospkg.RosPack().get_path('openni_description') + "/test/model/kobuki_description/sample_kobuki.urdf.xacro"
00029         self.assertTrue(os.path.isfile(kobuki_xacro_file_path))
00030         xacro_output_memory = xacro.process_file(kobuki_xacro_file_path)
00031         xacro_output_file = xacro.open_output(resulted_urdf_file_relpath)
00032         xacro_output_file.write(xacro_output_memory.toprettyxml(indent='  '))
00033         xacro_output_file.close()
00034         self.assertTrue(os.path.isfile(resulted_urdf_file_relpath))
00035         self.assertEqual(0, subprocess.call(["check_urdf", resulted_urdf_file_relpath]))
00036 
00037 if __name__ == '__main__':
00038     import rostest
00039     rostest.rosrun(PKG, 'test_openni_description', TestOpenniDescription) 


openni_description
Author(s): Isaac I.Y. Saito
autogenerated on Thu Jun 6 2019 20:16:19