46 #include <gtest/gtest.h>
60 std::random_device rd;
61 std::mt19937 gen(rd());
62 std::uniform_real_distribution<float> dist(-4.0
f, 4.0
f);
64 moveit_msgs::CollisionObject collision_object;
66 collision_object.header.frame_id =
"panda_link0";
67 collision_object.primitives.resize(1);
68 collision_object.primitives[0].type = shape_msgs::SolidPrimitive::BOX;
69 collision_object.primitives[0].dimensions.resize(3);
70 collision_object.primitives[0].dimensions[0] = std::abs(dist(gen));
71 collision_object.primitives[0].dimensions[1] = std::abs(dist(gen));
72 collision_object.primitives[0].dimensions[2] = std::abs(dist(gen));
73 collision_object.primitive_poses.resize(1);
74 collision_object.primitive_poses[0].position.x = dist(gen);
75 collision_object.primitive_poses[0].position.y = dist(gen);
76 collision_object.primitive_poses[0].position.z = dist(gen);
77 collision_object.primitive_poses[0].orientation.w = 1.0;
78 collision_object.operation = collision_object.ADD;
83 return collision_object;
87 std::random_device rd;
88 std::mt19937 gen(rd());
89 std::uniform_real_distribution<float> dist(-4.0f, 4.0f);
91 moveit_msgs::AttachedCollisionObject attached_collision_object;
92 attached_collision_object.link_name =
"panda_link0";
97 return attached_collision_object;
105 ASSERT_EQ(planning_scene_interface.
getObjects().size(), 0ul);
108 std::vector<moveit_msgs::CollisionObject> collision_objects;
109 collision_objects.reserve(4);
111 for (
int i = 0; i < 4; i++)
113 collision_objects.push_back(randomCollisionObject());
117 ASSERT_EQ(planning_scene_interface.
getObjects().size(), std::size_t(4));
120 planning_scene_interface.
clear();
123 ASSERT_EQ(planning_scene_interface.
getObjects().size(), 0ul);
133 std::vector<moveit_msgs::AttachedCollisionObject> attached_objects;
134 attached_objects.reserve(4);
136 for (
int i = 0; i < 4; i++)
138 attached_objects.push_back(randomAttachedCollisionObject());
145 planning_scene_interface.
clear();
157 std::vector<moveit_msgs::AttachedCollisionObject> attached_objects;
158 attached_objects.reserve(2);
160 for (
int i = 0; i < 2; i++)
162 attached_objects.push_back(randomAttachedCollisionObject());
167 std::vector<moveit_msgs::CollisionObject> collision_objects;
168 collision_objects.reserve(2);
170 for (
int i = 0; i < 2; i++)
172 collision_objects.push_back(randomCollisionObject());
181 planning_scene_interface.
clear();
187 int main(
int argc,
char** argv)
189 ros::init(argc, argv,
"planning_scene_interface_clearScene");
190 testing::InitGoogleTest(&argc, argv);
195 int test_result = RUN_ALL_TESTS();