37 #include <gtest/gtest.h>
41 #include <urdf_parser/urdf_parser.h>
45 #include <boost/filesystem/path.hpp>
51 void makeSphere(moveit_msgs::CollisionObject& co)
54 shape_msgs::SolidPrimitive primitive;
55 primitive.type = shape_msgs::SolidPrimitive::SPHERE;
56 primitive.dimensions.push_back( 1.0);
57 co.primitives.push_back(primitive);
58 geometry_msgs::Pose pose;
59 pose.orientation.w = 1.0;
60 co.primitive_poses.push_back(pose);
64 TEST(PlanningScene, fillInObjectPoseFromPrimitive)
69 moveit_msgs::CollisionObject co;
71 co.id =
"object_no_pose";
72 co.operation = moveit_msgs::CollisionObject::ADD;
76 Eigen::Isometry3d primitive_pose;
80 <<
"scene did not use only primitive pose as object pose";
83 TEST(PlanningScene, fillInPrimitivePose)
88 moveit_msgs::CollisionObject co;
90 co.id =
"object_no_primitive_pose";
91 co.operation = moveit_msgs::CollisionObject::ADD;
93 co.pose = co.primitive_poses.at(0);
94 co.primitive_poses.resize(0);
97 Eigen::Isometry3d object_pose;
101 <<
"scene did not implicitly fill in identity pose for only primitive";
104 TEST(PlanningScene, rememberMetadataWhenAttached)
110 moveit_msgs::PlanningScene scene_msg;
111 scene_msg.robot_model_name =
robot_model->getName();
112 scene_msg.is_diff =
true;
115 moveit_msgs::CollisionObject co;
117 co.id =
"blue_sphere";
118 co.operation = moveit_msgs::CollisionObject::ADD;
119 co.pose.orientation.w = 1.0;
123 co.type.key =
"blue_sphere_type";
124 co.type.db =
"{'type':'CustomDB'}";
125 scene_msg.world.collision_objects.push_back(co);
128 moveit_msgs::ObjectColor color;
132 scene_msg.object_colors.push_back(color);
146 moveit_msgs::AttachedCollisionObject aco;
147 aco.object.operation = moveit_msgs::CollisionObject::ADD;
148 aco.object.id = co.id;
156 co.operation = moveit_msgs::CollisionObject::REMOVE;
158 <<
"scene removed attached object from collision world (although it's not there)";
161 aco.object.operation = moveit_msgs::CollisionObject::REMOVE;
168 int main(
int argc,
char** argv)
170 testing::InitGoogleTest(&argc, argv);
171 return RUN_ALL_TESTS();