1 #include <gtest/gtest.h>
20 for (
double t = 0.1; t <= 6; t += 0.1)
23 else if (t < 2) y += .1;
24 else if (t < 3) x -= .1;
25 else if (t < 4) y -= .1;
26 else if (t < 5) z += .1;
69 for (
double t = 0.1; t < 6; t += 0.1)
72 else if (t < 2) x -= .1;
73 else if (t < 3) y += .1;
74 else if (t < 4) y -= .1;
75 else if (t < 5) z += .1;
110 geometry_msgs::Twist twist;
111 std::vector<std::string> offset_frames;
113 offset_frames.push_back(
"foo");
114 offset_frames.push_back(
"stationary_offset_child");
115 offset_frames.push_back(
"stationary_offset_parent");
118 for (std::vector<std::string>::iterator it = offset_frames.begin(); it != offset_frames.end(); ++it)
123 EXPECT_FLOAT_EQ(twist.linear.x, 1.0);
124 EXPECT_FLOAT_EQ(twist.linear.y, 0.0);
125 EXPECT_FLOAT_EQ(twist.linear.z, 0.0);
126 EXPECT_FLOAT_EQ(twist.angular.x, 0.0);
127 EXPECT_FLOAT_EQ(twist.angular.y, 0.0);
128 EXPECT_FLOAT_EQ(twist.angular.z, 0.0);
131 EXPECT_FLOAT_EQ(twist.linear.x, 0.0);
132 EXPECT_FLOAT_EQ(twist.linear.y, 1.0);
133 EXPECT_FLOAT_EQ(twist.linear.z, 0.0);
134 EXPECT_FLOAT_EQ(twist.angular.x, 0.0);
135 EXPECT_FLOAT_EQ(twist.angular.y, 0.0);
136 EXPECT_FLOAT_EQ(twist.angular.z, 0.0);
139 EXPECT_FLOAT_EQ(twist.linear.x, -1.0);
140 EXPECT_FLOAT_EQ(twist.linear.y, 0.0);
141 EXPECT_FLOAT_EQ(twist.linear.z, 0.0);
142 EXPECT_FLOAT_EQ(twist.angular.x, 0.0);
143 EXPECT_FLOAT_EQ(twist.angular.y, 0.0);
144 EXPECT_FLOAT_EQ(twist.angular.z, 0.0);
147 EXPECT_FLOAT_EQ(twist.linear.x, 0.0);
148 EXPECT_FLOAT_EQ(twist.linear.y, -1.0);
149 EXPECT_FLOAT_EQ(twist.linear.z, 0.0);
150 EXPECT_FLOAT_EQ(twist.angular.x, 0.0);
151 EXPECT_FLOAT_EQ(twist.angular.y, 0.0);
152 EXPECT_FLOAT_EQ(twist.angular.z, 0.0);
155 EXPECT_FLOAT_EQ(twist.linear.x, 0.0);
156 EXPECT_FLOAT_EQ(twist.linear.y, 0.0);
157 EXPECT_FLOAT_EQ(twist.linear.z, 1.0);
158 EXPECT_FLOAT_EQ(twist.angular.x, 0.0);
159 EXPECT_FLOAT_EQ(twist.angular.y, 0.0);
160 EXPECT_FLOAT_EQ(twist.angular.z, 0.0);
163 EXPECT_FLOAT_EQ(twist.linear.x, 0.0);
164 EXPECT_FLOAT_EQ(twist.linear.y, 0.0);
165 EXPECT_FLOAT_EQ(twist.linear.z, -1.0);
166 EXPECT_FLOAT_EQ(twist.angular.x, 0.0);
167 EXPECT_FLOAT_EQ(twist.angular.y, 0.0);
168 EXPECT_FLOAT_EQ(twist.angular.z, 0.0);
172 EXPECT_STREQ(
"", ex.what());
180 geometry_msgs::Twist twist;
184 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
185 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
186 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
187 EXPECT_NEAR(twist.angular.x, 1.0,
epsilon);
188 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
189 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
192 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
193 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
194 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
195 EXPECT_NEAR(twist.angular.x, -1.0,
epsilon);
196 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
197 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
200 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
201 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
202 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
203 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
204 EXPECT_NEAR(twist.angular.y, 1.0,
epsilon);
205 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
208 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
209 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
210 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
211 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
212 EXPECT_NEAR(twist.angular.y, -1.0,
epsilon);
213 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
216 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
217 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
218 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
219 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
220 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
221 EXPECT_NEAR(twist.angular.z, 1.0,
epsilon);
224 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
225 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
226 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
227 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
228 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
229 EXPECT_NEAR(twist.angular.z, -1.0,
epsilon);
233 EXPECT_STREQ(
"", ex.what());
240 geometry_msgs::Twist twist;
244 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
245 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
246 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
247 EXPECT_NEAR(twist.angular.x, 1.0,
epsilon);
248 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
249 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
252 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
253 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
254 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
255 EXPECT_NEAR(twist.angular.x, -1.0,
epsilon);
256 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
257 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
260 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
261 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
262 EXPECT_NEAR(twist.linear.z, -1.0,
epsilon);
263 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
264 EXPECT_NEAR(twist.angular.y, 1.0,
epsilon);
265 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
268 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
269 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
270 EXPECT_NEAR(twist.linear.z, 1.0,
epsilon);
271 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
272 EXPECT_NEAR(twist.angular.y, -1.0,
epsilon);
273 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
276 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
277 EXPECT_NEAR(twist.linear.y, 1.0,
epsilon);
278 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
279 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
280 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
281 EXPECT_NEAR(twist.angular.z, 1.0,
epsilon);
284 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
285 EXPECT_NEAR(twist.linear.y, -1.0,
epsilon);
286 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
287 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
288 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
289 EXPECT_NEAR(twist.angular.z, -1.0,
epsilon);
293 EXPECT_STREQ(
"", ex.what());
300 geometry_msgs::Twist twist;
304 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
305 EXPECT_NEAR(twist.linear.y, -1.0,
epsilon);
306 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
307 EXPECT_NEAR(twist.angular.x, 1.0,
epsilon);
308 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
309 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
312 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
313 EXPECT_NEAR(twist.linear.y, 1.0,
epsilon);
314 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
315 EXPECT_NEAR(twist.angular.x, -1.0,
epsilon);
316 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
317 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
320 EXPECT_NEAR(twist.linear.x, 1.0,
epsilon);
321 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
322 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
323 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
324 EXPECT_NEAR(twist.angular.y, 1.0,
epsilon);
325 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
328 EXPECT_NEAR(twist.linear.x, -1.0,
epsilon);
329 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
330 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
331 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
332 EXPECT_NEAR(twist.angular.y, -1.0,
epsilon);
333 EXPECT_NEAR(twist.angular.z, 0.0,
epsilon);
336 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
337 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
338 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
339 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
340 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
341 EXPECT_NEAR(twist.angular.z, 1.0,
epsilon);
344 EXPECT_NEAR(twist.linear.x, 0.0,
epsilon);
345 EXPECT_NEAR(twist.linear.y, 0.0,
epsilon);
346 EXPECT_NEAR(twist.linear.z, 0.0,
epsilon);
347 EXPECT_NEAR(twist.angular.x, 0.0,
epsilon);
348 EXPECT_NEAR(twist.angular.y, 0.0,
epsilon);
349 EXPECT_NEAR(twist.angular.z, -1.0,
epsilon);
353 EXPECT_STREQ(
"", ex.what());
358 int main(
int argc,
char **argv){
359 testing::InitGoogleTest(&argc, argv);
360 return RUN_ALL_TESTS();