[rcl_action] Implement goal handle#320
Conversation
jacobperron
commented
Nov 2, 2018
- 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
sloretz
left a comment
There was a problem hiding this comment.
LGTM, just minor comments
| 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); |
There was a problem hiding this comment.
nit, rcl_action_goal_handle_is_valid() also checks if goal_handle is NULL. This check could be removed.
There was a problem hiding this comment.
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:
Lines 198 to 208 in 1120b2f
subscription.c does not:
rcl/rcl/src/rcl/subscription.c
Lines 267 to 276 in 1120b2f
There was a problem hiding this comment.
Then it's a good opportunity to make it consistent :)
There was a problem hiding this comment.
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.
hidmic
left a comment
There was a problem hiding this comment.
Looks awesome! Left a few comments here and there.
| 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); |
There was a problem hiding this comment.
Then it's a good opportunity to make it consistent :)