Skip to content

Commit

Permalink
Wait for action server before sending goal (#637)
Browse files Browse the repository at this point in the history
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
  • Loading branch information
sloretz authored and jacobperron committed Apr 5, 2019
1 parent e32d179 commit b4c6462
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rclcpp_action/test/test_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

using namespace std::chrono_literals;

const auto WAIT_FOR_SERVER_TIMEOUT = 10s;

class TestClient : public ::testing::Test
{
protected:
Expand Down Expand Up @@ -269,6 +271,7 @@ TEST_F(TestClient, construction_and_destruction)
TEST_F(TestClient, async_send_goal_but_ignore_feedback_and_result)
{
auto action_client = rclcpp_action::create_client<ActionType>(client_node, action_name);
ASSERT_TRUE(action_client->wait_for_action_server(WAIT_FOR_SERVER_TIMEOUT));

ActionGoal bad_goal;
bad_goal.order = -5;
Expand All @@ -290,6 +293,7 @@ TEST_F(TestClient, async_send_goal_but_ignore_feedback_and_result)
TEST_F(TestClient, async_send_goal_and_ignore_feedback_but_wait_for_result)
{
auto action_client = rclcpp_action::create_client<ActionType>(client_node, action_name);
ASSERT_TRUE(action_client->wait_for_action_server(WAIT_FOR_SERVER_TIMEOUT));

ActionGoal goal;
goal.order = 5;
Expand All @@ -311,6 +315,7 @@ TEST_F(TestClient, async_send_goal_and_ignore_feedback_but_wait_for_result)
TEST_F(TestClient, async_send_goal_with_feedback_and_result)
{
auto action_client = rclcpp_action::create_client<ActionType>(client_node, action_name);
ASSERT_TRUE(action_client->wait_for_action_server(WAIT_FOR_SERVER_TIMEOUT));

ActionGoal goal;
goal.order = 4;
Expand Down Expand Up @@ -342,6 +347,7 @@ TEST_F(TestClient, async_send_goal_with_feedback_and_result)
TEST_F(TestClient, async_cancel_one_goal)
{
auto action_client = rclcpp_action::create_client<ActionType>(client_node, action_name);
ASSERT_TRUE(action_client->wait_for_action_server(WAIT_FOR_SERVER_TIMEOUT));

ActionGoal goal;
goal.order = 5;
Expand All @@ -359,6 +365,7 @@ TEST_F(TestClient, async_cancel_one_goal)
TEST_F(TestClient, async_cancel_all_goals)
{
auto action_client = rclcpp_action::create_client<ActionType>(client_node, action_name);
ASSERT_TRUE(action_client->wait_for_action_server(WAIT_FOR_SERVER_TIMEOUT));

ActionGoal goal;
goal.order = 6;
Expand Down Expand Up @@ -393,6 +400,7 @@ TEST_F(TestClient, async_cancel_all_goals)
TEST_F(TestClient, async_cancel_some_goals)
{
auto action_client = rclcpp_action::create_client<ActionType>(client_node, action_name);
ASSERT_TRUE(action_client->wait_for_action_server(WAIT_FOR_SERVER_TIMEOUT));

ActionGoal goal;
goal.order = 6;
Expand Down

0 comments on commit b4c6462

Please sign in to comment.