Skip to content

[rcl_action] Implement goal handle - #320

Merged
jacobperron merged 10 commits into
masterfrom
jacob/goal_handle
Nov 6, 2018
Merged

jacobperron merged 10 commits into
masterfrom
jacob/goal_handle

Conversation

@jacobperron

Copy link
Copy Markdown
Member
  • Goal handle implementation and unit tests.
  • Added check to goal state machine transition function for index out-of-bounds

* Refactor init signature to take an rcl_allocator_t
* Add unit tests
Add check to goal state machine transition function for index out of bounds
@jacobperron jacobperron added the in progress Actively being worked on (Kanban column) label Nov 2, 2018
@jacobperron

Copy link
Copy Markdown
Member Author

CI (up to rcl_action):

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

@jacobperron jacobperron added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Nov 2, 2018
@jacobperron jacobperron self-assigned this Nov 2, 2018
@jacobperron jacobperron mentioned this pull request Nov 2, 2018
9 of 10 tasks
@jacobperron
jacobperron requested review from hidmic and sloretz November 2, 2018 20:59
Comment thread rcl_action/src/rcl_action/goal_handle.c Resolved

@sloretz sloretz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, just minor comments

Comment thread rcl_action/src/rcl_action/goal_handle.c Resolved
Comment thread rcl_action/src/rcl_action/goal_handle.c Resolved
Comment thread rcl_action/src/rcl_action/goal_handle.c Outdated
const rcl_action_goal_handle_t * goal_handle,
rcl_action_goal_state_t * status)
{
RCL_CHECK_ARGUMENT_FOR_NULL(goal_handle, RCL_RET_INVALID_ARGUMENT);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit, rcl_action_goal_handle_is_valid() also checks if goal_handle is NULL. This check could be removed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Following the service/client implementations in rcl, I thought we could make the distinction of an invalid argument vs. invalid object (ie, null argument vs uninitialized struct). But I now see that this logic is not consistent in rcl. For example,

client.c makes the distinction:

rcl/rcl/src/rcl/client.c

Lines 198 to 208 in 1120b2f

rcl_ret_t
rcl_client_fini(rcl_client_t * client, rcl_node_t * node)
{
(void)node;
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Finalizing client");
rcl_ret_t result = RCL_RET_OK;
RCL_CHECK_ARGUMENT_FOR_NULL(client, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(node, RCL_RET_INVALID_ARGUMENT);
if (!rcl_node_is_valid(node)) {
return RCL_RET_NODE_INVALID;
}

subscription.c does not:

rcl_ret_t
rcl_take_serialized_message(
const rcl_subscription_t * subscription,
rcl_serialized_message_t * serialized_message,
rmw_message_info_t * message_info)
{
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Subscription taking serialized message");
if (!rcl_subscription_is_valid(subscription)) {
return RCL_RET_SUBSCRIPTION_INVALID; // error message already set
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Then it's a good opportunity to make it consistent :)

@jacobperron jacobperron Nov 5, 2018 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed the check (and other similar redundant checks) in 8c65da8
Rather than distinguishing a null pointer vs uninitialized object by return code, we can use the error message instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Follow-up for rcl #321

@hidmic hidmic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks awesome! Left a few comments here and there.

Comment thread rcl_action/src/rcl_action/goal_handle.c Resolved
Comment thread rcl_action/src/rcl_action/goal_handle.c Outdated
const rcl_action_goal_handle_t * goal_handle,
rcl_action_goal_state_t * status)
{
RCL_CHECK_ARGUMENT_FOR_NULL(goal_handle, RCL_RET_INVALID_ARGUMENT);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Then it's a good opportunity to make it consistent :)

@jacobperron

jacobperron commented Nov 5, 2018 •

Copy link
Copy Markdown
Member Author

CI up to rcl_action:

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

@hidmic hidmic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@jacobperron

Copy link
Copy Markdown
Member Author

Fix Clang warning:

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

@jacobperron
jacobperron merged commit b2578bb into master Nov 6, 2018
@jacobperron
jacobperron deleted the jacob/goal_handle branch November 6, 2018 18:28
@jacobperron jacobperron removed the in review Waiting for review (Kanban column) label Nov 6, 2018
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.

3 participants