Skip to content

Conversation

@caio-freitas
Copy link

@caio-freitas caio-freitas commented Nov 18, 2025

Fix #713

  • Uncommented test case with "bad_robot" as robot description from test suite in test_admittance_controller.cpp.
  • Updated the on_init on test_admittance_controller.hpp to only override the robot description with the one defined in the ros2_control_test_assets if not already defined.
  • On the initialization of the admittance controller, verified if the robot description is a valid xml, similar to what's done in ros2_control/hardware_interface/src/component_parser.cpp (here)

Copy link
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking this. I have some doubts if this is tested properly, see the comments

@christophfroehlich
Copy link
Member

Thinking again, is there really a need to check this inside the controller? The controller manager will not start with a broken urdf, right @saikishor ?

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @christophfroehlich that this is not needed as CM provides a valid one.

Can you explain to us, why did you have a need to do this?

@christophfroehlich
Copy link
Member

see the linked issue, but this was before we passed the robot description from the cm to the controllers. sorry for not checking that earlier. @caio-freitas would you mind in reverting this and cleanup the tests as by my comments instead?

if (!get_node()->has_parameter("robot_description"))
{
get_node()->declare_parameter("robot_description", rclcpp::ParameterType::PARAMETER_STRING);
get_node()->set_parameter({"robot_description", robot_description_});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has no effect, see the failing test

2: [ RUN      ] InvalidParameterDuringConfiguration/AdmittanceControllerTestParameterizedInvalidParameters.invalid_parameters/7
2: /workspaces/ros2_rolling_ws/src/ros2_controllers/admittance_controller/test/test_admittance_controller.cpp:73: Failure
2: Expected equality of these values:
2:   SetUpController()
2:     Which is: 1-byte object <00>
2:   controller_interface::return_type::ERROR
2:     Which is: 1-byte object <01>

Instead you have to get_parameter (to get it from the parameterized test suite) and override robot_description_ member variable, which will be used for controller_interface::ControllerInterfaceParams params in SetUpControllerCommon

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set the controller_->robot_description to the value passed to the parameter overrides before initializing the controller, since we don't have access to the overrides on TestableAdmittanceController::on_init(). Let me know if you agree with the approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

admittance_controller should fail with invalid robot_description

4 participants