13 #include <gtest/gtest.h> 27 geometry_msgs::Quaternion ans,q1,q2;
49 geometry_msgs::Quaternion ans,q1,q2;
68 geometry_msgs::Quaternion q1;
74 EXPECT_FLOAT_EQ(mat(0,0), 1.0);
75 EXPECT_FLOAT_EQ(mat(0,1), 0.0);
76 EXPECT_FLOAT_EQ(mat(0,2), 0.0);
77 EXPECT_FLOAT_EQ(mat(1,0), 0.0);
78 EXPECT_FLOAT_EQ(mat(1,1), 1.0);
79 EXPECT_FLOAT_EQ(mat(1,2), 0.0);
80 EXPECT_FLOAT_EQ(mat(2,0), 0.0);
81 EXPECT_FLOAT_EQ(mat(2,1), 0.0);
82 EXPECT_FLOAT_EQ(mat(2,2), 1.0);
91 geometry_msgs::Quaternion q1;
92 q1.x = std::sqrt((
double)0.5);
95 q1.w = std::sqrt((
double)0.5);
97 EXPECT_FLOAT_EQ(mat(0,0), 1.0);
98 EXPECT_FLOAT_EQ(mat(0,1), 0.0);
99 EXPECT_FLOAT_EQ(mat(0,2), 0.0);
100 EXPECT_FLOAT_EQ(mat(1,0), 0.0);
101 EXPECT_FLOAT_EQ(mat(1,1), 0.0);
102 EXPECT_FLOAT_EQ(mat(1,2), -1.0);
103 EXPECT_FLOAT_EQ(mat(2,0), 0.0);
104 EXPECT_FLOAT_EQ(mat(2,1), 1.0);
105 EXPECT_FLOAT_EQ(mat(2,2), 0.0);
114 geometry_msgs::Quaternion q1,q2,ans;
133 geometry_msgs::Quaternion q1,q2,ans;
154 geometry_msgs::Quaternion q1,q2,ans;
179 q2.x = std::sqrt((
double)0.5);
180 q2.y = std::sqrt((
double)0.5);
189 q2.x = std::sqrt((
double)0.4);
190 q2.y = std::sqrt((
double)0.3);
192 q2.w = std::sqrt((
double)0.3);
195 q1.x = std::sqrt((
double)0.8);
198 q1.w = std::sqrt((
double)0.2);
199 q2.x = std::sqrt((
double)0.4);
200 q2.y = std::sqrt((
double)0.3);
202 q2.w = std::sqrt((
double)0.3);
213 geometry_msgs::Quaternion q1,q2,ans;
232 geometry_msgs::Quaternion q1,q2;
233 q1.x = std::sqrt((
double)0.8);
236 q1.w = std::sqrt((
double)0.2);
237 q2.x = std::sqrt((
double)0.4);
238 q2.y = std::sqrt((
double)0.3);
240 q2.w = std::sqrt((
double)0.3);
250 geometry_msgs::Quaternion q;
251 geometry_msgs::Vector3 euler;
256 EXPECT_FLOAT_EQ(q.x,0);
257 EXPECT_FLOAT_EQ(q.y,0);
258 EXPECT_FLOAT_EQ(q.z,0);
259 EXPECT_FLOAT_EQ(q.w,1);
268 geometry_msgs::Quaternion q;
269 geometry_msgs::Vector3 euler;
275 EXPECT_FLOAT_EQ(euler.x,0);
276 EXPECT_FLOAT_EQ(euler.y,0);
277 EXPECT_FLOAT_EQ(euler.z,0);
286 geometry_msgs::Quaternion q1;
288 q1.y = std::sqrt((
double)0.5);
290 q1.w = std::sqrt((
double)0.5);
292 EXPECT_FLOAT_EQ(mat(0,0), 0.0);
293 EXPECT_FLOAT_EQ(mat(0,1), 0.0);
294 EXPECT_FLOAT_EQ(mat(0,2), 1.0);
295 EXPECT_FLOAT_EQ(mat(1,0), 0.0);
296 EXPECT_FLOAT_EQ(mat(1,1), 1.0);
297 EXPECT_FLOAT_EQ(mat(1,2), 0.0);
298 EXPECT_FLOAT_EQ(mat(2,0), -1.0);
299 EXPECT_FLOAT_EQ(mat(2,1), 0.0);
300 EXPECT_FLOAT_EQ(mat(2,2), 0.0);
310 int main(
int argc,
char **argv){
311 testing::InitGoogleTest(&argc, argv);
312 return RUN_ALL_TESTS();
geometry_msgs::Quaternion convertEulerAngleToQuaternion(geometry_msgs::Vector3 euler)
convert Euler angles to Quaternion
geometry_msgs::Quaternion getRotation(geometry_msgs::Quaternion from, geometry_msgs::Quaternion to)
Get the Rotation from 2 Quaternions.
definitions of quaternion operation
int main(int argc, char **argv)
Run all the tests that were declared with TEST()
geometry_msgs::Quaternion rotation(geometry_msgs::Quaternion from, geometry_msgs::Quaternion rotation)
rotate Quaternion
geometry_msgs::Vector3 convertQuaternionToEulerAngle(geometry_msgs::Quaternion quat)
convert Quaternion to the Euler angle
bool equals(double a, double b)
checke 2 double values are equal or not
TEST(TestSuite, testCase1)
test for + operator
geometry_msgs::Quaternion slerp(geometry_msgs::Quaternion quat1, geometry_msgs::Quaternion quat2, double t)
Spherical linear interpolation function for geometry_msgs::Quaternion.
Eigen::Matrix3d getRotationMatrix(geometry_msgs::Quaternion quat)
Get the Rotation Matrix from geometry_msgs::Quaternion.