Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 import unittest
00039
00040 import rostest
00041
00042 from nextage_ros_bridge import nextage_client
00043
00044 _GOINITIAL_TIME_MIDSPEED = 3
00045 _PKG = 'nextage_ros_bridge'
00046
00047
00048 class TestNxoHandlight(unittest.TestCase):
00049 '''
00050 Test NextageClient with rostest. This does NOT test hardware (i.e. if DIO
00051 is connected and functioning); instead, this only verifies if the
00052 software works as to the given hardware spec.
00053
00054 For tests involving hardware, follow
00055 https://github.com/start-jsk/rtmros_hironx/issues/272.
00056 '''
00057
00058 @classmethod
00059 def setUpClass(cls):
00060 cls._robot = nextage_client.NextageClient()
00061 cls._robot.init()
00062 cls._robot.goInitial(_GOINITIAL_TIME_MIDSPEED)
00063
00064
00065 cls._robot_04 = nextage_client.NextageClient()
00066 cls._robot_04.set_hand_version(version=cls._robot_04.HAND_VER_0_4_2)
00067 cls._robot_04.init()
00068 cls._robot_04.goInitial(_GOINITIAL_TIME_MIDSPEED)
00069
00070 @classmethod
00071 def tearDownClass(cls):
00072 cls._robot.goInitial(_GOINITIAL_TIME_MIDSPEED)
00073 cls._robot_04.goInitial(_GOINITIAL_TIME_MIDSPEED)
00074
00075
00076
00077
00078
00079 def test_handlight_r_02(self):
00080 if self._robot.simulation_mode:
00081 result = self._robot._hands.handlight_r(is_on=False)
00082 self.assertTrue(result)
00083 else:
00084 result = self._robot._hands.handlight_r(is_on=True)
00085 self.assertTrue(result)
00086
00087 def test_handlight_r_04(self):
00088 if self._robot.simulation_mode:
00089 result = self._robot_04.handlight_r(is_on=False)
00090 self.assertTrue(result)
00091 else:
00092 result = self._robot_04.handlight_r(is_on=True)
00093 self.assertTrue(result)
00094
00095 def test_handlight_l_02(self):
00096 if self._robot.simulation_mode:
00097 result = self._robot._hands.handlight_l(is_on=False)
00098 self.assertFalse(result)
00099 else:
00100 result = self._robot._hands.handlight_l(is_on=True)
00101 self.assertTrue(result)
00102
00103 def test_handlight_l_04(self):
00104 if self._robot.simulation_mode:
00105 result = self._robot_04.handlight_l(is_on=False)
00106 self.assertTrue(result)
00107 else:
00108 result = self._robot_04.handlight_l(is_on=True)
00109 self.assertTrue(result)
00110
00111 def test_handlight_both_02(self):
00112 if self._robot.simulation_mode:
00113
00114 result = self._robot._hands.handlight_both(is_on=False)
00115 self.assertFalse(result)
00116 else:
00117 result = self._robot._hands.handlight_both(is_on=True)
00118 self.assertTrue(result)
00119
00120 def test_handlight_both_04(self):
00121 if self._robot.simulation_mode:
00122
00123 result = self._robot_04.handlight_both(is_on=False) and result
00124 self.assertFalse(result)
00125 else:
00126 result = self._robot_04.handlight_both(is_on=True) and result
00127 self.assertTrue(result)
00128
00129 if __name__ == '__main__':
00130 rostest.rosrun(_PKG, 'test_nxo_handlight', TestNxoHandlight)