integration_test_utils.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 #
5 # Copyright © 2018 Pilz GmbH & Co. KG
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 
19 import rospy
20 import threading
21 from pilz_robot_programming.robot import RobotMoveFailed
22 
23 
24 def waited_trigger(cv, func):
25  with cv:
26  cv.wait()
27  func()
28 
29 
30 class MoveThread(threading.Thread):
31  def __init__(self, robot, cmd):
32  threading.Thread.__init__(self)
33  self._robot = robot
34  self._cmd = cmd
35  self.exception_thrown = False
36 
37  def run(self):
38  rospy.logdebug("Start motion...")
39  try:
40  self._robot.move(self._cmd)
41  except RobotMoveFailed:
42  rospy.logdebug("Caught expected exception.")
43  self.exception_thrown = True


pilz_industrial_motion_testutils
Author(s):
autogenerated on Mon Apr 6 2020 03:17:28