1 #include <gtest/gtest.h> 7 for (
int j = 0; j < m1.cols(); ++j)
9 for (
int i = 0; i < m1.rows(); ++i)
11 EXPECT_NEAR(m2(i, j), m1(i, j), 1e-7);
16 TEST(TestJointPositionIntegrator, TestParameterLoading)
23 TEST(TestJointPositionIntegrator, TestIntegrationSingleValue)
30 q_up = integrator.
update(q_dot, q, dt);
34 TEST(TestJointPositionIntegrator, TestIntegrationMultipleValues)
39 q_dot.data << 0.01 * Eigen::VectorXd::Ones(14);
41 int num_integration = 10;
42 for (
unsigned int i = 0; i < num_integration; i++)
44 q_up = integrator.
update(q_dot, q, dt);
49 TEST(TestJointPositionIntegrator, TestReset)
54 q_dot.data << Eigen::VectorXd::Ones(14);
56 q_up = integrator.
update(q_dot, q, dt);
61 q_up = integrator.
update(q_dot, q_prev, dt);
64 q_up = integrator.
update(q_dot, q, dt);
68 TEST(TestJointPositionIntegrator, TestSaturatedIntegration)
74 ASSERT_TRUE(nh.
getParam(
"max_joint_error", max_error));
76 q_dot.data << (max_error + 0.0001) / dt;
77 q_up = integrator.
update(q_dot, q, dt);
81 int main(
int argc,
char **argv)
84 ::testing::InitGoogleTest(&argc, argv);
85 return RUN_ALL_TESTS();
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool assertMatrixEquality(const Eigen::MatrixXd &m1, const Eigen::MatrixXd &m2)
bool getParam(const std::string &key, std::string &s) const
int main(int argc, char **argv)
TEST(TestJointPositionIntegrator, TestParameterLoading)