Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

found and fixed the bug caused by libccd argument #69

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pybind/collision_detection/fcl/pybind_fcl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void build_pyfcl(py::module &m) {

/********** narrowphase *******/
auto PyGJKSolverType = py::enum_<GJKSolverType>(m, "GJKSolverType");
PyGJKSolverType.value("GST_LIBCCD", GJKSolverType::GST_LIBCCD)
PyGJKSolverType.value("GST_LIBCCD", GJKSolverType::GST_INDEP)
.value("GST_INDEP", GJKSolverType::GST_INDEP)
.export_values();

Expand All @@ -243,7 +243,7 @@ void build_pyfcl(py::module &m) {
py::arg("num_max_contacts") = 1, py::arg("enable_contact") = false,
py::arg("num_max_cost_sources") = 1, py::arg("enable_cost") = false,
py::arg("use_approximate_cost") = true,
py::arg("gjk_solver_type") = GJKSolverType::GST_LIBCCD,
py::arg("gjk_solver_type") = GJKSolverType::GST_INDEP,
py::arg("gjk_tolerance") = 1e-6)
.def("isSatisfied", &CollisionRequest::isSatisfied, py::arg("result"));

Expand Down Expand Up @@ -282,7 +282,7 @@ void build_pyfcl(py::module &m) {
py::arg("enable_nearest_points") = false,
py::arg("enable_signed_distance") = false, py::arg("rel_err") = 0.0,
py::arg("abs_err") = 0.0, py::arg("distance_tolerance") = 1e-6,
py::arg("gjk_solver_type") = GJKSolverType::GST_LIBCCD)
py::arg("gjk_solver_type") = GJKSolverType::GST_INDEP)
.def("isSatisfied", &DistanceRequest::isSatisfied, py::arg("result"));

// DistanceResult
Expand Down
7 changes: 6 additions & 1 deletion tests/test_fcl_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest
import numpy as np
from transforms3d.quaternions import mat2quat
from mplib.pymp.collision_detection.fcl import FCLModel
from mplib.pymp.collision_detection.fcl import FCLModel, Box, CollisionObject, Plane, distance, DistanceRequest
from mplib.pymp.kinematics.pinocchio import PinocchioModel

FILE_ABS_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -65,5 +65,10 @@ def test_collision(self):
is_collision = [collision.is_collision() for collision in collisions]
self.assertFalse(any(is_collision))

def test_distance(self):
ground_obj = CollisionObject(Plane([0, 0, 1], 0), [0, 0, 0], [1, 0, 0, 0])
box_obj = CollisionObject(Box(1,1,1), [0, 0, 5.5], [1, 0, 0, 0])
self.assertEqual(distance(ground_obj, box_obj, DistanceRequest()).min_distance, 5)

if __name__ == "__main__":
unittest.main()