Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
build/
build-wasm/
build*/
.cache/
compile_commands.json
*.so
*.out.*
*.swp
*.swo
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ pip install vamp-planner

> [!IMPORTANT]
> VAMP comes with precompiled robots! If you want to add your own, use [cricket](https://github.com/CoMMALab/cricket) and follow the instructions there.
>
> **`pip install .` builds Panda, UR5, Fetch and Baxter by default**, because every robot adds a large header to the build. To change the set, for example `pip install . -C cmake.define.VAMP_ROBOTS="ur5;panda;fetch;baxter;sphere"`, or `-C cmake.define.VAMP_ROBOTS=all` for everything (`sphere`, `ur5`, `panda`, `fetch`, `baxter`).

VAMP requires the following system dependencies:
- [CMake](https://cmake.org/) version 3.16 or greater.
Expand Down
2 changes: 2 additions & 0 deletions cmake/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") # x86 supports additional flags
string(APPEND VAMP_FAST_ARGS " -fassociative-math")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Clang supports additional fine-grained flags over GCC
string(APPEND VAMP_FAST_ARGS " -fno-honor-infinities -fno-honor-nans")
# The code uses infinity as a sentinel; silence the resulting warning (one per use, per translation unit).
string(APPEND VAMP_FAST_ARGS " -Wno-nan-infinity-disabled")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 11.0.0) # clang 11 does not support -fapprox-func
string(APPEND VAMP_FAST_ARGS " -fapprox-func")
endif()
Expand Down
65 changes: 47 additions & 18 deletions cmake/Python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,57 @@ if(VAMP_BUILD_PYTHON_BINDINGS)
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)

CPMAddPackage("gh:wjakob/nanobind#9a25aed8a7edfe60ef9ad1c911e57667bc4916c4")

# Check if Python is available
if(NOT Python_FOUND)
message(FATAL_ERROR "VAMP_BUILD_PYTHON_BINDINGS is ON but Python was not found")
endif()

if(NOT VAMP_ROBOT_MODULES)
list(APPEND VAMP_ROBOT_MODULES
sphere
ur5
panda
fetch
baxter
)
find_package(nanobind CONFIG QUIET)
if(NOT nanobind_FOUND)
CPMAddPackage("gh:wjakob/nanobind#9a25aed8a7edfe60ef9ad1c911e57667bc4916c4")
endif()

list(APPEND VAMP_ROBOT_STRUCTS
Sphere
UR5
Panda
Fetch
Baxter
)
# By defaul, build bindings only for known robots and not all
set(VAMP_KNOWN_ROBOTS
sphere=Sphere
ur5=UR5
panda=Panda
fetch=Fetch
baxter=Baxter
)

if(NOT VAMP_ROBOT_MODULES)
if(NOT VAMP_ROBOTS)
set(VAMP_ROBOTS "all")
endif()

set(_vamp_requested ${VAMP_ROBOTS})
if(VAMP_ROBOTS STREQUAL "all")
set(_vamp_requested "")
foreach(_entry ${VAMP_KNOWN_ROBOTS})
string(REGEX REPLACE "=.*$" "" _name "${_entry}")
list(APPEND _vamp_requested "${_name}")
endforeach()
endif()

foreach(_robot ${_vamp_requested})
set(_struct "")
foreach(_entry ${VAMP_KNOWN_ROBOTS})
if(_entry MATCHES "^${_robot}=(.*)$")
set(_struct "${CMAKE_MATCH_1}")
endif()
endforeach()

if(_struct STREQUAL "")
message(FATAL_ERROR "VAMP_ROBOTS: unknown robot '${_robot}'. Known: ${VAMP_KNOWN_ROBOTS} (name=Struct)")
endif()

list(APPEND VAMP_ROBOT_MODULES ${_robot})
list(APPEND VAMP_ROBOT_STRUCTS ${_struct})
endforeach()
endif()

message(STATUS "Python robot modules: ${VAMP_ROBOT_MODULES}")

foreach(robot ${VAMP_ROBOT_MODULES})
string(APPEND VAMP_ROBOT_INITS " vb::init_${robot}(pymodule);\n")
string(APPEND VAMP_ROBOT_DECLS " void init_${robot}(nanobind::module_ &pymodule);\n")
Expand All @@ -57,6 +83,8 @@ if(VAMP_BUILD_PYTHON_BINDINGS)
src/impl/vamp/bindings/python/settings.cc
${CMAKE_CURRENT_BINARY_DIR}/python.cc
)


foreach(robot_name robot_struct IN ZIP_LISTS VAMP_ROBOT_MODULES VAMP_ROBOT_STRUCTS)
configure_file(
src/impl/vamp/bindings/python/robot.cc.in
Expand Down Expand Up @@ -87,6 +115,7 @@ if(VAMP_BUILD_PYTHON_BINDINGS)
Eigen3::Eigen
)


if($ENV{GITHUB_ACTIONS})
set(STUB_PREFIX "")
else()
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ cmake.build-type = "Release"

[tool.scikit-build.cmake.define]
VAMP_LTO = "OFF"
VAMP_ROBOT_MODULES="sphere;ur5;panda;fetch;baxter"
VAMP_ROBOT_STRUCTS="Sphere;UR5;Panda;Fetch;Baxter"
VAMP_ROBOTS = "ur5;panda;fetch;baxter"
Loading