-
Notifications
You must be signed in to change notification settings - Fork 428
Check robot description validity on AdmittanceController and test for it #2009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
|
|
||
| #include "admittance_controller/admittance_controller.hpp" | ||
|
|
||
| #include <tinyxml2.h> | ||
| #include <cmath> | ||
| #include <memory> | ||
| #include <string> | ||
|
|
@@ -92,6 +93,33 @@ controller_interface::CallbackReturn AdmittanceController::on_init() | |
| reference_admittance_ = last_reference_; | ||
| joint_state_ = last_reference_; | ||
|
|
||
| std::string robot_description = get_node()->get_parameter("robot_description").as_string(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| if (robot_description.empty()) | ||
| { | ||
| RCLCPP_ERROR(get_node()->get_logger(), "'robot_description' parameter is empty."); | ||
| return controller_interface::CallbackReturn::ERROR; | ||
| } | ||
|
|
||
| tinyxml2::XMLDocument doc; | ||
| if (!doc.Parse(robot_description.c_str()) && doc.Error()) | ||
| { | ||
| RCLCPP_ERROR( | ||
| get_node()->get_logger(), | ||
| "Failed to parse robot description XML from parameter " | ||
| "'robot_description': %s", | ||
| doc.ErrorStr()); | ||
| return controller_interface::CallbackReturn::ERROR; | ||
| } | ||
| if (doc.Error()) | ||
| { | ||
| RCLCPP_ERROR( | ||
| get_node()->get_logger(), | ||
| "Error parsing robot description XML from parameter " | ||
| "'robot_description': %s", | ||
| doc.ErrorStr()); | ||
| return controller_interface::CallbackReturn::ERROR; | ||
| } | ||
| return controller_interface::CallbackReturn::SUCCESS; | ||
| } | ||
|
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
There was a problem hiding this comment.
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