Skip to content
Merged
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
42 changes: 42 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Upload Wheels

on: [push, pull_request]

jobs:
build_wheels:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v1

- name: Build and copy wheel
run: |
CONTAINER_ID=$(sudo docker run -d -v $(pwd):/io quay.io/pypa/manylinux2014_x86_64 sleep infinity)
sudo docker exec $CONTAINER_ID /bin/bash -c "
yum install -y epel-release &&
yum-config-manager --add-repo=https://download.opensuse.org/repositories/science:/dlr/CentOS_7/ &&
yum install -y --nogpgcheck eigen3-devel &&
cd /usr/local/include &&
curl -L https://github.com/simd-everywhere/simde/archive/refs/heads/master.zip -o simde.zip &&
unzip simde.zip &&
mv simde-master/simde . &&
rm -rf simde.zip simde-master &&
cd /io &&
/opt/python/cp311-cp311/bin/pip install setuptools wheel --root-user-action=ignore &&
/opt/python/cp311-cp311/bin/python setup.py bdist_wheel &&
auditwheel repair dist/ismpc-0.1-cp311-cp311-linux_x86_64.whl --plat manylinux2014_x86_64"
sudo docker cp $CONTAINER_ID:/io/wheelhouse/. ./wheelhouse/
sudo docker stop $CONTAINER_ID

- name: Upload wheels to PyPI
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m pip install --upgrade twine &&
twine upload --verbose wheelhouse/*.whl
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ __pycache__/
*.pyc
*.so
dist
dist
wheelhouse

# ros2 stuff
install/
Expand Down
78 changes: 51 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.22)

# ============================= PROJECT SETUP ===============================================
project(ismpc_cpp VERSION 0.1 LANGUAGES CXX)
set(ISMPC_CPP_LIBRARY ${PROJECT_NAME})
project(ismpc VERSION 0.1 LANGUAGES CXX)
set(ISMPC_CPP_LIBRARY ismpc_cpp)
set(ISMPC_PY_LIBRARY ismpc)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(PROJECT ismpc_cpp)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -21,12 +21,10 @@ endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/executables")


# =============================================================================================

# ============================ BUILD OPTIONS ==================================================
option(BUILD_TESTS "Build tests" OFF)
option(BUILD_PYTHON_BINDINGS "Build python bindings" OFF)
option(BUILD_ROS "Build ros package" OFF)
option(BUILD_DART "Build with DART" OFF)

Expand All @@ -41,7 +39,6 @@ endif()

message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")


# =============================================================================================

# ============================ UTILITY STUFF ==================================================
Expand All @@ -63,14 +60,18 @@ configure_file(
@ONLY
)


# =============================================================================================

# ============================ EXTERNAL LIBRARIES =============================================
include(FetchContent)

# EIGEN3
set(EIGEN_INCLUDE_DIR /usr/include/eigen3)
FetchContent_Declare(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG master
)
FetchContent_MakeAvailable(eigen)

# YAML-CPP
FetchContent_Declare(
Expand All @@ -88,18 +89,13 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(proxsuite)

# CASADI
set(CASADI_INCLUDE_DIR /usr/local/include/casadi)
include_directories(
SYSTEM ${CASADI_INCLUDE_DIR}
# NANOBIND
FetchContent_Declare(
nanobind
GIT_REPOSITORY https://github.com/wjakob/nanobind.git
GIT_TAG v2.4.0
)
set(LIBRARY_DIRS /usr/local/lib)
link_directories(${LIBRARY_DIRS})
find_library(CASADI_LIBRARY NAMES casadi HINTS ${LIBRARY_DIRS})
if(CASADI_LIBRARY)
set(LIBCASADI ${CASADI_LIBRARY})
message(STATUS "Found CasADi libs: ${LIBCASADI}")
endif()
FetchContent_MakeAvailable(nanobind)

# DART
if(BUILD_DART)
Expand All @@ -111,6 +107,7 @@ endif()
# ============================ ISMPC LIBRARY ==================================================
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB_RECURSE ISMPC_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
list(REMOVE_ITEM ISMPC_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.cpp)
add_library(${ISMPC_CPP_LIBRARY} STATIC ${ISMPC_SRCS})

target_include_directories(${ISMPC_CPP_LIBRARY}
Expand All @@ -119,16 +116,16 @@ target_include_directories(${ISMPC_CPP_LIBRARY}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${proxsuite_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${yaml-cpp_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${eigen_SOURCE_DIR}>
${DART_INCLUDE_DIRS}
${EIGEN_INCLUDE_DIR}
)

set(ISMPC_CPP_EXTRA_LIBRARIES
$<BUILD_INTERFACE:cxx_setup>
$<BUILD_INTERFACE:yaml-cpp::yaml-cpp>
$<BUILD_INTERFACE:proxsuite>
$<BUILD_INTERFACE:Eigen3::Eigen>
${DART_LIBRARIES}
${LIBCASADI}
)
target_link_libraries(${ISMPC_CPP_LIBRARY} PUBLIC ${ISMPC_CPP_EXTRA_LIBRARIES})

Expand Down Expand Up @@ -192,10 +189,41 @@ endif()
# =============================================================================================

# ============================ PYTHON BINDINGS =================================================
if(BUILD_PYTHON_BINDINGS)
add_subdirectory(bindings)
if(CMAKE_VERSION VERSION_LESS 3.18)
set(DEV_MODULE Development)
else()
set(DEV_MODULE Development.Module)
endif()

find_package(Python 3.11 COMPONENTS Interpreter ${DEV_MODULE} REQUIRED)
execute_process(
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT
)

execute_process(
COMMAND ${Python_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('purelib'))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)

include_directories(${Python_INCLUDE_DIRS})
message(STATUS "Python_EXECUTABLE: ${Python_EXECUTABLE}")
message(STATUS "Python_VERSION: ${Python_VERSION}")
message(STATUS "PYTHON INCLUDE DIRECTORIES" ${Python_INCLUDE_DIRS})

nanobind_add_module(${ISMPC_PY_LIBRARY} ${PROJECT_SOURCE_DIR}/src/bindings.cpp)
target_include_directories(${ISMPC_PY_LIBRARY} PUBLIC ${eigen_SOURCE_DIR} ${ISMPC_INCLUDE_DIR})
target_link_libraries(${ISMPC_PY_LIBRARY} PUBLIC ${ISMPC_CPP_LIBRARY})

install(
TARGETS ${ISMPC_PY_LIBRARY}
EXPORT ${ISMPC_PY_LIBRARY}Targets
LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${BINDIR}
)

# =============================================================================================

# =========================== GOOGLE TEST =====================================================
Expand All @@ -208,8 +236,4 @@ endif()
# ============================ EXECUTABLES ====================================================
add_executable(ismpc_main ${CMAKE_CURRENT_SOURCE_DIR}/src/cppmain.cpp)
target_link_libraries(ismpc_main PRIVATE ${ISMPC_CPP_LIBRARY})

add_executable(dart_main ${CMAKE_CURRENT_SOURCE_DIR}/src/dartmain.cpp)
target_link_libraries(dart_main PRIVATE ${ISMPC_CPP_LIBRARY})

# =============================================================================================
21 changes: 0 additions & 21 deletions bindings/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ delta: 0.01 # 83 Hz
first_fs_duration: 0.6 # [s]

# Duration parameters
N: 1
N: 1000
P: 1000
C: 100
W: 100 # iterations to wait before starting
Expand Down
78 changes: 0 additions & 78 deletions include/ismpc_cpp/dart/controller.h

This file was deleted.

29 changes: 0 additions & 29 deletions include/ismpc_cpp/dart/qp_solver.h

This file was deleted.

45 changes: 0 additions & 45 deletions include/ismpc_cpp/dart/simulated_robot.h

This file was deleted.

Loading
Loading