Skip to content
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

a rosout publisher of a node might not exist #1115

Conversation

iuhilnehc-ynos
Copy link
Collaborator

@iuhilnehc-ynos iuhilnehc-ynos commented Nov 3, 2023

to return OK if add/remove sublogger if the rosout publisher not exist
rather than using a new `get` function.

Signed-off-by: Chen Lihui <lihui.chen@sony.com>
@iuhilnehc-ynos
Copy link
Collaborator Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

rcl/src/rcl/logging_rosout.c Show resolved Hide resolved
rcl/src/rcl/logging_rosout.c Outdated Show resolved Hide resolved
@sea-bass
Copy link

sea-bass commented Nov 5, 2023

Thanks for looking at this fix so quickly!

Just leaving a comment here that this should also be backported to Iron.

Signed-off-by: Chen Lihui <lihui.chen@sony.com>
@iuhilnehc-ynos
Copy link
Collaborator Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

lgtm

rcl/include/rcl/logging_rosout.h Show resolved Hide resolved
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
@iuhilnehc-ynos
Copy link
Collaborator Author

@clalancette Could you please help review it?

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

I've left a couple of things I think we can improve here, but overall it looks good.

@@ -213,7 +213,7 @@ rcl_logging_rosout_output_handler(
* \param[in] sublogger_name a sublogger name
* \return #RCL_RET_OK if the subordinate logger was created successfully, or
* \return #RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
* \return #RCL_RET_SUBLOGGER_ALREADY_EXIST if the subordinate logger already exists, or
* \return #RCL_RET_NOT_FOUND if the parent logger not exists, or
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* \return #RCL_RET_NOT_FOUND if the parent logger not exists, or
* \return #RCL_RET_NOT_FOUND if the parent logger does not exist, or

@@ -242,6 +242,7 @@ rcl_logging_rosout_add_sublogger(
* \param[in] sublogger_name a sublogger name
* \return #RCL_RET_OK if the subordinate logger was finalized successfully, or
* \return #RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
* \return #RCL_RET_NOT_FOUND if the sublogger not exists, or
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* \return #RCL_RET_NOT_FOUND if the sublogger not exists, or
* \return #RCL_RET_NOT_FOUND if the sublogger does not exist, or

Comment on lines 445 to 449
if (RCL_RET_OK != (status = rcl_convert_rcutils_ret_to_rcl_ret(rcutils_ret))) {
if (RCL_RET_NOT_FOUND == status) {
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING("Failed to get logger entry for '%s'.", logger_name);
}
return status;
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 we can make this easier to read with:

Suggested change
if (RCL_RET_OK != (status = rcl_convert_rcutils_ret_to_rcl_ret(rcutils_ret))) {
if (RCL_RET_NOT_FOUND == status) {
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING("Failed to get logger entry for '%s'.", logger_name);
}
return status;
if (RCUTILS_RET_OK != rcutils_ret) {
if (RCUTILS_RET_NOT_FOUND == status) {
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING("Failed to get logger entry for '%s'.", logger_name);
}
return rcl_convert_rcutils_ret_to_rcl_ret(rcutils_ret);

Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
@iuhilnehc-ynos
Copy link
Collaborator Author

I've left a couple of things I think we can improve here, but overall it looks good.

Thank you. Updated in b376e58.

@iuhilnehc-ynos
Copy link
Collaborator Author

iuhilnehc-ynos commented Nov 14, 2023

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

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.

Exception when instantiating ActionServer as part of ROS package tests
5 participants