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
Contributor

@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


#include "admittance_controller/admittance_controller.hpp"

#include <tinyxml2.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

we'll need to add this as dependency (do we need to link against in the Cmake file?)
https://github.com/ros/urdfdom/blob/973baf479512b0b34951b3d5ebb616c22990d781/package.xml#L20

reference_admittance_ = last_reference_;
joint_state_ = last_reference_;

std::string robot_description = get_node()->get_parameter("robot_description").as_string();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this. The admittance controller doesn't use the robot_description parameter, but uses this->get_robot_description() from controller_interface_base since #1247. We should use this here as well obviously.
For the tests, you have to set controller_->robot_description_ to override this.

Copy link
Member

Choose a reason for hiding this comment

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

worst case we may have some work left to refactor on this controller to use the URDF we pass to the controller, we shouldn't fetch a param: https://github.com/ros-controls/ros2_control/pull/1088/files

Copy link
Contributor

Choose a reason for hiding this comment

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

as i've seen we don't parse it as a parameter any more, that's only a remnant in the tests

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

Choose a reason for hiding this comment

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

I think this can be deleted, I don't find any usage of robot_description_semantic?

Copy link
Contributor

Choose a reason for hiding this comment

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

L393-394 has commented code regarding robot_description, this should also be deleted.

@christophfroehlich
Copy link
Contributor

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
Contributor

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?

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