Skip to content

Commit afe9f79

Browse files
authored
Update model test (backport #1848) (#1855)
* Reset ur_driver after failed configuration Otherwise consecutive configuration attempts fail because the connection isn't properly shut down. * Do not require a running robot program As long as the robot is booted and reachable, we should be able to bring the hardware interface to active. * Run robot model changes on release PRs or when the test file changes
1 parent cd51675 commit afe9f79

3 files changed

Lines changed: 26 additions & 17 deletions

File tree

.github/workflows/reusable_ici.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
- name: Checkout ${{ github.ref_name }} since build is not scheduled
5959
if: ${{ github.event_name != 'schedule' }}
6060
uses: actions/checkout@v7
61+
with:
62+
fetch-depth: 0
6163
- name: Checkout ${{ inputs.ref_for_scheduled_build }} on scheduled build
6264
if: ${{ github.event_name == 'schedule' }}
6365
uses: actions/checkout@v7
@@ -81,11 +83,32 @@ jobs:
8183
restore-keys: |
8284
ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}
8385
ccache-${{ env.CACHE_PREFIX }}
86+
- name: Detect robot models test changes
87+
id: robot_models_changes
88+
run: |
89+
changed=false
90+
set -o pipefail
91+
if [ "${{ github.event_name }}" = "pull_request" ]; then
92+
if git diff --name-only "origin/${{ github.event.pull_request.base.ref }}"...HEAD \
93+
| grep -Fxq 'ur_robot_driver/test/integration_test_robot_models.py'; then
94+
changed=true
95+
fi
96+
elif [ "${{ github.event_name }}" = "push" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
97+
if git diff --name-only "${{ github.event.before }}" "${{ github.event.after }}" \
98+
| grep -Fxq 'ur_robot_driver/test/integration_test_robot_models.py'; then
99+
changed=true
100+
fi
101+
fi
102+
echo "changed=${changed}" | tee "$GITHUB_OUTPUT"
84103
- uses: 'ros-industrial/industrial_ci@master'
85104
env:
86105
UPSTREAM_WORKSPACE: ${{ inputs.upstream_workspace }}
87106
ROS_DISTRO: ${{ inputs.ros_distro }}
88107
ROS_REPO: ${{ inputs.ros_repo }}
89-
CMAKE_ARGS: -DUR_ROBOT_DRIVER_BUILD_INTEGRATION_TESTS=ON
90-
# ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'release') && '-DUR_ROBOT_DRIVER_RUN_ROBOT_MODELS_TEST=ON' || '' }}
91108
ADDITIONAL_DEBS: docker.io netcat-openbsd curl # Needed for integration tests
109+
CMAKE_ARGS: >-
110+
-DUR_ROBOT_DRIVER_BUILD_INTEGRATION_TESTS=ON
111+
${{ (
112+
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'release'))
113+
|| steps.robot_models_changes.outputs.changed == 'true'
114+
) && '-DUR_ROBOT_DRIVER_RUN_ROBOT_MODELS_TEST=ON' || '' }}

ur_robot_driver/src/hardware_interface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ URPositionHardwareInterface::on_configure(const rclcpp_lifecycle::State& previou
833833
<< " but the driver was configured for type '" << ur_type
834834
<< "'. Please check the 'ur_type' parameter and make sure it matches your "
835835
"actual robot. This can lead to critical inaccuracies of tcp positions.");
836+
ur_driver_.reset();
836837
return hardware_interface::CallbackReturn::ERROR;
837838
}
838839
}

ur_robot_driver/test/integration_test_robot_models.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
sys.path.append(os.path.dirname(__file__))
5656
from test_common import ( # noqa: E402
5757
ControllerManagerInterface,
58-
DashboardInterface,
59-
IoStatusInterface,
6058
generate_driver_test_description_for_model,
6159
)
6260

@@ -108,19 +106,6 @@ def tearDownClass(cls):
108106

109107
def _check_active_hardware_interface(self, ursim_type, driver_type):
110108
"""Bring the robot up and assert the hardware component is active."""
111-
# The IO controller (and therefore ``resend_robot_program``) is only
112-
# available when the hardware interface configured successfully, so we
113-
# connect to it lazily here.
114-
dashboard_interface = DashboardInterface(self.node)
115-
io_status_controller_interface = IoStatusInterface(self.node)
116-
117-
dashboard_interface.start_robot()
118-
time.sleep(1)
119-
self.assertTrue(
120-
io_status_controller_interface.resend_robot_program().success,
121-
f"Could not resend robot program for ursim={ursim_type}, driver={driver_type}",
122-
)
123-
124109
hardware_info = self._controller_manager_interface.list_hardware_components()
125110
self.assertIsNotNone(
126111
hardware_info,

0 commit comments

Comments
 (0)