Skip to content

Commit d77bc8f

Browse files
committed
Clean up all the test setups and remove irrelevant tests
1 parent 5a2297b commit d77bc8f

File tree

5 files changed

+7
-76
lines changed

5 files changed

+7
-76
lines changed

ur_robot_driver/test/integration_test_config_controller.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@
3535
import launch_testing
3636
import pytest
3737
import rclpy
38-
from control_msgs.action import FollowJointTrajectory
3938
from rclpy.node import Node
4039

4140
sys.path.append(os.path.dirname(__file__))
4241
from test_common import ( # noqa: E402
43-
ActionInterface,
4442
ControllerManagerInterface,
4543
DashboardInterface,
4644
IoStatusInterface,
@@ -76,17 +74,6 @@ def init_robot(self):
7674
self._io_status_controller_interface = IoStatusInterface(self.node)
7775
self._configuration_controller_interface = ConfigurationInterface(self.node)
7876

79-
self._scaled_follow_joint_trajectory = ActionInterface(
80-
self.node,
81-
"/scaled_joint_trajectory_controller/follow_joint_trajectory",
82-
FollowJointTrajectory,
83-
)
84-
self._passthrough_forward_joint_trajectory = ActionInterface(
85-
self.node,
86-
"/passthrough_trajectory_controller/follow_joint_trajectory",
87-
FollowJointTrajectory,
88-
)
89-
9077
def setUp(self):
9178
self._dashboard_interface.start_robot()
9279
time.sleep(1)

ur_robot_driver/test/integration_test_io_controller.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,14 @@
3636
import launch_testing
3737
import pytest
3838
import rclpy
39-
from control_msgs.action import FollowJointTrajectory
4039
from rclpy.node import Node
4140
from ur_msgs.msg import IOStates
4241

4342
sys.path.append(os.path.dirname(__file__))
4443
from test_common import ( # noqa: E402
45-
ActionInterface,
4644
ControllerManagerInterface,
4745
DashboardInterface,
4846
IoStatusInterface,
49-
ConfigurationInterface,
5047
generate_driver_test_description,
5148
)
5249

@@ -76,18 +73,6 @@ def init_robot(self):
7673
self._dashboard_interface = DashboardInterface(self.node)
7774
self._controller_manager_interface = ControllerManagerInterface(self.node)
7875
self._io_status_controller_interface = IoStatusInterface(self.node)
79-
self._configuration_controller_interface = ConfigurationInterface(self.node)
80-
81-
self._scaled_follow_joint_trajectory = ActionInterface(
82-
self.node,
83-
"/scaled_joint_trajectory_controller/follow_joint_trajectory",
84-
FollowJointTrajectory,
85-
)
86-
self._passthrough_forward_joint_trajectory = ActionInterface(
87-
self.node,
88-
"/passthrough_trajectory_controller/follow_joint_trajectory",
89-
FollowJointTrajectory,
90-
)
9176

9277
def setUp(self):
9378
self._dashboard_interface.start_robot()

ur_robot_driver/test/integration_test_passthrough_controller.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
ControllerManagerInterface,
5050
DashboardInterface,
5151
IoStatusInterface,
52-
ConfigurationInterface,
5352
generate_driver_test_description,
5453
ROBOT_JOINTS,
5554
TIMEOUT_EXECUTE_TRAJECTORY,
@@ -101,22 +100,15 @@ def init_robot(self):
101100

102101
self._controller_manager_interface = ControllerManagerInterface(self.node)
103102
self._io_status_controller_interface = IoStatusInterface(self.node)
104-
self._configuration_controller_interface = ConfigurationInterface(self.node)
105103

106-
self._scaled_follow_joint_trajectory = ActionInterface(
107-
self.node,
108-
"/scaled_joint_trajectory_controller/follow_joint_trajectory",
109-
FollowJointTrajectory,
110-
)
111104
self._passthrough_forward_joint_trajectory = ActionInterface(
112105
self.node,
113106
"/passthrough_trajectory_controller/follow_joint_trajectory",
114107
FollowJointTrajectory,
115108
)
116109

117110
def setUp(self):
118-
if self._dashboard_interface:
119-
self._dashboard_interface.start_robot()
111+
self._dashboard_interface.start_robot()
120112
time.sleep(1)
121113
self.assertTrue(self._io_status_controller_interface.resend_robot_program().success)
122114

ur_robot_driver/test/integration_test_scaled_joint_controller.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
ControllerManagerInterface,
4949
DashboardInterface,
5050
IoStatusInterface,
51-
ConfigurationInterface,
5251
generate_driver_test_description,
5352
ROBOT_JOINTS,
5453
TIMEOUT_EXECUTE_TRAJECTORY,
@@ -80,18 +79,12 @@ def init_robot(self):
8079
self._dashboard_interface = DashboardInterface(self.node)
8180
self._controller_manager_interface = ControllerManagerInterface(self.node)
8281
self._io_status_controller_interface = IoStatusInterface(self.node)
83-
self._configuration_controller_interface = ConfigurationInterface(self.node)
8482

8583
self._scaled_follow_joint_trajectory = ActionInterface(
8684
self.node,
8785
"/scaled_joint_trajectory_controller/follow_joint_trajectory",
8886
FollowJointTrajectory,
8987
)
90-
self._passthrough_forward_joint_trajectory = ActionInterface(
91-
self.node,
92-
"/passthrough_trajectory_controller/follow_joint_trajectory",
93-
FollowJointTrajectory,
94-
)
9588

9689
def setUp(self):
9790
self._dashboard_interface.start_robot()

ur_robot_driver/test/test_mock_hardware.py

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def tearDownClass(cls):
7676
cls.node.destroy_node()
7777
rclpy.shutdown()
7878

79+
# Connect to all interfaces and actions, even ones we know won't work with mock hardware (Except dashboard)
7980
def init_robot(self):
80-
self._dashboard_interface = None
8181
self._controller_manager_interface = ControllerManagerInterface(self.node)
8282
self._io_status_controller_interface = IoStatusInterface(self.node)
8383
self._configuration_controller_interface = ConfigurationInterface(self.node)
@@ -88,9 +88,11 @@ def init_robot(self):
8888
FollowJointTrajectory,
8989
)
9090

91-
def setUp(self):
92-
time.sleep(1)
93-
self.assertTrue(self._io_status_controller_interface.resend_robot_program().success)
91+
self._passthrough_forward_joint_trajectory = ActionInterface(
92+
self.node,
93+
"/passthrough_trajectory_controller/follow_joint_trajectory",
94+
FollowJointTrajectory,
95+
)
9496

9597
#
9698
# Test functions
@@ -165,31 +167,3 @@ def test_illegal_trajectory(self, tf_prefix):
165167

166168
# Verify the failure is correctly detected
167169
self.assertFalse(goal_handle.accepted)
168-
169-
def test_trajectory_scaled(self, tf_prefix):
170-
"""Test robot movement."""
171-
# Construct test trajectory
172-
test_trajectory = [
173-
(Duration(sec=6, nanosec=0), [0.0 for j in ROBOT_JOINTS]),
174-
(Duration(sec=6, nanosec=500000000), [-1.0 for j in ROBOT_JOINTS]),
175-
]
176-
177-
trajectory = JointTrajectory(
178-
joint_names=[tf_prefix + joint for joint in ROBOT_JOINTS],
179-
points=[
180-
JointTrajectoryPoint(positions=test_pos, time_from_start=test_time)
181-
for (test_time, test_pos) in test_trajectory
182-
],
183-
)
184-
185-
# Execute trajectory
186-
logging.info("Sending goal for robot to follow")
187-
goal_handle = self._scaled_follow_joint_trajectory.send_goal(trajectory=trajectory)
188-
self.assertTrue(goal_handle.accepted)
189-
190-
# Verify execution
191-
result = self._scaled_follow_joint_trajectory.get_result(
192-
goal_handle,
193-
TIMEOUT_EXECUTE_TRAJECTORY,
194-
)
195-
self.assertEqual(result.error_code, FollowJointTrajectory.Result.SUCCESSFUL)

0 commit comments

Comments
 (0)