Verify robot model (backport #1779)#1791
Conversation
* Verify the robot type on startup (#1771) Check the ur_type parameter given from ROS with the type that the driver is actually connected to. If they don't match, hardware configuration fails. * By default, disable robot verification To not break the behavior, this feature gets disabled by default and is opt-in. I enabled it in the integration tests to always run. (cherry picked from commit f30e3e8) # Conflicts: # ur_robot_driver/src/hardware_interface.cpp
|
Cherry-pick of f30e3e8 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default mode and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a732b02. Configure here.
| "headless_mode": "true", | ||
| "launch_dashboard_client": "true", | ||
| "start_joint_controller": "false", | ||
| "verify_robot_model": "true", |
There was a problem hiding this comment.
verify_robot_model not forwarded through ur_control.launch.py
High Severity
The ur_control.launch.py file, which sits between the test/user and ur_rsp.launch.py, neither declares verify_robot_model as a launch argument nor forwards it in its rsp include (which only passes robot_ip and ur_type). The test sets "verify_robot_model": "true" targeting ur_control.launch.py, but this value is silently dropped — ur_rsp.launch.py always falls back to its default of "false". The entire robot model verification feature is therefore non-functional through the standard launch chain, and the negative mismatch test case would incorrectly pass.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a732b02. Configure here.
| std::string ur_type = info_.hardware_parameters["ur_type"]; | ||
| auto expected_type = robotTypeFromString(ur_type); | ||
| auto robot_type = ur_driver_->getPrimaryClient()->getRobotType(); | ||
| auto robot_series = ur_driver_->getPrimaryClient()->getRobotSeries(); |
There was a problem hiding this comment.
Unconditional ur_type lookup crashes when parameter absent
High Severity
Lines 717–720 unconditionally read ur_type from hardware parameters and call robotTypeFromString, even when verify_robot_model is false (the default). If the URDF lacks the new ur_type param (e.g. any existing user who hasn't updated their xacro), robotTypeFromString("") throws std::invalid_argument outside any try-catch, crashing on_configure. These lines are only needed when verification is enabled and belong inside the if (verify_robot_model) block at line 728. This directly contradicts the PR's goal of making the feature opt-in without breaking existing setups.
Reviewed by Cursor Bugbot for commit a732b02. Configure here.


This is a manual backport of #1771 making the new feature opt-in rather than opt-out. This way, it will not change the behavior of existing systems.
This is an automatic backport of pull request #1779 done by Mergify.
Note
Medium Risk
Touches
URPositionHardwareInterface::on_configurestartup path and can now fail-fast whenverify_robot_modelis enabled or when custom configs omit the newly-requiredur_typehardware param. Behavior remains unchanged by default (verify_robot_model=false), but misconfiguration could prevent the driver from configuring.Overview
Adds an opt-in
verify_robot_modelparameter (plumbed throughur_rsp.launch.pyandur.urdf/ros2_controlxacros) and updates the hardware interface to compare the configuredur_typeagainst the robot-reported type/series duringon_configure, failing with a fatal error on mismatch.Introduces
UR_ROBOT_DRIVER_RUN_ROBOT_MODELS_TESTand a newintegration_test_robot_models.pythat boots URSim for each supported model (plus a negative mismatch case); GitHub Actions enables this extra-long test only on PRs labeledrelease.Reviewed by Cursor Bugbot for commit 23f30cd. Bugbot is set up for automated code reviews on this repo. Configure here.