49 shapes::ShapePtr ball = std::make_shared<shapes::Sphere>(1.0);
50 shapes::ShapePtr box = std::make_shared<shapes::Box>(1, 2, 3);
51 shapes::ShapePtr cyl = std::make_shared<shapes::Cylinder>(4, 5);
53 EXPECT_EQ(1, ball.use_count());
58 world.
addToObject(
"ball", ball, Eigen::Isometry3d::Identity());
60 EXPECT_EQ(2, ball.use_count());
63 bool move_ok = world.
moveShapeInObject(
"ball", ball, Eigen::Isometry3d(Eigen::Translation3d(0, 0, 9)));
66 EXPECT_EQ(2, ball.use_count());
70 EXPECT_FALSE(rm_nonexistant);
73 EXPECT_FALSE(rm_wrong_shape);
75 EXPECT_EQ(2, ball.use_count());
76 EXPECT_EQ(1, box.use_count());
82 EXPECT_EQ(1, ball.use_count());
86 world.
addToObject(
"ball", ball, Eigen::Isometry3d::Identity());
88 EXPECT_EQ(2, ball.use_count());
94 std::vector<shapes::ShapeConstPtr>
shapes;
95 EigenSTL::vector_Isometry3d poses;
101 poses.push_back(Eigen::Isometry3d(Eigen::Translation3d(0, 0, 1)));
102 poses.push_back(Eigen::Isometry3d(Eigen::Translation3d(0, 0, 2)));
103 poses.push_back(Eigen::Isometry3d(Eigen::Translation3d(0, 0, 3)));
113 EXPECT_EQ(2, box.use_count());
114 EXPECT_EQ(2, cyl.use_count());
115 EXPECT_EQ(3, ball.use_count());
118 world.
addToObject(
"ball2", ball, Eigen::Isometry3d(Eigen::Translation3d(0, 0, 4)));
120 EXPECT_EQ(2, box.use_count());
121 EXPECT_EQ(2, cyl.use_count());
122 EXPECT_EQ(4, ball.use_count());
127 EXPECT_EQ(2, box.use_count());
128 EXPECT_EQ(1, cyl.use_count());
129 EXPECT_EQ(4, ball.use_count());
132 EXPECT_FALSE(rm_cyl);
134 EXPECT_EQ(2, box.use_count());
135 EXPECT_EQ(1, cyl.use_count());
136 EXPECT_EQ(4, ball.use_count());
140 EXPECT_EQ(3u, world.
size());
143 World::ObjectConstPtr obj = world.
getObject(
"mix1");
144 EXPECT_EQ(2, obj.use_count());
146 ASSERT_EQ(2u, obj->shapes_.size());
147 ASSERT_EQ(2u, obj->shape_poses_.size());
150 EXPECT_EQ(1.0, obj->shape_poses_[0](2, 3));
151 EXPECT_EQ(3.0, obj->shape_poses_[1](2, 3));
153 move_ok = world.
moveShapeInObject(
"mix1", ball, Eigen::Isometry3d(Eigen::Translation3d(0, 0, 5)));
154 EXPECT_TRUE(move_ok);
156 World::ObjectConstPtr obj2 = world.
getObject(
"mix1");
157 EXPECT_EQ(2, obj2.use_count());
158 EXPECT_EQ(1, obj.use_count());
160 EXPECT_EQ(1.0, obj2->shape_poses_[0](2, 3));
161 EXPECT_EQ(5.0, obj2->shape_poses_[1](2, 3));
163 EXPECT_EQ(1.0, obj->shape_poses_[0](2, 3));
164 EXPECT_EQ(3.0, obj->shape_poses_[1](2, 3));
167 EXPECT_EQ(3, box.use_count());
168 EXPECT_EQ(1, cyl.use_count());
169 EXPECT_EQ(5, ball.use_count());
173 EXPECT_EQ(2u, world.
size());
176 EXPECT_EQ(3, box.use_count());
177 EXPECT_EQ(1, cyl.use_count());
178 EXPECT_EQ(5, ball.use_count());
184 World::ObjectConstPtr obj3 = world.
getObject(
"abc");
188 EXPECT_EQ(1, box.use_count());
189 EXPECT_EQ(1, cyl.use_count());
190 EXPECT_EQ(3, ball.use_count());
192 EXPECT_EQ(2u, world.
size());
196 EXPECT_EQ(1, box.use_count());
197 EXPECT_EQ(1, cyl.use_count());
198 EXPECT_EQ(1, ball.use_count());
204 EXPECT_EQ(0u, world.
size());
382 return trackChangesNotify(ta,
object, action);
386 shapes::ShapePtr ball = std::make_shared<shapes::Sphere>(1.0);
387 shapes::ShapePtr box = std::make_shared<shapes::Box>(1, 1, 1);
388 shapes::ShapePtr cyl = std::make_shared<shapes::Cylinder>(0.5, 3);
393 EXPECT_EQ(1, ta.
cnt_);
394 EXPECT_EQ(
"mix1", ta.
obj_.
id_);
398 world.
addToObject(
"mix1", box, Eigen::Isometry3d::Identity());
399 world.
addToObject(
"mix1", cyl, Eigen::Isometry3d(Eigen::Translation3d(0, 0, 2)));
402 subframes[
"frame1"] = Eigen::Isometry3d(Eigen::Translation3d(0, 0, 2));
403 subframes[
"frame2"] = Eigen::Isometry3d(Eigen::Translation3d(0, 1, 0));
407 bool found_ok, found_bad;
408 Eigen::Isometry3d pose = world.
getTransform(
"mix1/frame1", found_ok);
409 EXPECT_TRUE(found_ok);
410 EXPECT_EQ(2.0, pose(2, 3));
413 EXPECT_TRUE(found_ok);
414 EXPECT_EQ(1.0, pose(1, 3));
415 EXPECT_EQ(0.0, pose(2, 3));
418 EXPECT_FALSE(found_bad);
421 world.
setObjectPose(
"mix1", Eigen::Isometry3d(Eigen::Translation3d(0, 0, 1)));
424 EXPECT_TRUE(found_ok);
425 EXPECT_EQ(3.0, pose(2, 3));
428 EXPECT_TRUE(found_ok);
429 EXPECT_EQ(1.0, pose(1, 3));
430 EXPECT_EQ(1.0, pose(2, 3));
433 EXPECT_TRUE(found_ok);
434 EXPECT_EQ(1.0, pose(2, 3));
436 World::ObjectConstPtr obj = world.
getObject(
"mix1");
437 EXPECT_EQ(0.0, obj->shape_poses_[0](2, 3));
438 EXPECT_EQ(2.0, obj->shape_poses_[1](2, 3));
441 world.
moveObject(
"mix1", Eigen::Isometry3d(Eigen::Translation3d(0, 0, 1)));
444 EXPECT_TRUE(found_ok);
445 EXPECT_EQ(2.0, pose(2, 3));
448 EXPECT_TRUE(found_ok);
449 EXPECT_EQ(4.0, pose(2, 3));
451 EXPECT_EQ(0.0, obj->shape_poses_[0](2, 3));
452 EXPECT_EQ(2.0, obj->shape_poses_[1](2, 3));
455 world.
setObjectPose(
"mix1", Eigen::Isometry3d(Eigen::Translation3d(0, 0, 1)));
457 EXPECT_TRUE(found_ok);
458 EXPECT_EQ(1.0, pose(2, 3));