Commit cdb0a72d authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[Python] Update bindings with requirements from Pinocchio.

parent 3351029d
......@@ -222,6 +222,8 @@ void exposeCollisionGeometries ()
.def ("computeMomentofInertia", &CollisionGeometry::computeMomentofInertia)
.def ("computeVolume", &CollisionGeometry::computeVolume)
.def ("computeMomentofInertiaRelatedToCOM", &CollisionGeometry::computeMomentofInertiaRelatedToCOM)
.def_readwrite("aabb_radius",&CollisionGeometry::aabb_radius,"AABB radius")
;
exposeShapes();
......
......@@ -33,6 +33,7 @@
// POSSIBILITY OF SUCH DAMAGE.
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "fcl.hh"
......@@ -65,7 +66,9 @@ void exposeCollisionAPI ()
.def_readwrite ("break_distance" , &CollisionRequest::break_distance)
;
class_ <Contact> ("Contact", no_init)
class_ <Contact> ("Contact", init<>())
//.def(init<CollisionGeometryPtr_t, CollisionGeometryPtr_t, int, int>())
//.def(init<CollisionGeometryPtr_t, CollisionGeometryPtr_t, int, int, Vec3f, Vec3f, FCL_REAL>())
.def_readonly ("o1", &Contact::o1)
.def_readonly ("o2", &Contact::o2)
.def_readwrite ("b1", &Contact::b1)
......@@ -76,9 +79,16 @@ void exposeCollisionAPI ()
.def (self == self)
;
class_< std::vector<Contact> >("StdVec_Contact")
.def(vector_indexing_suite< std::vector<Contact> >())
;
class_ <CollisionResult> ("CollisionResult", init<>())
.def ("isCollision", &CollisionResult::isCollision)
.def ("numContacts", &CollisionResult::numContacts)
.def ("getContact" , &CollisionResult::getContact , return_value_policy<copy_const_reference>())
.def ("getContacts", &CollisionResult::getContacts, return_internal_reference<>())
.def ("addContact" , &CollisionResult::addContact )
.def ("clear", &CollisionResult::clear)
;
......
......@@ -45,6 +45,12 @@ using namespace hpp::fcl;
using boost::shared_ptr;
using boost::noncopyable;
struct DistanceRequestWrapper
{
static Vec3f getNearestPoint1(const DistanceResult & res) { return res.nearest_points[0]; }
static Vec3f getNearestPoint2(const DistanceResult & res) { return res.nearest_points[1]; }
};
void exposeDistanceAPI ()
{
class_ <DistanceRequest> ("DistanceRequest", init<optional<bool,FCL_REAL,FCL_REAL> >())
......@@ -57,6 +63,8 @@ void exposeDistanceAPI ()
.def_readwrite ("min_distance", &DistanceResult::min_distance)
.def_readwrite ("normal", &DistanceResult::normal)
//.def_readwrite ("nearest_points", &DistanceResult::nearest_points)
.def("getNearestPoint1",&DistanceRequestWrapper::getNearestPoint1)
.def("getNearestPoint2",&DistanceRequestWrapper::getNearestPoint2)
.def_readonly ("o1", &DistanceResult::o1)
.def_readonly ("o2", &DistanceResult::o2)
.def_readwrite ("b1", &DistanceResult::b1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment