Go to the documentation of this file.00001
00002 PKG='cob_description'
00003 import roslib; roslib.load_manifest(PKG)
00004
00005 import sys
00006 import os
00007 import unittest
00008
00009
00010 class TestUrdf(unittest.TestCase):
00011
00012 def test_correct_format(self):
00013 print sys.argv
00014 print len(sys.argv)
00015
00016 if len(sys.argv) < 2:
00017 self.fail("no urdf file given, usage: " + os.path.basename(sys.argv[0]) + " file.urdf.xacro. \ninput parameters are: " + str(sys.argv))
00018
00019 file_to_test = sys.argv[1]
00020 print "testing " + file_to_test
00021
00022
00023 if not os.path.exists(file_to_test):
00024 self.fail('file "' + file_to_test + '" not found')
00025
00026
00027 if os.system("`rospack find xacro`/xacro.py " + file_to_test + " > /tmp/test.urdf") != 0:
00028 self.fail("cannot convert xacro. file: " + file_to_test)
00029
00030
00031 if os.system("rosrun urdfdom check_urdf /tmp/test.urdf") != 0:
00032 self.fail("urdf not correct. file: " + file_to_test)
00033
00034 if __name__ == '__main__':
00035 import rosunit
00036 rosunit.unitrun(PKG, 'test_urdf', TestUrdf)