test-robot-hardware.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 PKG = 'hrpsys'
00004 NAME = 'test_robothardware'
00005 
00006 from hrpsys import hrpsys_config
00007 import OpenHRP
00008 
00009 import socket
00010 import rtm
00011 
00012 import unittest
00013 import rostest
00014 import sys
00015 
00016 class TestHrpsysRobotHardware(unittest.TestCase):
00017 
00018     def test_rh_service(self):
00019         try:
00020             rh = rh_svc = None
00021             rtm.nshost = 'localhost'
00022             rtm.nsport = 2809
00023             rtm.initCORBA()
00024             rh = rtm.findRTC("RobotHardware0")
00025             rh_svc = rtm.narrow(rh.service("service0"), "RobotHardwareService")
00026             print "RTC(RobotHardware0)={0}, {1}".format(rh,rh_svc)
00027             self.assertTrue(rh and rh_svc)
00028             rh.start()
00029             self.assertTrue(rh.isActive())
00030             self.assertTrue(rh_svc.getStatus())
00031 
00032         except Exception as e:
00033             print "{0}, RTC(RobotHardware0)={1}, {2}".format(str(e),rh,rh_svc)
00034             self.fail()
00035             pass
00036 
00037 #unittest.main()
00038 if __name__ == '__main__':
00039     rostest.run(PKG, NAME, TestHrpsysRobotHardware, sys.argv)


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed May 15 2019 05:02:19