Skip to content

Commit 0cc8f05

Browse files
urfeexmergify[bot]
authored andcommitted
Reduce flakiness of trajectory controller tests (#1443)
* Set minimal velocity tolerance in passthrough trajectory test When running a quintic spline with the passthrough trajectory test there can be a minimal velocity deviation at the end of the trajectory due to how the robot interpolates motions. With a velocity tolerance of 0.0 there is a chance that we hit this tolerance. * Explicitly switch on controllers in test where they are needed (cherry picked from commit 1cd3ac5)
1 parent a22caee commit 0cc8f05

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

ur_robot_driver/test/robot_driver.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ def io_msg_cb(msg):
187187

188188
def test_trajectory(self, tf_prefix):
189189
"""Test robot movement."""
190+
self.assertTrue(
191+
self._controller_manager_interface.switch_controller(
192+
strictness=SwitchController.Request.BEST_EFFORT,
193+
deactivate_controllers=["passthrough_trajectory_controller"],
194+
activate_controllers=["scaled_joint_trajectory_controller"],
195+
).ok
196+
)
190197
# Construct test trajectory
191198
test_trajectory = [
192199
(Duration(sec=6, nanosec=0), [0.0 for j in ROBOT_JOINTS]),
@@ -219,6 +226,13 @@ def test_illegal_trajectory(self, tf_prefix):
219226
220227
This is more of a validation test that the testing suite does the right thing
221228
"""
229+
self.assertTrue(
230+
self._controller_manager_interface.switch_controller(
231+
strictness=SwitchController.Request.BEST_EFFORT,
232+
deactivate_controllers=["passthrough_trajectory_controller"],
233+
activate_controllers=["scaled_joint_trajectory_controller"],
234+
).ok
235+
)
222236
# Construct test trajectory, the second point wrongly starts before the first
223237
test_trajectory = [
224238
(Duration(sec=6, nanosec=0), [0.0 for j in ROBOT_JOINTS]),
@@ -244,6 +258,13 @@ def test_illegal_trajectory(self, tf_prefix):
244258

245259
def test_trajectory_scaled(self, tf_prefix):
246260
"""Test robot movement."""
261+
self.assertTrue(
262+
self._controller_manager_interface.switch_controller(
263+
strictness=SwitchController.Request.BEST_EFFORT,
264+
deactivate_controllers=["passthrough_trajectory_controller"],
265+
activate_controllers=["scaled_joint_trajectory_controller"],
266+
).ok
267+
)
247268
# Construct test trajectory
248269
test_trajectory = [
249270
(Duration(sec=6, nanosec=0), [0.0 for j in ROBOT_JOINTS]),
@@ -369,7 +390,7 @@ def test_passthrough_trajectory(self, tf_prefix):
369390
Duration(sec=12, nanosec=0),
370391
]
371392
goal_tolerance = [
372-
JointTolerance(position=0.01, name=tf_prefix + ROBOT_JOINTS[i])
393+
JointTolerance(position=0.01, velocity=5e-5, name=tf_prefix + ROBOT_JOINTS[i])
373394
for i in range(len(ROBOT_JOINTS))
374395
]
375396
goal_time_tolerance = Duration(sec=1, nanosec=0)

0 commit comments

Comments
 (0)