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

Adds action interaction tests #352

Merged
merged 6 commits into from
Dec 6, 2018
Merged

Adds action interaction tests #352

merged 6 commits into from
Dec 6, 2018

Conversation

apojomovsky
Copy link
Contributor

Adds two tests based on the action_proposal sequence diagrams found here and here.

@tfoote tfoote added the in progress Actively being worked on (Kanban column) label Dec 5, 2018
Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor comments.


#include "test_msgs/action/fibonacci.h"

#ifdef RMW_IMPLEMENTATION
Copy link
Member

Choose a reason for hiding this comment

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

I guess we'll need some cmake logic for testing multiple RMW implementations. Perhaps we can rebase after #351 is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, just did as suggested. tests are now running against multiple RWM implementations. thanks!

ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
context = rcl_get_zero_initialized_context();
ret = rcl_init(0, nullptr, &init_options, &context);

Copy link
Member

Choose a reason for hiding this comment

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

nit: Remove the empty line since the assert below is associated with rcl_init above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!

EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
rcl_reset_error();

EXPECT_TRUE(this->is_goal_request_ready) << rcl_get_error_string().str;
Copy link
Member

Choose a reason for hiding this comment

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

If there was an error string, it was reset at L218.
In general, I'm not sure if we need to call rcl_reset_error() in the tests unless we're expecting an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just did as suggested, thanks!

EXPECT_EQ(outgoing_goal_request.order, incoming_goal_request.order);
rcl_reset_error();
EXPECT_TRUE(uuidcmp(outgoing_goal_request.uuid, incoming_goal_request.uuid));
rcl_reset_error();
Copy link
Member

Choose a reason for hiding this comment

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

This rcl_reset_error() is redundant with the previous since uuidcmp does not set an error. But again, we might be able to remove most, if not all, of the rcl_reset_error() calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!

test_msgs__action__Fibonacci_Result_Request__fini(&incoming_result_request);
test_msgs__action__Fibonacci_Result_Request__fini(&outgoing_result_request);
test_msgs__action__Fibonacci_Result_Response__fini(&incoming_result_response);
test_msgs__action__Fibonacci_Result_Response__fini(&outgoing_result_response);
Copy link
Member

Choose a reason for hiding this comment

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

Missing finalize calls for feedback messages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, fixed. thanks!

outgoing_cancel_request.goal_info.stamp.nanosec,
incoming_cancel_request.goal_info.stamp.nanosec);

rcl_action_cancel_request_t cancel_request = rcl_action_get_zero_initialized_cancel_request();
Copy link
Member

Choose a reason for hiding this comment

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

rcl_action_action_msgs__srv__CancelGoal_Request is typedef'd to rcl_action_cancel_request_t, so I think this logic for doing the "conversion" is not necessary. I may be mistaken, but I think we can use incoming_cancel_request directly with rcl_action_process_cancel_request. Note, the same is not true for rcl_action_cancel_response_t.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, it wasn't needed. Done!

&this->action_server, &cancel_request, &cancel_response);
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;

// Initialize cancel response
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to do this, or can we use cancel_response.msg directly? Perhaps asserting some things about it first, e.g. EXPECT_EQ(cancel_response.msg.goals_canceling.size, 2u).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just removed that initialization part

ASSERT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
rcl_reset_error();

ret = rcl_wait(&this->wait_set, 1000000);
Copy link
Member

Choose a reason for hiding this comment

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

RCL_S_TO_NS(1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oop, done!

// the server accepting the goal (synchronous). Upon accepting the goal, the
// action server starts a user defined execution method for completing the goal.
// Following the goal request, the client makes an asynchronous request for the
// result. The user defined method publishes feedback to the action client as it
Copy link
Member

Choose a reason for hiding this comment

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

The sentences about the "user defined method" are not really relevant to rcl, but are referring to client library implementations built on top of rcl. We can probably omit that part of the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right. done, thanks!


// Exercises the "Example 2" sequence diagram found in the actions_proposal document.
// This example is almost identical to the first, but this time the action client requests
// for the goal to be canceled mid-execution. Note that the user defined method is allowed
Copy link
Member

Choose a reason for hiding this comment

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

Same thing about the "user defined method", we can probably remove that sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, done!

@apojomovsky
Copy link
Contributor Author

CI status:
Linux: Build Status
Linux aarch64: Build Status
MacOS: Build Status
Windows: Build Status

@apojomovsky
Copy link
Contributor Author

Thanks for the review @jacobperron , just finished addressing your comments. PTAL

Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@sloretz sloretz merged commit c5798e4 into ros2:master Dec 6, 2018
@sloretz sloretz removed the in progress Actively being worked on (Kanban column) label Dec 6, 2018
@apojomovsky apojomovsky deleted the apojomovsky/action_interaction_tests branch December 7, 2018 12:31
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.

4 participants