diff --git a/CMakeLists.txt b/CMakeLists.txt index 22f4e76c..3c8896ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,8 @@ set(RL_BUILD_DEMOS OFF) set(RL_BUILD_RL_SG OFF) set(RL_BUILD_TESTS OFF) set(RL_BUILD_EXTRAS OFF) +set(BUILD_PYTHON_INTERFACE OFF) +set(BUILD_DOCUMENTATION OFF) option(INCLUDE_UTN_MODELS "Whether to include the private UTN models. Requires GITLAB_MODELS_TOKEN to be set to a valid token wit read_api permissions" OFF) @@ -51,7 +53,7 @@ find_package(MuJoCo REQUIRED) FetchContent_Declare( libfranka GIT_REPOSITORY https://github.com/frankaemika/libfranka.git - GIT_TAG 0.13.3 + GIT_TAG 0.14.2 GIT_PROGRESS TRUE EXCLUDE_FROM_ALL ) diff --git a/cmake/Findpinocchio.cmake b/cmake/Findpinocchio.cmake new file mode 100644 index 00000000..d1da5ba9 --- /dev/null +++ b/cmake/Findpinocchio.cmake @@ -0,0 +1,45 @@ +if (NOT pinocchio_FOUND) + if (NOT Python3_FOUND) + set(pinocchio_FOUND FALSE) + if (pinocchio_FIND_REQUIRED) + message(FATAL_ERROR "Could not find pinocchio. Please install pinocchio using pip.") + endif() + return() + endif() + + # Check if the include directory exists + cmake_path(APPEND Python3_SITELIB cmeel.prefix include OUTPUT_VARIABLE pinocchio_INCLUDE_DIRS) + if (NOT EXISTS ${pinocchio_INCLUDE_DIRS}) + set(pinocchio_FOUND FALSE) + if (pinocchio_FIND_REQUIRED) + message(FATAL_ERROR "Could not find pinocchio. Please install pinocchio using pip.") + endif() + return() + endif() + + # Check if the library file exists + cmake_path(APPEND Python3_SITELIB cmeel.prefix lib libpinocchio.so OUTPUT_VARIABLE pinocchio_library_path) + if (NOT EXISTS ${pinocchio_library_path}) + set(pinocchio_FOUND FALSE) + if (pinocchio_FIND_REQUIRED) + message(FATAL_ERROR "Could not find pinocchio. Please install pinocchio using pip.") + endif() + return() + endif() + + # Extract version from the library filename + file(GLOB pinocchio_dist_info "${Python3_SITELIB}/pin-*.dist-info") + cmake_path(GET pinocchio_dist_info FILENAME pinocchio_library_filename) + string(REPLACE "pin-" "" pinocchio_VERSION "${pinocchio_library_filename}") + string(REPLACE ".dist-info" "" pinocchio_VERSION "${pinocchio_VERSION}") + + # Create the imported target + add_library(pinocchio::pinocchio SHARED IMPORTED) + target_include_directories(pinocchio::pinocchio INTERFACE ${pinocchio_INCLUDE_DIRS}) + set_target_properties( + pinocchio::pinocchio + PROPERTIES + IMPORTED_LOCATION "${pinocchio_library_path}" + ) + set(pinocchio_FOUND TRUE) +endif() diff --git a/pyproject.toml b/pyproject.toml index c26b9871..b5087daa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ version = "0.3.1" description="Python Interface for libfranka to control the Franka Research 3 Robot" dependencies = ["websockets>=11.0", "requests~=2.31", - "numpy==2.0", + "numpy", "typer~=0.9", "pydantic~=2.6", "gymnasium~=0.29.1", @@ -23,7 +23,9 @@ dependencies = ["websockets>=11.0", "python-dotenv==1.0.1", "opencv-python~=4.10.0.84", # NOTE: when changing the mujoco version, also change it in requirements_dev.txt - "mujoco==3.2.6" + "mujoco==3.2.6", + # NOTE: Same for pinocchio (pin) + "pin==2.7.0" ] readme = "README.md" maintainers = [ diff --git a/python/rcsss/control/vive.py b/python/rcsss/control/vive.py index 04ad4b19..549b17a7 100644 --- a/python/rcsss/control/vive.py +++ b/python/rcsss/control/vive.py @@ -130,7 +130,7 @@ def run(self): ) # Compute angle around z axis: https://stackoverflow.com/questions/21483999/using-atan2-to-find-angle-between-two-vectors - rot_z = np.atan2(x_axis_rot.translation()[1], x_axis_rot.translation()[0]) - np.atan2( + rot_z = np.arctan2(x_axis_rot.translation()[1], x_axis_rot.translation()[0]) - np.arctan2( x_axis.translation()[1], x_axis.translation()[0] ) rot_z -= np.pi / 2 diff --git a/requirements_dev.txt b/requirements_dev.txt index 6b51c543..67752008 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -10,4 +10,5 @@ commitizen~=3.28.0 scikit-build-core>=0.3.3 pybind11 mujoco==3.2.6 +pin==2.7.0 wheel diff --git a/src/pybind/CMakeLists.txt b/src/pybind/CMakeLists.txt index c1887f40..0067d9da 100644 --- a/src/pybind/CMakeLists.txt +++ b/src/pybind/CMakeLists.txt @@ -6,4 +6,8 @@ set_target_properties(_core PROPERTIES INSTALL_RPATH "$ORIGIN;$ORIGIN/../mujoco" INTERPROCEDURAL_OPTIMIZATION TRUE ) +set_target_properties(franka PROPERTIES + INSTALL_RPATH "$ORIGIN/../cmeel.prefix/lib" + INTERPROCEDURAL_OPTIMIZATION TRUE +) install(TARGETS _core franka DESTINATION rcsss COMPONENT python_package)