Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
hpp-fcl
Commits
c79e9085
Commit
c79e9085
authored
Feb 28, 2020
by
Joseph Mirabel
Browse files
[Python] Add bindings of GJK
parent
d04f84fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
python/CMakeLists.txt
View file @
c79e9085
...
...
@@ -98,6 +98,7 @@ SET(${LIBRARY_NAME}_SOURCES
collision.cc
distance.cc
fcl.cc
gjk.cc
)
ADD_LIBRARY
(
${
LIBRARY_NAME
}
SHARED
${${
LIBRARY_NAME
}
_SOURCES
}
${${
LIBRARY_NAME
}
_HEADERS
}
)
...
...
python/fcl.cc
View file @
c79e9085
...
...
@@ -91,4 +91,5 @@ BOOST_PYTHON_MODULE(hppfcl)
exposeMeshLoader
();
exposeCollisionAPI
();
exposeDistanceAPI
();
exposeGJK
();
}
python/fcl.hh
View file @
c79e9085
...
...
@@ -9,3 +9,5 @@ void exposeMeshLoader();
void
exposeCollisionAPI
();
void
exposeDistanceAPI
();
void
exposeGJK
();
python/gjk.cc
0 → 100644
View file @
c79e9085
//
// Software License Agreement (BSD License)
//
// Copyright (c) 2020 CNRS-LAAS
// Author: Joseph Mirabel
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of CNRS-LAAS. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include
<boost/python.hpp>
#include
<boost/python/suite/indexing/vector_indexing_suite.hpp>
#include
<eigenpy/registration.hpp>
#include
"fcl.hh"
#include
<hpp/fcl/fwd.hh>
#include
<hpp/fcl/narrowphase/gjk.h>
#ifdef HPP_FCL_HAS_DOXYGEN_AUTODOC
#include
"doxygen_autodoc/functions.h"
#include
"doxygen_autodoc/hpp/fcl/narrowphase/gjk.h"
#endif
#include
"../doc/python/doxygen.hh"
#include
"../doc/python/doxygen-boost.hh"
#define DEF_RW_CLASS_ATTRIB(CLASS, ATTRIB) \
def_readwrite (#ATTRIB, &CLASS::ATTRIB, \
doxygen::class_attrib_doc<CLASS>(#ATTRIB))
#define DEF_CLASS_FUNC(CLASS, ATTRIB) \
def (#ATTRIB, &CLASS::ATTRIB, doxygen::member_func_doc(&CLASS::ATTRIB))
using
namespace
boost
::
python
;
using
namespace
hpp
::
fcl
;
using
hpp
::
fcl
::
details
::
MinkowskiDiff
;
using
hpp
::
fcl
::
details
::
GJK
;
using
hpp
::
fcl
::
details
::
EPA
;
void
exposeGJK
()
{
if
(
!
eigenpy
::
register_symbolic_link_to_registered_type
<
GJK
::
Status
>
())
{
enum_
<
GJK
::
Status
>
(
"GJKStatus"
)
.
value
(
"Valid"
,
GJK
::
Valid
)
.
value
(
"Inside"
,
GJK
::
Inside
)
.
value
(
"Failed"
,
GJK
::
Failed
)
;
}
if
(
!
eigenpy
::
register_symbolic_link_to_registered_type
<
MinkowskiDiff
>
())
{
class_
<
MinkowskiDiff
>
(
"MinkowskiDiff"
,
doxygen
::
class_doc
<
MinkowskiDiff
>
(),
init
<>
(
doxygen
::
constructor_doc
<
MinkowskiDiff
>
()))
.
def
(
"set"
,
static_cast
<
void
(
MinkowskiDiff
::*
)(
const
ShapeBase
*
,
const
ShapeBase
*
)
>
(
&
MinkowskiDiff
::
set
),
doxygen
::
member_func_doc
(
static_cast
<
void
(
MinkowskiDiff
::*
)(
const
ShapeBase
*
,
const
ShapeBase
*
)
>
(
&
MinkowskiDiff
::
set
)))
.
def
(
"set"
,
static_cast
<
void
(
MinkowskiDiff
::*
)(
const
ShapeBase
*
,
const
ShapeBase
*
,
const
Transform3f
&
tf0
,
const
Transform3f
&
tf1
)
>
(
&
MinkowskiDiff
::
set
),
doxygen
::
member_func_doc
(
static_cast
<
void
(
MinkowskiDiff
::*
)(
const
ShapeBase
*
,
const
ShapeBase
*
,
const
Transform3f
&
tf0
,
const
Transform3f
&
tf1
)
>
(
&
MinkowskiDiff
::
set
)))
.
DEF_CLASS_FUNC
(
MinkowskiDiff
,
support0
)
.
DEF_CLASS_FUNC
(
MinkowskiDiff
,
support1
)
.
DEF_CLASS_FUNC
(
MinkowskiDiff
,
support
)
.
DEF_RW_CLASS_ATTRIB
(
MinkowskiDiff
,
inflation
)
;
}
if
(
!
eigenpy
::
register_symbolic_link_to_registered_type
<
GJK
>
())
{
class_
<
GJK
>
(
"GJK"
,
doxygen
::
class_doc
<
GJK
>
(),
init
<
unsigned
int
,
FCL_REAL
>
(
doxygen
::
constructor_doc
<
GJK
,
unsigned
int
,
FCL_REAL
>
()))
.
DEF_RW_CLASS_ATTRIB
(
GJK
,
distance
)
.
DEF_RW_CLASS_ATTRIB
(
GJK
,
ray
)
.
DEF_CLASS_FUNC
(
GJK
,
evaluate
)
.
DEF_CLASS_FUNC
(
GJK
,
hasClosestPoints
)
.
DEF_CLASS_FUNC
(
GJK
,
hasPenetrationInformation
)
.
DEF_CLASS_FUNC
(
GJK
,
getClosestPoints
)
.
DEF_CLASS_FUNC
(
GJK
,
setDistanceEarlyBreak
)
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment