diff --git a/CMakeLists.txt b/CMakeLists.txt index fa37f47..738f485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,15 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # Enable pybind11's automatic Python detection set(PYBIND11_FINDPYTHON ON) -set(pybind11_DIR /home/abrar/hsc/pybind11-2.6.2/build/lib/pybind11/share/cmake/pybind11) find_package(pybind11 CONFIG REQUIRED) find_package(Eigen3 REQUIRED) # Find Eigen3 # Define the source files set(SOURCES src/main.cpp src/canAPI.cpp) +# Add the include directory for headers +include_directories(include) + # Create the Python module with the desired name pybind11_add_module(allegro_pybind ${SOURCES}) diff --git a/README.md b/README.md index 3f6e8e3..9844bf8 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,25 @@ -# Allegro Hand Interface -Adapted from https://github.com/simlabrobotics/allegro_hand_linux_v4 +# allegro_pybind + +A Python binding for controlling the Allegro Hand, heavily based on https://github.com/simlabrobotics/allegro_hand_linux_v4. The setup instructions are also borrowed from the original project. + -## TODO -- have a class-based API +**Tested on**: +- Ubuntu 20.04 +- g++ 9.4.0 +- cmake 3.16.3 +- python 3.8.20 -# Required hardware + + +## Required hardware 1. [Allegro hand v4](http://wiki.wonikrobotics.com/AllegroHandWiki/index.php/Allegro_Hand_v4.0) 2. [PCAN-USB interface](https://www.peak-system.com/PCAN-USB.199.0.html?&L=1) -# Setup instructions -## Prerequisites -### 1. PCAN-USB driver +## Setup instructions +### Prerequisites +#### 1. PCAN-USB driver Download, build, and install PCAN-USB driver for Linux "libpcan" ```bash tar -xzvf peak-linux-driver-x.x.tar.gz @@ -20,7 +27,7 @@ cd peak-linux-driver-x.x make NET=NO sudo make install ``` -#### Troubleshooting +##### Troubleshooting * If encounter ```bash src/pcan-settings.c:47:10: fatal error: popt.h: No such file or directory @@ -33,7 +40,7 @@ sudo make install sudo apt install libpopt-dev ``` -### 2. `libpcanbasic` +#### 2. `libpcanbasic` Download, build, and install PCAN-Basic API for Linux: libpcanbasic ```bash tar -xzvf PCAN_Basic_Linux-x.x.x.tar.gz @@ -42,7 +49,7 @@ make sudo make install ``` -### 3. `libBHand` grasping library +#### 3. `libBHand` grasping library Download, build, and install Grasping Library for Linux, "libBHand": Grasping_Library_for_Linux ```bash unzip LibBHand_{32|64}.zip @@ -52,8 +59,15 @@ sudo ldconfig ``` -## Installing this interface +### Installation + +Besides the dependencies mentioned above, ensure the following dependencies are installed before building the package: +- pybind11 +- Eigen3 + + +After installing the dependencies, you can build and install the package with: ``` pip install . @@ -61,4 +75,9 @@ pip install . # Usage -See `example.py` \ No newline at end of file +See `example.py` + + +## TODO + +- have a class-based API \ No newline at end of file diff --git a/src/canAPI.h b/include/canAPI.h similarity index 100% rename from src/canAPI.h rename to include/canAPI.h diff --git a/src/canDef.h b/include/canDef.h similarity index 100% rename from src/canDef.h rename to include/canDef.h diff --git a/src/rDeviceAllegroHandCANDef.h b/include/rDeviceAllegroHandCANDef.h similarity index 100% rename from src/rDeviceAllegroHandCANDef.h rename to include/rDeviceAllegroHandCANDef.h diff --git a/pyproject.toml b/pyproject.toml index bd722b7..fabed68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,3 +5,9 @@ build-backend = "scikit_build_core.build" [project] name = "allegro_pybind" version = "0.1.0" +authors = [{ name = "Sicheng He", email = "sichengh@usc.edu" }] +description = "A Python binding for controlling the Allegro Hand." + +readme = "README.md" + +classifiers = ["Programming Language :: Python :: 3"] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index add684b..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Add an executable -add_executable(grasp main.cpp canAPI.cpp) - -# Link with required libraries -target_link_libraries(grasp BHand pcanbasic pthread ${ZMQ_LIBRARIES}) - -# Install the executable -install(TARGETS grasp DESTINATION ${PROJECT_BINARY_DIR}/bin)