Skip to content

Commit 0585800

Browse files
URJalaFelix Exner (fexner)
authored andcommitted
Implemented test of get_version service and integrated it with the test of tool contact
1 parent dffccc6 commit 0585800

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ur_robot_driver/test/robot_driver.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,20 @@ def test_trajectory_scaled(self, tf_prefix):
249249
)
250250
self.assertEqual(result.error_code, FollowJointTrajectory.Result.SUCCESSFUL)
251251

252+
def test_tool_contact(self, tf_prefix):
253+
if self._io_status_controller_interface.get_version().major < 5:
254+
start_result = self._io_status_controller_interface.start_tool_contact()
255+
self.assertEqual(start_result.success, False)
256+
257+
end_result = self._io_status_controller_interface.end_tool_contact()
258+
self.assertEqual(end_result.success, False)
259+
else:
260+
start_result = self._io_status_controller_interface.start_tool_contact()
261+
self.assertEqual(start_result.success, True)
262+
263+
end_result = self._io_status_controller_interface.end_tool_contact()
264+
self.assertEqual(end_result.success, True)
265+
252266
def test_trajectory_scaled_aborts_on_violation(self, tf_prefix):
253267
"""Test that the robot correctly aborts the trajectory when the constraints are violated."""
254268
# Construct test trajectory

ur_robot_driver/test/test_common.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
IsProgramRunning,
5353
Load,
5454
)
55-
from ur_msgs.srv import SetIO
55+
from ur_msgs.srv import SetIO, GetVersion
5656

5757
TIMEOUT_WAIT_SERVICE = 10
5858
TIMEOUT_WAIT_SERVICE_INITIAL = 120 # If we download the docker image simultaneously to the tests, it can take quite some time until the dashboard server is reachable and usable.
@@ -240,7 +240,12 @@ class IoStatusInterface(
240240
_ServiceInterface,
241241
namespace="/io_and_status_controller",
242242
initial_services={"set_io": SetIO},
243-
services={"resend_robot_program": Trigger},
243+
services={
244+
"resend_robot_program": Trigger,
245+
"start_tool_contact": Trigger,
246+
"end_tool_contact": Trigger,
247+
"get_version": GetVersion,
248+
},
244249
):
245250
pass
246251

0 commit comments

Comments
 (0)