SMACC
Loading...
Searching...
No Matches
cp_grasping_objects.cpp
Go to the documentation of this file.
2
4{
5 bool GraspingComponent::getGraspingObject(std::string name, moveit_msgs::CollisionObject &object)
6 {
7 if (this->graspingObjects.count(name))
8 {
9 object = this->graspingObjects[name];
10 return true;
11 }
12 else
13 {
14 return false;
15 }
16 }
17
18 void GraspingComponent::createGraspableBox(std::string frameid, float x, float y, float z, float xl, float yl, float zl)
19 {
20 moveit_msgs::CollisionObject collision;
21 auto boxname = frameid;
22 ;
23 collision.id = boxname;
24 collision.header.frame_id = frameid;
25
26 collision.primitives.resize(1);
27 collision.primitives[0].type = collision.primitives[0].BOX;
28 collision.primitives[0].dimensions.resize(3);
29
30 collision.primitives[0].dimensions[0] = xl;
31 collision.primitives[0].dimensions[1] = yl;
32 collision.primitives[0].dimensions[2] = zl;
33
34 collision.primitive_poses.resize(1);
35 collision.primitive_poses[0].position.x = x;
36 collision.primitive_poses[0].position.y = y;
37 collision.primitive_poses[0].position.z = z;
38 collision.primitive_poses[0].orientation.w = 1.0;
39
40 graspingObjects[boxname] = collision;
41 }
42} // namespace cl_move_group_interface
bool getGraspingObject(std::string name, moveit_msgs::CollisionObject &object)
std::map< std::string, moveit_msgs::CollisionObject > graspingObjects
void createGraspableBox(std::string frameid, float x, float y, float z, float xl, float yl, float zl)