-
Notifications
You must be signed in to change notification settings - Fork 161
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
Add debug logging #187
Merged
Merged
Add debug logging #187
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6bc8433
use ROS_PACKAGE_NAME in debug msgs
dhood 97e25ea
rcl_lifecycle too
dhood 31cec6e
Swap unnamed macros to named
dhood 424baba
Remove semicolon
dhood 4de43fa
Add debug logging
dhood 7adbf48
Timer debug logging
dhood c240a3c
Wait debug
dhood e682156
A bit less wait debug...
dhood 6b4818e
Clearer time output
dhood 1ec2646
Remove the wait sublogger
dhood fc0df3a
Use conditional logging instead of the else{}
dhood bbece9e
Add 'X finalized' msg
dhood 7c7e117
Add send_response logging
dhood decb56a
Remove extra semicolons
dhood 88b8bee
Add publish/take messages
dhood 5b54487
[style nitpick] formatted variables on the next line
mikaelarguedas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ rcl_service_init( | |
} | ||
RCL_CHECK_ARGUMENT_FOR_NULL(type_support, RCL_RET_INVALID_ARGUMENT, *allocator); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(service_name, RCL_RET_INVALID_ARGUMENT, *allocator); | ||
RCUTILS_LOG_DEBUG_NAMED( | ||
ROS_PACKAGE_NAME, "Initializing service for service name '%s'", service_name) | ||
if (service->impl) { | ||
RCL_SET_ERROR_MSG("service already initialized, or memory was unintialized", *allocator); | ||
return RCL_RET_ALREADY_INIT; | ||
|
@@ -84,7 +86,7 @@ rcl_service_init( | |
rcutils_ret = rcutils_string_map_fini(&substitutions_map); | ||
if (rcutils_ret != RCUTILS_RET_OK) { | ||
RCUTILS_LOG_ERROR_NAMED( | ||
"rcl", | ||
ROS_PACKAGE_NAME, | ||
"failed to fini string_map (%d) during error handling: %s", | ||
rcutils_ret, | ||
rcutils_get_error_string_safe()) | ||
|
@@ -117,6 +119,7 @@ rcl_service_init( | |
return RCL_RET_ERROR; | ||
} | ||
} | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Expanded service name '%s'", expanded_service_name) | ||
// Validate the expanded service name. | ||
int validation_result; | ||
rmw_ret_t rmw_ret = rmw_validate_full_topic_name(expanded_service_name, &validation_result, NULL); | ||
|
@@ -136,7 +139,7 @@ rcl_service_init( | |
|
||
if (RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL == options->qos.durability) { | ||
RCUTILS_LOG_WARN_NAMED( | ||
"rcl", | ||
ROS_PACKAGE_NAME, | ||
"Warning: Setting QoS durability to 'transient local' for service servers " | ||
"can cause them to receive requests from clients that have since terminated.") | ||
} | ||
|
@@ -155,6 +158,7 @@ rcl_service_init( | |
} | ||
// options | ||
service->impl->options = *options; | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service initialized") | ||
return RCL_RET_OK; | ||
fail: | ||
if (service->impl) { | ||
|
@@ -166,6 +170,7 @@ rcl_service_init( | |
rcl_ret_t | ||
rcl_service_fini(rcl_service_t * service, rcl_node_t * node) | ||
{ | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing service") | ||
rcl_ret_t result = RCL_RET_OK; | ||
RCL_CHECK_ARGUMENT_FOR_NULL(service, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator()); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT, rcl_get_default_allocator()); | ||
|
@@ -185,6 +190,7 @@ rcl_service_fini(rcl_service_t * service, rcl_node_t * node) | |
} | ||
allocator.deallocate(service->impl, allocator.state); | ||
} | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service finalized") | ||
return result; | ||
} | ||
|
||
|
@@ -239,6 +245,7 @@ rcl_take_request( | |
rmw_request_id_t * request_header, | ||
void * ros_request) | ||
{ | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Service server taking service request") | ||
const rcl_service_options_t * options = rcl_service_get_options(service); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(request_header, RCL_RET_INVALID_ARGUMENT, options->allocator); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(ros_request, RCL_RET_INVALID_ARGUMENT, options->allocator); | ||
|
@@ -250,6 +257,8 @@ rcl_take_request( | |
RCL_SET_ERROR_MSG(rmw_get_error_string_safe(), options->allocator); | ||
return RCL_RET_ERROR; | ||
} | ||
RCUTILS_LOG_DEBUG_NAMED( | ||
ROS_PACKAGE_NAME, "Service take request succeeded: %s", taken ? "true" : "false") | ||
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. We could add a debug print to 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. |
||
if (!taken) { | ||
return RCL_RET_SERVICE_TAKE_FAILED; | ||
} | ||
|
@@ -262,6 +271,7 @@ rcl_send_response( | |
rmw_request_id_t * request_header, | ||
void * ros_response) | ||
{ | ||
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Sending service response") | ||
const rcl_service_options_t * options = rcl_service_get_options(service); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(request_header, RCL_RET_INVALID_ARGUMENT, options->allocator); | ||
RCL_CHECK_ARGUMENT_FOR_NULL(ros_response, RCL_RET_INVALID_ARGUMENT, options->allocator); | ||
|
@@ -272,7 +282,6 @@ rcl_send_response( | |
RCL_SET_ERROR_MSG(rmw_get_error_string_safe(), options->allocator); | ||
return RCL_RET_ERROR; | ||
} | ||
|
||
return RCL_RET_OK; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should this add a "client finalized" like it's done in the init function? (same for node and other node entities below)
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.
👍
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 in bbece9e