我有两个对象。第一个物体是我的机器人,我想把它表示成一个物体,第二个物体是形状未知的障碍物。我想用一个八叉树来表示障碍物的形状。
如何使用fcl的api来检查这两个对象(真或假)之间的冲突,使用ROS维基的api使用fcl库?考虑到机器人正在移动。
此外,使用激光扫描数据来检测障碍物??如何在八叉树对象中填充??
如果我创建了一个像这样的shere对象
boost::shared_ptr<Sphere> Shpere0(new Sphere(1));我如何确定这个球体的中心是机器人的中心?
编辑:
我写了以下代码,但我不知道如何填充八叉树
boost::shared_ptr<Sphere> Shpere0(new Sphere(1));
OcTree* tree = new OcTree(boost::shared_ptr<const octomap::OcTree>(generateOcTree()));
// GJKSolver_indep solver;
GJKSolver_libccd solver;
Vec3f contact_points;
FCL_REAL penetration_depth;
Vec3f normal;
Transform3f tf0, tf1;
tf0.setIdentity();
// is this the postion in x,y and x
tf0.setTranslation(Vec3f(robotpose(0),robotpose(1),robotpose(2)));
tf0.setQuatRotation(Quaternion3f(0, 0, 0, 0));
// HOW TO FILL the OCTREE HERE with point cloud data ???
tf1.setIdentity();
bool res = solver.shapeIntersect(*Shpere0, tf0, *box1, tf1, &contact_points, &penetration_depth, &normal);
cout << "contact points: " << contact_points << endl;
cout << "pen depth: " << penetration_depth << endl;
cout << "normal: " << normal << endl;
cout << "result: " << res << endl;
static const int num_max_contacts = std::numeric_limits<int>::max();
static const bool enable_contact = true;
fcl::CollisionResult result;
fcl::CollisionRequest request(num_max_contacts, enable_contact);
CollisionObject co0(Shpere0, tf0);
CollisionObject co1(tree, tf1);
bool res_1 = fcl::collide(&co0, &co1, request, result);那么,有什么建议吗?
发布于 2015-05-12 21:04:53
https://stackoverflow.com/questions/28472523
复制相似问题