-
Notifications
You must be signed in to change notification settings - Fork 310
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
[HW interface] Resource manager publish all Command-/StateInterface values #1244
base: master
Are you sure you want to change the base?
[HW interface] Resource manager publish all Command-/StateInterface values #1244
Conversation
try | ||
{ | ||
const auto command_interface_value = | ||
resource_storage_->command_interface_map_.at(command_interface_name).get_value(); | ||
command_interface_values.interface_names.push_back(command_interface_name); | ||
command_interface_values.values.push_back(command_interface_value); | ||
} | ||
catch (const std::out_of_range & e) | ||
{ | ||
RCUTILS_LOG_WARN_NAMED( | ||
"resource_manager", | ||
"command interface '%s' is in available list, but could not get the interface " | ||
"command_interface_map_ (std::out_of_range exception thrown).", | ||
command_interface_name.c_str()); | ||
} |
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.
Alternatively you could avoid the cost of throwing-consuming an exception and just emit your log behind a key-exists-in-the-map check?
try | |
{ | |
const auto command_interface_value = | |
resource_storage_->command_interface_map_.at(command_interface_name).get_value(); | |
command_interface_values.interface_names.push_back(command_interface_name); | |
command_interface_values.values.push_back(command_interface_value); | |
} | |
catch (const std::out_of_range & e) | |
{ | |
RCUTILS_LOG_WARN_NAMED( | |
"resource_manager", | |
"command interface '%s' is in available list, but could not get the interface " | |
"command_interface_map_ (std::out_of_range exception thrown).", | |
command_interface_name.c_str()); | |
} | |
if (const auto iter = resource_storage_->command_interface_map_.find(command_interface_name); iter != resource_storage_->command_interface_map_.cend()) | |
{ | |
const auto command_interface_value = | |
*iter; | |
command_interface_values.interface_names.push_back(command_interface_name); | |
command_interface_values.values.push_back(command_interface_value); | |
} | |
else | |
{ | |
RCUTILS_LOG_WARN_NAMED( | |
"resource_manager", | |
"command interface '%s' is in available list, but could not get the interface " | |
"command_interface_map_ (std::out_of_range exception thrown).", | |
command_interface_name.c_str()); | |
} |
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.
Good one. This also makes sense.
I would only change a bit the printed log a bit.
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.
Done.
How would you change it?
hardware_interface/include/hardware_interface/resource_manager.hpp
Outdated
Show resolved
Hide resolved
hardware_interface/include/hardware_interface/resource_manager.hpp
Outdated
Show resolved
Hide resolved
} | ||
catch (const std::out_of_range & e) | ||
{ | ||
RCUTILS_LOG_WARN_NAMED( |
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.
Out of curiosity, do you think this should be throttled? or do you think it is fine to have like this?
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.
i am not sure about the performance penalty, but since this case should not happen under normal circumstances, i think its fine like this. But any thoughts/corrections are welcome.
try | ||
{ | ||
const auto command_interface_value = | ||
resource_storage_->command_interface_map_.at(command_interface_name).get_value(); | ||
command_interface_values.interface_names.push_back(command_interface_name); | ||
command_interface_values.values.push_back(command_interface_value); | ||
} | ||
catch (const std::out_of_range & e) | ||
{ | ||
RCUTILS_LOG_WARN_NAMED( | ||
"resource_manager", | ||
"command interface '%s' is in available list, but could not get the interface " | ||
"command_interface_map_ (std::out_of_range exception thrown).", | ||
command_interface_name.c_str()); | ||
} |
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.
Good one. This also makes sense.
I would only change a bit the printed log a bit.
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.
Small comment on the locking mechanism.
The messages were merged and released to Iron, Jazzy and Rolling ;) |
This pull request is in conflict. Could you fix it @mamueluth? |
This adds publishing of all the values of the command-/stateInterfaces by the resource manager. Provides a kind of diagnostic interface. The values are published to
/resource_manager_publisher_node/interface_values
.This PR depends on this PR from the control_msgs repos.