mplib2 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mplib2-0.3.0/CMakeLists.txt +97 -0
- mplib2-0.3.0/CMakeModules/Findcppad.cmake +36 -0
- mplib2-0.3.0/CMakeModules/Findcppadcg.cmake +29 -0
- mplib2-0.3.0/LICENSE +22 -0
- mplib2-0.3.0/MANIFEST.in +19 -0
- mplib2-0.3.0/PKG-INFO +140 -0
- mplib2-0.3.0/README.md +106 -0
- mplib2-0.3.0/VERSION +1 -0
- mplib2-0.3.0/include/mplib/collision_detection/collision_common.h +74 -0
- mplib2-0.3.0/include/mplib/collision_detection/collision_matrix.h +187 -0
- mplib2-0.3.0/include/mplib/collision_detection/fcl/collision_common.h +98 -0
- mplib2-0.3.0/include/mplib/collision_detection/fcl/fcl_model.h +334 -0
- mplib2-0.3.0/include/mplib/collision_detection/fcl/fcl_utils.h +43 -0
- mplib2-0.3.0/include/mplib/collision_detection/fcl/types.h +39 -0
- mplib2-0.3.0/include/mplib/collision_detection/types.h +33 -0
- mplib2-0.3.0/include/mplib/core/articulated_model.h +260 -0
- mplib2-0.3.0/include/mplib/core/attached_body.h +107 -0
- mplib2-0.3.0/include/mplib/kinematics/kdl/kdl_model.h +74 -0
- mplib2-0.3.0/include/mplib/kinematics/kdl/kdl_utils.h +14 -0
- mplib2-0.3.0/include/mplib/kinematics/pinocchio/pinocchio_model.h +396 -0
- mplib2-0.3.0/include/mplib/kinematics/pinocchio/types.h +22 -0
- mplib2-0.3.0/include/mplib/kinematics/types.h +21 -0
- mplib2-0.3.0/include/mplib/macros/assert.h +8 -0
- mplib2-0.3.0/include/mplib/macros/class_forward.h +39 -0
- mplib2-0.3.0/include/mplib/planning/ompl/fixed_joint.h +56 -0
- mplib2-0.3.0/include/mplib/planning/ompl/general_constraint.h +33 -0
- mplib2-0.3.0/include/mplib/planning/ompl/ompl_planner.h +125 -0
- mplib2-0.3.0/include/mplib/planning/ompl/ompl_utils.h +57 -0
- mplib2-0.3.0/include/mplib/planning/ompl/types.h +25 -0
- mplib2-0.3.0/include/mplib/planning/ompl/validity_checker.h +47 -0
- mplib2-0.3.0/include/mplib/planning/types.h +14 -0
- mplib2-0.3.0/include/mplib/planning_world.h +528 -0
- mplib2-0.3.0/include/mplib/types.h +50 -0
- mplib2-0.3.0/include/mplib/utils/assimp_loader.h +48 -0
- mplib2-0.3.0/include/mplib/utils/color_printing.h +51 -0
- mplib2-0.3.0/include/mplib/utils/conversion.h +44 -0
- mplib2-0.3.0/include/mplib/utils/pose.h +105 -0
- mplib2-0.3.0/include/mplib/utils/random.h +22 -0
- mplib2-0.3.0/include/mplib/utils/urdf_types.h +22 -0
- mplib2-0.3.0/mplib/__init__.py +12 -0
- mplib2-0.3.0/mplib/collision_detection/__init__.py +3 -0
- mplib2-0.3.0/mplib/collision_detection/fcl.py +3 -0
- mplib2-0.3.0/mplib/examples/__init__.py +0 -0
- mplib2-0.3.0/mplib/examples/collision_avoidance.py +117 -0
- mplib2-0.3.0/mplib/examples/constrained_planning.py +145 -0
- mplib2-0.3.0/mplib/examples/demo.py +93 -0
- mplib2-0.3.0/mplib/examples/demo_setup.py +205 -0
- mplib2-0.3.0/mplib/examples/detect_collision.py +93 -0
- mplib2-0.3.0/mplib/examples/moving_robot.py +111 -0
- mplib2-0.3.0/mplib/examples/two_stage_motion.py +203 -0
- mplib2-0.3.0/mplib/kinematics/__init__.py +3 -0
- mplib2-0.3.0/mplib/kinematics/kdl.py +3 -0
- mplib2-0.3.0/mplib/kinematics/pinocchio.py +3 -0
- mplib2-0.3.0/mplib/planner.py +899 -0
- mplib2-0.3.0/mplib/planning/__init__.py +3 -0
- mplib2-0.3.0/mplib/planning/ompl.py +3 -0
- mplib2-0.3.0/mplib/py.typed +0 -0
- mplib2-0.3.0/mplib/pymp/__init__.pyi +955 -0
- mplib2-0.3.0/mplib/pymp/collision_detection/__init__.pyi +314 -0
- mplib2-0.3.0/mplib/pymp/collision_detection/fcl.pyi +1124 -0
- mplib2-0.3.0/mplib/pymp/kinematics/__init__.pyi +7 -0
- mplib2-0.3.0/mplib/pymp/kinematics/kdl.pyi +64 -0
- mplib2-0.3.0/mplib/pymp/kinematics/pinocchio.pyi +359 -0
- mplib2-0.3.0/mplib/pymp/planning/__init__.pyi +7 -0
- mplib2-0.3.0/mplib/pymp/planning/ompl.pyi +97 -0
- mplib2-0.3.0/mplib/sapien_utils/__init__.py +1 -0
- mplib2-0.3.0/mplib/sapien_utils/conversion.py +874 -0
- mplib2-0.3.0/mplib/sapien_utils/srdf_exporter.py +100 -0
- mplib2-0.3.0/mplib/sapien_utils/urdf_exporter.py +194 -0
- mplib2-0.3.0/mplib/urdf_utils.py +171 -0
- mplib2-0.3.0/mplib2.egg-info/PKG-INFO +140 -0
- mplib2-0.3.0/mplib2.egg-info/SOURCES.txt +134 -0
- mplib2-0.3.0/mplib2.egg-info/dependency_links.txt +1 -0
- mplib2-0.3.0/mplib2.egg-info/not-zip-safe +1 -0
- mplib2-0.3.0/mplib2.egg-info/requires.txt +3 -0
- mplib2-0.3.0/mplib2.egg-info/top_level.txt +1 -0
- mplib2-0.3.0/pybind/collision_detection/fcl/pybind_collision_common.cpp +75 -0
- mplib2-0.3.0/pybind/collision_detection/fcl/pybind_fcl.cpp +406 -0
- mplib2-0.3.0/pybind/collision_detection/fcl/pybind_fcl_model.cpp +126 -0
- mplib2-0.3.0/pybind/collision_detection/fcl/pybind_fcl_utils.cpp +20 -0
- mplib2-0.3.0/pybind/collision_detection/pybind_collision_common.cpp +85 -0
- mplib2-0.3.0/pybind/collision_detection/pybind_collision_detection.cpp +31 -0
- mplib2-0.3.0/pybind/collision_detection/pybind_collision_matrix.cpp +154 -0
- mplib2-0.3.0/pybind/core/pybind_articulated_model.cpp +130 -0
- mplib2-0.3.0/pybind/core/pybind_attached_body.cpp +76 -0
- mplib2-0.3.0/pybind/docstring/collision_detection/collision_common.h +79 -0
- mplib2-0.3.0/pybind/docstring/collision_detection/collision_matrix.h +176 -0
- mplib2-0.3.0/pybind/docstring/collision_detection/fcl/collision_common.h +86 -0
- mplib2-0.3.0/pybind/docstring/collision_detection/fcl/fcl.h +378 -0
- mplib2-0.3.0/pybind/docstring/collision_detection/fcl/fcl_model.h +240 -0
- mplib2-0.3.0/pybind/docstring/collision_detection/fcl/fcl_utils.h +50 -0
- mplib2-0.3.0/pybind/docstring/core/articulated_model.h +185 -0
- mplib2-0.3.0/pybind/docstring/core/attached_body.h +99 -0
- mplib2-0.3.0/pybind/docstring/kinematics/kdl/kdl_model.h +62 -0
- mplib2-0.3.0/pybind/docstring/kinematics/kdl/kdl_utils.h +37 -0
- mplib2-0.3.0/pybind/docstring/kinematics/pinocchio/pinocchio_model.h +323 -0
- mplib2-0.3.0/pybind/docstring/planning/ompl/fixed_joint.h +67 -0
- mplib2-0.3.0/pybind/docstring/planning/ompl/general_constraint.h +47 -0
- mplib2-0.3.0/pybind/docstring/planning/ompl/ompl_planner.h +72 -0
- mplib2-0.3.0/pybind/docstring/planning/ompl/ompl_utils.h +59 -0
- mplib2-0.3.0/pybind/docstring/planning/ompl/validity_checker.h +47 -0
- mplib2-0.3.0/pybind/docstring/planning_world.h +412 -0
- mplib2-0.3.0/pybind/docstring/utils/assimp_loader.h +47 -0
- mplib2-0.3.0/pybind/docstring/utils/color_printing.h +53 -0
- mplib2-0.3.0/pybind/docstring/utils/conversion.h +57 -0
- mplib2-0.3.0/pybind/docstring/utils/pose.h +147 -0
- mplib2-0.3.0/pybind/docstring/utils/random.h +39 -0
- mplib2-0.3.0/pybind/kinematics/kdl/pybind_kdl_model.cpp +46 -0
- mplib2-0.3.0/pybind/kinematics/pinocchio/pybind_pinocchio_model.cpp +136 -0
- mplib2-0.3.0/pybind/kinematics/pybind_kinematics.cpp +29 -0
- mplib2-0.3.0/pybind/planning/ompl/pybind_fixed_joint.cpp +34 -0
- mplib2-0.3.0/pybind/planning/ompl/pybind_ompl_planner.cpp +40 -0
- mplib2-0.3.0/pybind/planning/pybind_planning.cpp +22 -0
- mplib2-0.3.0/pybind/pybind.cpp +46 -0
- mplib2-0.3.0/pybind/pybind_macros.hpp +7 -0
- mplib2-0.3.0/pybind/pybind_planning_world.cpp +173 -0
- mplib2-0.3.0/pybind/utils/pose.cpp +153 -0
- mplib2-0.3.0/pybind/utils/random.cpp +17 -0
- mplib2-0.3.0/pyproject.toml +149 -0
- mplib2-0.3.0/setup.cfg +4 -0
- mplib2-0.3.0/setup.py +136 -0
- mplib2-0.3.0/src/collision_detection/collision_matrix.cpp +263 -0
- mplib2-0.3.0/src/collision_detection/fcl/collision_common.cpp +79 -0
- mplib2-0.3.0/src/collision_detection/fcl/fcl_model.cpp +395 -0
- mplib2-0.3.0/src/collision_detection/fcl/fcl_utils.cpp +58 -0
- mplib2-0.3.0/src/core/articulated_model.cpp +139 -0
- mplib2-0.3.0/src/core/attached_body.cpp +38 -0
- mplib2-0.3.0/src/kinematics/kdl/kdl_model.cpp +190 -0
- mplib2-0.3.0/src/kinematics/kdl/kdl_utils.cpp +108 -0
- mplib2-0.3.0/src/kinematics/pinocchio/pinocchio_model.cpp +715 -0
- mplib2-0.3.0/src/planning/ompl/fixed_joint.cpp +73 -0
- mplib2-0.3.0/src/planning/ompl/ompl_planner.cpp +351 -0
- mplib2-0.3.0/src/planning/ompl/ompl_utils.cpp +66 -0
- mplib2-0.3.0/src/planning_world.cpp +563 -0
- mplib2-0.3.0/src/utils/assimp_loader.cpp +120 -0
- mplib2-0.3.0/src/utils/conversion.cpp +73 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.12)
|
|
2
|
+
project(mp LANGUAGES CXX)
|
|
3
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
4
|
+
|
|
5
|
+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -fsized-deallocation -Wno-deprecated-declarations")
|
|
6
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
|
|
7
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
|
8
|
+
|
|
9
|
+
# set -fuse-ld=lld if lld is found
|
|
10
|
+
find_program(LLD_FOUND ld.lld)
|
|
11
|
+
if(LLD_FOUND)
|
|
12
|
+
message(STATUS "Using lld")
|
|
13
|
+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
|
|
14
|
+
endif(LLD_FOUND)
|
|
15
|
+
|
|
16
|
+
# add ccache as compiler launcher
|
|
17
|
+
find_program(CCACHE_FOUND ccache)
|
|
18
|
+
if(CCACHE_FOUND)
|
|
19
|
+
message(STATUS "Using ccache")
|
|
20
|
+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
21
|
+
endif(CCACHE_FOUND)
|
|
22
|
+
|
|
23
|
+
if(POLICY CMP0144)
|
|
24
|
+
cmake_policy(SET CMP0144 NEW)
|
|
25
|
+
endif()
|
|
26
|
+
if(POLICY CMP0167)
|
|
27
|
+
cmake_policy(SET CMP0167 NEW)
|
|
28
|
+
endif()
|
|
29
|
+
|
|
30
|
+
# Pinocchio uses its own FindCppAD, but does not provide it.
|
|
31
|
+
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
|
32
|
+
|
|
33
|
+
find_package(Eigen3 3.4.0 REQUIRED)
|
|
34
|
+
set(Boost_NO_WARN_NEW_VERSIONS 1) # silence Boost CMake warnings
|
|
35
|
+
if(NOT DEFINED BOOST_ROOT AND DEFINED ENV{CONDA_PREFIX})
|
|
36
|
+
set(BOOST_ROOT "$ENV{CONDA_PREFIX}")
|
|
37
|
+
endif()
|
|
38
|
+
if(DEFINED BOOST_ROOT OR DEFINED ENV{CONDA_PREFIX})
|
|
39
|
+
set(Boost_NO_SYSTEM_PATHS ON)
|
|
40
|
+
endif()
|
|
41
|
+
find_package(Boost REQUIRED COMPONENTS filesystem)
|
|
42
|
+
find_package(ompl REQUIRED)
|
|
43
|
+
find_package(fcl REQUIRED)
|
|
44
|
+
find_package(pinocchio REQUIRED)
|
|
45
|
+
find_package(assimp REQUIRED)
|
|
46
|
+
find_package(orocos_kdl REQUIRED)
|
|
47
|
+
find_package(urdfdom REQUIRED)
|
|
48
|
+
|
|
49
|
+
# store libries in a variable
|
|
50
|
+
set(LIBS ompl fcl assimp orocos-kdl Boost::filesystem pinocchio::pinocchio urdfdom_model urdfdom_world)
|
|
51
|
+
if(TARGET Boost::system)
|
|
52
|
+
list(APPEND LIBS Boost::system)
|
|
53
|
+
endif()
|
|
54
|
+
# mp
|
|
55
|
+
file(GLOB_RECURSE MPLIB_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
|
56
|
+
add_library(mp STATIC ${MPLIB_SRC})
|
|
57
|
+
target_link_libraries(mp PRIVATE ${LIBS})
|
|
58
|
+
target_compile_definitions(mp PUBLIC BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS COAL_DISABLE_HPP_FCL_WARNINGS)
|
|
59
|
+
target_include_directories(mp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
|
60
|
+
target_include_directories(mp PUBLIC ${OMPL_INCLUDE_DIRS} ${urdfdom_INCLUDE_DIRS})
|
|
61
|
+
set_target_properties(mp PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
|
62
|
+
|
|
63
|
+
# pybind11_mkdoc
|
|
64
|
+
option(GENERATE_DOCSTRINGS "Generate docstrings from C++ headers" OFF)
|
|
65
|
+
file(GLOB_RECURSE MPLIB_MKDOC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/mplib/*.h")
|
|
66
|
+
list(FILTER MPLIB_MKDOC_HEADER EXCLUDE REGEX "types.h|macros")
|
|
67
|
+
add_custom_target(
|
|
68
|
+
pybind11_mkdoc
|
|
69
|
+
COMMAND bash "${CMAKE_CURRENT_SOURCE_DIR}/dev/mkdoc.sh"
|
|
70
|
+
"-I$<JOIN:$<TARGET_PROPERTY:mp,INCLUDE_DIRECTORIES>,;-I>"
|
|
71
|
+
BYPRODUCTS "${CMAKE_CURRENT_SOURCE_DIR}/pybind/docstring/*.h"
|
|
72
|
+
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/dev/mkdoc.sh" "${MPLIB_MKDOC_HEADER}"
|
|
73
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
74
|
+
COMMAND_EXPAND_LISTS
|
|
75
|
+
VERBATIM
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Pybind11
|
|
79
|
+
find_package(pybind11 CONFIG QUIET)
|
|
80
|
+
if(NOT pybind11_FOUND)
|
|
81
|
+
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/third_party/pybind11")
|
|
82
|
+
endif()
|
|
83
|
+
file(GLOB_RECURSE PYBIND_SRC "${CMAKE_CURRENT_SOURCE_DIR}/pybind/*.cpp")
|
|
84
|
+
pybind11_add_module(pymp ${PYBIND_SRC})
|
|
85
|
+
target_link_libraries(pymp PRIVATE mp)
|
|
86
|
+
target_include_directories(pymp PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/pybind")
|
|
87
|
+
if(GENERATE_DOCSTRINGS)
|
|
88
|
+
add_dependencies(pymp pybind11_mkdoc)
|
|
89
|
+
endif()
|
|
90
|
+
|
|
91
|
+
# compile test_articulated_model and run the test
|
|
92
|
+
option(BUILD_CPP_TESTS "Build C++ test executable" ON)
|
|
93
|
+
if(BUILD_CPP_TESTS)
|
|
94
|
+
add_executable(test_articulated_model "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_articulated_model.cpp")
|
|
95
|
+
target_link_libraries(test_articulated_model PRIVATE mp)
|
|
96
|
+
add_test(NAME test_articulated_model COMMAND test_articulated_model)
|
|
97
|
+
endif()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2020 CNRS INRIA
|
|
3
|
+
#
|
|
4
|
+
# Author: Guilhem Saurel, Rohan Budhiraja
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
# Try to find cppad
|
|
8
|
+
# in standard prefixes and in ${cppad_PREFIX}
|
|
9
|
+
# Once done this will define
|
|
10
|
+
# cppad_FOUND - System has cppad
|
|
11
|
+
# cppad_INCLUDE_DIR - The cppad include directories
|
|
12
|
+
# cppad_LIBRARY - The libraries needed to use cppad
|
|
13
|
+
# cppad_DEFINITIONS - Compiler switches required for using cppad
|
|
14
|
+
# cppad_VERSION - Version of cppad found
|
|
15
|
+
|
|
16
|
+
FIND_PATH(cppad_INCLUDE_DIR
|
|
17
|
+
NAMES cppad/configure.hpp
|
|
18
|
+
PATHS ${cppad_PREFIX}
|
|
19
|
+
PATH_SUFFIXES include
|
|
20
|
+
)
|
|
21
|
+
FIND_LIBRARY(cppad_LIBRARY
|
|
22
|
+
NAMES cppad_lib
|
|
23
|
+
PATHS ${cppad_PREFIX}
|
|
24
|
+
PATH_SUFFIXES lib
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
IF(cppad_INCLUDE_DIR AND EXISTS "${cppad_INCLUDE_DIR}/cppad/configure.hpp")
|
|
28
|
+
file(STRINGS "${cppad_INCLUDE_DIR}/cppad/configure.hpp" cppad_version_str
|
|
29
|
+
REGEX "^# *define[\t ]+CPPAD_PACKAGE_STRING[\t ]+\"cppad-.*\"")
|
|
30
|
+
string(REGEX REPLACE "^# *define[\t ]+CPPAD_PACKAGE_STRING[\t ]+\"cppad-([^\"]*)\".*" "\\1"
|
|
31
|
+
cppad_VERSION "${cppad_version_str}")
|
|
32
|
+
ENDIF()
|
|
33
|
+
|
|
34
|
+
INCLUDE(FindPackageHandleStandardArgs)
|
|
35
|
+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(cppad REQUIRED_VARS cppad_LIBRARY cppad_INCLUDE_DIR VERSION_VAR cppad_VERSION)
|
|
36
|
+
mark_as_advanced(cppad_INCLUDE_DIR cppad_LIBRARY)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2020 CNRS INRIA
|
|
3
|
+
#
|
|
4
|
+
# Author: Guilhem Saurel
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
# Try to find cppadcg
|
|
8
|
+
# in standard prefixes and in ${cppadcg_PREFIX}
|
|
9
|
+
# Once done this will define
|
|
10
|
+
# cppadcg_FOUND - System has cppadcg
|
|
11
|
+
# cppadcg_INCLUDE_DIR - The cppadcg include directories
|
|
12
|
+
# cppadcg_VERSION - Version of cppadcg found
|
|
13
|
+
|
|
14
|
+
FIND_PATH(cppadcg_INCLUDE_DIR
|
|
15
|
+
NAMES cppad/cg.hpp
|
|
16
|
+
PATHS ${cppadcg_PREFIX}
|
|
17
|
+
PATH_SUFFIXES include
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
IF(cppadcg_INCLUDE_DIR AND EXISTS "${cppadcg_INCLUDE_DIR}/cppad/cg/configure.hpp")
|
|
21
|
+
file(STRINGS "${cppadcg_INCLUDE_DIR}/cppad/cg/configure.hpp" cppadcg_version_str
|
|
22
|
+
REGEX "^#define[\t ]+CPPAD_CG_VERSION[\t ]+\"cppadcg-.*\"")
|
|
23
|
+
string(REGEX REPLACE "^#define[\t ]+CPPAD_CG_VERSION[\t ]+\"cppadcg-([^\"]*)\".*" "\\1"
|
|
24
|
+
cppadcg_VERSION "${cppadcg_version_str}")
|
|
25
|
+
ENDIF()
|
|
26
|
+
|
|
27
|
+
INCLUDE(FindPackageHandleStandardArgs)
|
|
28
|
+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(cppadcg REQUIRED_VARS cppadcg_INCLUDE_DIR VERSION_VAR cppadcg_VERSION)
|
|
29
|
+
mark_as_advanced(cppadcg_INCLUDE_DIR)
|
mplib2-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Hao Su's Lab, UCSD
|
|
4
|
+
Copyright (c) 2026 Albert Khalikov (MPlib2 fork and maintenance)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
mplib2-0.3.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
include VERSION
|
|
2
|
+
include LICENSE
|
|
3
|
+
include README.md
|
|
4
|
+
include CMakeLists.txt
|
|
5
|
+
recursive-include CMakeModules *.cmake
|
|
6
|
+
recursive-include include *.h *.hpp
|
|
7
|
+
recursive-include src *.cpp *.h *.hpp
|
|
8
|
+
recursive-include pybind *.cpp *.h *.hpp
|
|
9
|
+
recursive-include mplib *.py *.pyi py.typed
|
|
10
|
+
prune build
|
|
11
|
+
prune dist
|
|
12
|
+
prune wheelhouse
|
|
13
|
+
prune data
|
|
14
|
+
prune tests
|
|
15
|
+
prune docs
|
|
16
|
+
prune docker
|
|
17
|
+
prune dev
|
|
18
|
+
prune third_party
|
|
19
|
+
global-exclude *.pyc *.pyo __pycache__ *.so *.egg-info
|
mplib2-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mplib2
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A lightweight motion planning library (actively maintained fork of MPlib)
|
|
5
|
+
Author-email: Minghua Liu <minghua@ucsd.edu>, Jiayuan Gu <jigu@ucsd.edu>, Kolin Guo <ruguo@ucsd.edu>, Xinsong Lin <x8lin@ucsd.edu>
|
|
6
|
+
Maintainer-email: Albert Khalikov <al.ry.ri@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/dd114/MPlib2
|
|
9
|
+
Project-URL: Repository, https://github.com/dd114/MPlib2
|
|
10
|
+
Project-URL: Issues, https://github.com/dd114/MPlib2/issues
|
|
11
|
+
Project-URL: Upstream, https://github.com/haosulab/MPlib
|
|
12
|
+
Keywords: robotics,motion planning
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Intended Audience :: Other Audience
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Natural Language :: English
|
|
19
|
+
Classifier: Framework :: Robot Framework :: Tool
|
|
20
|
+
Classifier: Programming Language :: C++
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Topic :: Education
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Topic :: Utilities
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: numpy>=1.26
|
|
31
|
+
Requires-Dist: toppra>=0.6.3
|
|
32
|
+
Requires-Dist: transforms3d>=0.3.1
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# MPlib2: a Lightweight Motion Planning Library
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="https://raw.githubusercontent.com/dd114/MPlib2/main/docs/demo.gif">
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
[](https://github.com/dd114/MPlib2/blob/main/LICENSE)
|
|
42
|
+
[](https://github.com/dd114/MPlib2)
|
|
43
|
+
[](https://github.com/haosulab/MPlib)
|
|
44
|
+
|
|
45
|
+
MPlib2 is an actively maintained standalone fork of [MPlib](https://github.com/haosulab/MPlib) — a lightweight Python motion planning library decoupled from ROS. It brings modern dependency compatibility (Python 3.10–3.12, NumPy 2, Pinocchio 3, Boost 1.88+, modern `pybind11`) and stability fixes while remaining a drop-in `import mplib` replacement for existing ManiSkill, SAPIEN, and MPlib codebases.
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
### Standard Pip Installation
|
|
50
|
+
|
|
51
|
+
The PyPI distribution name is `mplib2`, while the Python import module remains `mplib`:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install mplib2
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> **Note (migrating from upstream `mplib`)**: Because `mplib2` provides the `mplib` Python module as a drop-in replacement, it cannot coexist with upstream `mplib` in the same environment. Uninstall upstream `mplib` first to avoid package shadowing:
|
|
58
|
+
> ```bash
|
|
59
|
+
> pip uninstall -y mplib && pip install mplib2
|
|
60
|
+
> ```
|
|
61
|
+
|
|
62
|
+
### Building from Source & Editable Installation
|
|
63
|
+
|
|
64
|
+
#### Prerequisites
|
|
65
|
+
|
|
66
|
+
Building MPlib2 from source requires Python >= 3.10, a C++17 compiler (`g++` or `clang++`), CMake (>= 3.12), Ninja, `pybind11` (>= 2.13, required for NumPy 2 compatibility), and C++ dependency libraries:
|
|
67
|
+
- Eigen3 (>= 3.4.0)
|
|
68
|
+
- Pinocchio (>= 3.0, < 4.0)
|
|
69
|
+
- FCL / Coal
|
|
70
|
+
- OMPL (>= 1.5)
|
|
71
|
+
- Boost (>= 1.70: `filesystem`; `system` linked conditionally if present)
|
|
72
|
+
- Orocos-KDL
|
|
73
|
+
- URDFDOM
|
|
74
|
+
- Assimp
|
|
75
|
+
|
|
76
|
+
#### Option A: Managed Environment with Pixi (Recommended)
|
|
77
|
+
|
|
78
|
+
[Pixi](https://pixi.sh/) automatically installs required C++ libraries and Python toolchains (Python >= 3.10, < 3.13):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Clone the repository
|
|
82
|
+
git clone https://github.com/dd114/MPlib2.git
|
|
83
|
+
cd MPlib2
|
|
84
|
+
|
|
85
|
+
# Install development environment and execute test suite
|
|
86
|
+
pixi run pytest tests
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Option B: Editable Installation via Pip (Python 3.10–3.12)
|
|
90
|
+
|
|
91
|
+
Within an existing Conda or system environment providing the prerequisite C++ libraries:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Install runtime Python dependencies
|
|
95
|
+
pip install "numpy>=1.26" "toppra>=0.6.3" "transforms3d>=0.3.1"
|
|
96
|
+
|
|
97
|
+
# Build C++ pybind11 extension in-place and install editable package
|
|
98
|
+
pip install -e . --no-build-isolation
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Quickstart
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import numpy as np
|
|
105
|
+
import mplib
|
|
106
|
+
|
|
107
|
+
# Initialize planner for Franka Emika Panda arm
|
|
108
|
+
planner = mplib.Planner(
|
|
109
|
+
urdf="data/panda/panda.urdf",
|
|
110
|
+
srdf="data/panda/panda.srdf",
|
|
111
|
+
move_group="panda_hand",
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# Set initial joint configuration (7 arm joints + 2 gripper fingers)
|
|
115
|
+
start_qpos = np.array([0.0, 0.2, 0.0, -2.6, 0.0, 2.9, 0.8, 0.02, 0.02])
|
|
116
|
+
planner.robot.set_qpos(start_qpos, full=True)
|
|
117
|
+
|
|
118
|
+
# Forward Kinematics: compute end-effector pose
|
|
119
|
+
planner.pinocchio_model.compute_forward_kinematics(start_qpos)
|
|
120
|
+
ee_idx = planner.link_name_2_idx["panda_hand"]
|
|
121
|
+
target_pose = planner.pinocchio_model.get_link_pose(ee_idx)
|
|
122
|
+
|
|
123
|
+
# Inverse Kinematics: solve for joint angles matching target pose
|
|
124
|
+
status, ik_qpos = planner.IK(target_pose, start_qpos, return_closest=True)
|
|
125
|
+
if status == "Success":
|
|
126
|
+
print("IK Solution found:", ik_qpos[:7])
|
|
127
|
+
|
|
128
|
+
# Motion Planning: plan collision-free trajectory to target pose
|
|
129
|
+
target_pose.p[0] += 0.1 # Translate 10 cm in X
|
|
130
|
+
result = planner.plan_pose(target_pose, start_qpos)
|
|
131
|
+
|
|
132
|
+
if result["status"] == "Success":
|
|
133
|
+
print(f"Planned trajectory duration: {result['duration']:.2f} s")
|
|
134
|
+
print(f"Waypoints: {len(result['position'])}")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Documentation & Attribution
|
|
138
|
+
|
|
139
|
+
- Upstream API reference and tutorials (applicable to the `mplib` Python API): [motion-planning-lib.readthedocs.io](https://motion-planning-lib.readthedocs.io/latest/tutorials/getting_started.html)
|
|
140
|
+
- Originally created by Hao Su's Lab, UC San Diego ([haosulab/MPlib](https://github.com/haosulab/MPlib)); maintained as MPlib2 at [dd114/MPlib2](https://github.com/dd114/MPlib2).
|
mplib2-0.3.0/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# MPlib2: a Lightweight Motion Planning Library
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/dd114/MPlib2/main/docs/demo.gif">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[](https://github.com/dd114/MPlib2/blob/main/LICENSE)
|
|
8
|
+
[](https://github.com/dd114/MPlib2)
|
|
9
|
+
[](https://github.com/haosulab/MPlib)
|
|
10
|
+
|
|
11
|
+
MPlib2 is an actively maintained standalone fork of [MPlib](https://github.com/haosulab/MPlib) — a lightweight Python motion planning library decoupled from ROS. It brings modern dependency compatibility (Python 3.10–3.12, NumPy 2, Pinocchio 3, Boost 1.88+, modern `pybind11`) and stability fixes while remaining a drop-in `import mplib` replacement for existing ManiSkill, SAPIEN, and MPlib codebases.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Standard Pip Installation
|
|
16
|
+
|
|
17
|
+
The PyPI distribution name is `mplib2`, while the Python import module remains `mplib`:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install mplib2
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> **Note (migrating from upstream `mplib`)**: Because `mplib2` provides the `mplib` Python module as a drop-in replacement, it cannot coexist with upstream `mplib` in the same environment. Uninstall upstream `mplib` first to avoid package shadowing:
|
|
24
|
+
> ```bash
|
|
25
|
+
> pip uninstall -y mplib && pip install mplib2
|
|
26
|
+
> ```
|
|
27
|
+
|
|
28
|
+
### Building from Source & Editable Installation
|
|
29
|
+
|
|
30
|
+
#### Prerequisites
|
|
31
|
+
|
|
32
|
+
Building MPlib2 from source requires Python >= 3.10, a C++17 compiler (`g++` or `clang++`), CMake (>= 3.12), Ninja, `pybind11` (>= 2.13, required for NumPy 2 compatibility), and C++ dependency libraries:
|
|
33
|
+
- Eigen3 (>= 3.4.0)
|
|
34
|
+
- Pinocchio (>= 3.0, < 4.0)
|
|
35
|
+
- FCL / Coal
|
|
36
|
+
- OMPL (>= 1.5)
|
|
37
|
+
- Boost (>= 1.70: `filesystem`; `system` linked conditionally if present)
|
|
38
|
+
- Orocos-KDL
|
|
39
|
+
- URDFDOM
|
|
40
|
+
- Assimp
|
|
41
|
+
|
|
42
|
+
#### Option A: Managed Environment with Pixi (Recommended)
|
|
43
|
+
|
|
44
|
+
[Pixi](https://pixi.sh/) automatically installs required C++ libraries and Python toolchains (Python >= 3.10, < 3.13):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Clone the repository
|
|
48
|
+
git clone https://github.com/dd114/MPlib2.git
|
|
49
|
+
cd MPlib2
|
|
50
|
+
|
|
51
|
+
# Install development environment and execute test suite
|
|
52
|
+
pixi run pytest tests
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### Option B: Editable Installation via Pip (Python 3.10–3.12)
|
|
56
|
+
|
|
57
|
+
Within an existing Conda or system environment providing the prerequisite C++ libraries:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Install runtime Python dependencies
|
|
61
|
+
pip install "numpy>=1.26" "toppra>=0.6.3" "transforms3d>=0.3.1"
|
|
62
|
+
|
|
63
|
+
# Build C++ pybind11 extension in-place and install editable package
|
|
64
|
+
pip install -e . --no-build-isolation
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quickstart
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
import numpy as np
|
|
71
|
+
import mplib
|
|
72
|
+
|
|
73
|
+
# Initialize planner for Franka Emika Panda arm
|
|
74
|
+
planner = mplib.Planner(
|
|
75
|
+
urdf="data/panda/panda.urdf",
|
|
76
|
+
srdf="data/panda/panda.srdf",
|
|
77
|
+
move_group="panda_hand",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Set initial joint configuration (7 arm joints + 2 gripper fingers)
|
|
81
|
+
start_qpos = np.array([0.0, 0.2, 0.0, -2.6, 0.0, 2.9, 0.8, 0.02, 0.02])
|
|
82
|
+
planner.robot.set_qpos(start_qpos, full=True)
|
|
83
|
+
|
|
84
|
+
# Forward Kinematics: compute end-effector pose
|
|
85
|
+
planner.pinocchio_model.compute_forward_kinematics(start_qpos)
|
|
86
|
+
ee_idx = planner.link_name_2_idx["panda_hand"]
|
|
87
|
+
target_pose = planner.pinocchio_model.get_link_pose(ee_idx)
|
|
88
|
+
|
|
89
|
+
# Inverse Kinematics: solve for joint angles matching target pose
|
|
90
|
+
status, ik_qpos = planner.IK(target_pose, start_qpos, return_closest=True)
|
|
91
|
+
if status == "Success":
|
|
92
|
+
print("IK Solution found:", ik_qpos[:7])
|
|
93
|
+
|
|
94
|
+
# Motion Planning: plan collision-free trajectory to target pose
|
|
95
|
+
target_pose.p[0] += 0.1 # Translate 10 cm in X
|
|
96
|
+
result = planner.plan_pose(target_pose, start_qpos)
|
|
97
|
+
|
|
98
|
+
if result["status"] == "Success":
|
|
99
|
+
print(f"Planned trajectory duration: {result['duration']:.2f} s")
|
|
100
|
+
print(f"Waypoints: {len(result['position'])}")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Documentation & Attribution
|
|
104
|
+
|
|
105
|
+
- Upstream API reference and tutorials (applicable to the `mplib` Python API): [motion-planning-lib.readthedocs.io](https://motion-planning-lib.readthedocs.io/latest/tutorials/getting_started.html)
|
|
106
|
+
- Originally created by Hao Su's Lab, UC San Diego ([haosulab/MPlib](https://github.com/haosulab/MPlib)); maintained as MPlib2 at [dd114/MPlib2](https://github.com/dd114/MPlib2).
|
mplib2-0.3.0/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.0
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <limits>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include <fcl/narrowphase/collision_result.h>
|
|
7
|
+
#include <fcl/narrowphase/distance_result.h>
|
|
8
|
+
|
|
9
|
+
namespace mplib::collision_detection {
|
|
10
|
+
|
|
11
|
+
/// Result of the collision checking.
|
|
12
|
+
template <typename S>
|
|
13
|
+
struct WorldCollisionResultTpl {
|
|
14
|
+
// TODO: Update with
|
|
15
|
+
// https://moveit.picknik.ai/main/api/html/structcollision__detection_1_1CollisionResult.html
|
|
16
|
+
|
|
17
|
+
/// @brief Default constructor
|
|
18
|
+
WorldCollisionResultTpl() {};
|
|
19
|
+
|
|
20
|
+
/// Constructor with all members
|
|
21
|
+
WorldCollisionResultTpl(const ::fcl::CollisionResult<S> &res,
|
|
22
|
+
const std::string &collision_type,
|
|
23
|
+
const std::string &object_name1,
|
|
24
|
+
const std::string &object_name2,
|
|
25
|
+
const std::string &link_name1, const std::string &link_name2)
|
|
26
|
+
: res(res),
|
|
27
|
+
collision_type(collision_type),
|
|
28
|
+
object_name1(object_name1),
|
|
29
|
+
object_name2(object_name2),
|
|
30
|
+
link_name1(link_name1),
|
|
31
|
+
link_name2(link_name2) {};
|
|
32
|
+
|
|
33
|
+
::fcl::CollisionResult<S> res; ///< the fcl CollisionResult
|
|
34
|
+
std::string collision_type, ///< type of the collision
|
|
35
|
+
object_name1, ///< name of the first object
|
|
36
|
+
object_name2, ///< name of the second object
|
|
37
|
+
link_name1, ///< link name of the first object in collision
|
|
38
|
+
link_name2; ///< link name of the second object in collision
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/// Result of minimum distance-to-collision query.
|
|
42
|
+
template <typename S>
|
|
43
|
+
struct WorldDistanceResultTpl {
|
|
44
|
+
// TODO: Update with
|
|
45
|
+
// https://moveit.picknik.ai/main/api/html/structcollision__detection_1_1DistanceResult.html
|
|
46
|
+
|
|
47
|
+
/// @brief Default constructor
|
|
48
|
+
WorldDistanceResultTpl() {};
|
|
49
|
+
|
|
50
|
+
/// Constructor with all members
|
|
51
|
+
WorldDistanceResultTpl(const ::fcl::DistanceResult<S> &res, S min_distance,
|
|
52
|
+
const std::string &distance_type,
|
|
53
|
+
const std::string &object_name1,
|
|
54
|
+
const std::string &object_name2, const std::string &link_name1,
|
|
55
|
+
const std::string &link_name2)
|
|
56
|
+
: res(res),
|
|
57
|
+
min_distance(min_distance),
|
|
58
|
+
distance_type(distance_type),
|
|
59
|
+
object_name1(object_name1),
|
|
60
|
+
object_name2(object_name2),
|
|
61
|
+
link_name1(link_name1),
|
|
62
|
+
link_name2(link_name2) {};
|
|
63
|
+
|
|
64
|
+
::fcl::DistanceResult<S> res; ///< the fcl DistanceResult
|
|
65
|
+
/// minimum distance between the two objects
|
|
66
|
+
S min_distance {std::numeric_limits<S>::max()};
|
|
67
|
+
std::string distance_type, ///< type of the distance result
|
|
68
|
+
object_name1, ///< name of the first object
|
|
69
|
+
object_name2, ///< name of the second object
|
|
70
|
+
link_name1, ///< link name of the first object
|
|
71
|
+
link_name2; ///< link name of the second object
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
} // namespace mplib::collision_detection
|