Skip to content

Commit

Permalink
add pose check in test
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Jun 30, 2020
1 parent 814017c commit 1b88b37
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/integration/velocity_control_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,12 @@ class VelocityControlTest : public ::testing::TestWithParam<int>
EXPECT_EQ(poses[0], pose);
}


// Publish command and check that vehicle moved
transport::Node node;
auto pub = node.Advertise<msgs::Twist>(_cmdVelTopic);

msgs::Twist msg;

// Avoid wheel slip by limiting acceleration
// Avoid wheel slip by limiting acceleration (1 m/s^2)
// and max velocity (0.5 m/s).
// See <max_velocity< and <max_aceleration> parameters
Expand Down Expand Up @@ -123,6 +121,19 @@ class VelocityControlTest : public ::testing::TestWithParam<int>
int maxSleep = 30;

ASSERT_NE(maxSleep, sleep);

// verify that the vehicle is moving in +x and rotating towards +y
for (unsigned int i = 1001; i < poses.size(); ++i)
{
EXPECT_GT(poses[i].Pos().X(), poses[i-1].Pos().X());
EXPECT_GT(poses[i].Pos().Y(), poses[i-1].Pos().Y());
EXPECT_NEAR(poses[i].Pos().Z(), poses[i-1].Pos().Z(), 1e-5);
EXPECT_NEAR(poses[i].Rot().Euler().X(),
poses[i-1].Rot().Euler().X(), 1e-5);
EXPECT_NEAR(poses[i].Rot().Euler().Y(),
poses[i-1].Rot().Euler().Y(), 1e-5);
EXPECT_GT(poses[i].Rot().Euler().Z(), poses[i-1].Rot().Euler().Z());
}
}
};

Expand Down

0 comments on commit 1b88b37

Please sign in to comment.