test_sr_ur_unlock_bimanual.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright 2021 Shadow Robot Company Ltd.
3 #
4 # This program is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the Free
6 # Software Foundation version 2 of the License.
7 #
8 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 # more details.
12 #
13 # You should have received a copy of the GNU General Public License along
14 # with this program. If not, see <http://www.gnu.org/licenses/>.
15 
16 import rospy
17 import rostest
18 from actionlib_msgs.msg import GoalStatusArray
19 from unittest import TestCase
20 from std_msgs.msg import Bool
21 from std_srvs.srv import Trigger
22 from ur_dashboard_msgs.srv import IsProgramRunning
23 from sr_robot_launch.sr_ur_arm_unlock import SrUrUnlock
24 from sr_robot_launch.mock_sr_ur_robot_hw import MockUrRobotHW
25 from ur_dashboard_msgs.msg import SafetyMode, ProgramState, RobotMode
26 from sr_robot_launch.common_sr_ur_unlock_tests import CommonTests
27 import sys
28 
29 
31  """
32  Tests sr_ur_arm_unlock
33  """
34  @classmethod
35  def setUpClass(cls):
36  cls.service_string = {}
37  cls.namespaces = ['/ra_sr_ur_robot_hw', '/la_sr_ur_robot_hw']
38  cls.params = ['/headless_mode']
39  for ns in cls.namespaces:
40  for param in cls.params:
41  rospy.set_param(ns + param, True)
42  cls.service_string['right'] = '/ra_sr_ur_robot_hw/dashboard/program_running'
43  cls.service_string['left'] = '/la_sr_ur_robot_hw/dashboard/program_running'
45  cls.mock_dashboard = {}
46  cls.mock_dashboard['left'] = MockUrRobotHW('left')
47  cls.mock_dashboard['right'] = MockUrRobotHW('right')
48 
49  def setUp(self):
50  for key, value in self.mock_dashboard.items():
51  value.reinitialize()
52 
53  def tearDown(self):
54  pass
55 
56  @classmethod
57  def tearDownClass(cls):
58  pass
59 
61  self.arm_fault_bimanual(['left'])
62 
64  self.arm_fault_bimanual(['right'])
65 
67  self.arm_fault_bimanual(['right', 'left'])
68 
70  self.arm_setup('left')
71 
73  self.arm_setup('right')
74 
75  def test_fault_left(self):
76  self.fault('left')
77 
78  def test_fault_right(self):
79  self.fault('right')
80 
82  self.e_stop('right', release_estop_before_pedal=True)
83 
84  def test_e_stop_left_1(self):
85  self.e_stop('left', release_estop_before_pedal=True)
86 
88  self.e_stop('right', release_estop_before_pedal=False)
89 
90  def test_e_stop_left_2(self):
91  self.e_stop('left', release_estop_before_pedal=False)
92 
94  self.arm_power_cycle('left')
95 
97  self.arm_power_cycle('right')
98 
100  self.arm_mock_dashboard_server('left')
101 
103  self.arm_mock_dashboard_server('right')
104 
106  self.arm_setup('left')
107 
109  self.arm_setup('right')
110 
111 
112 if __name__ == "__main__":
113  PKGNAME = 'sr_robot_launch'
114  NODENAME = 'test_sr_ur_unlock_bimanual'
115  rospy.init_node(NODENAME)
116  rostest.rosrun(PKGNAME, NODENAME, TestSrUrUnlockBimanual)
def e_stop(self, side, release_estop_before_pedal=True)


sr_robot_launch
Author(s): Kirsty Ellis
autogenerated on Mon Feb 28 2022 23:52:27