Skip to main content

Minimal example for creating a python package (and wheel) from cpp/pybind

Project description

Robotic Control Interface & Manipulation Planning Library

A python library to operate a real or simulated robot, work with robot/world configurations, compute differentiable features, formulate and solve constrained optimization problems (for inverse kinematics, path optimization, and manipulation planning), and interfacing to various physical simulation engines.

These python bindings were developed for easier access to the uderlying C++ code base, esp. for teaching and students. This code base is how we (in the Learning & Intelligent Systems Lab) operate our robots.

Installation via pip (simulation only, no real Franka & realsense support)

  • The pip package was compiled for python3.10 .. 3.14, and most of the dependencies statically linked. A few are still loaded dynamically, which requires installing on Ubuntu:

    sudo apt install liblapack3 freeglut3-dev libglu1-mesa libxrandr2 libfreetype6 fonts-ubuntu python3 python3-pip
    #in latest Ubuntu also:
    cd /usr/lib/x86_64-linux-gnu/ && sudo ln -s libglut.so.3.12 libglut.so.3
    
  • Pip install:

     pip install robotic numpy
    
  • Tests:

    ry-info
    ry-test
    
  • Run all tutorial notebooks as a test and showcase:

    pip install jupyter nbconvert matplotlib ipympl
    git clone https://github.com/MarcToussaint/rai-tutorials.git
    cd rai-tutorials
    make run -j1
    make run_demos -j1
    
  • For reference and testing, this should work in a clean ubuntu:latest docker (starting with xhost +local:root && docker run -it --env="DISPLAY" --network host ubuntu:latest):

    apt update
    env DEBIAN_FRONTEND=noninteractive apt install --yes liblapack3 freeglut3-dev libglu1-mesa libxrandr2 libfreetype6 fonts-ubuntu python3 python3-venv
    #cd /usr/lib/x86_64-linux-gnu/ && ln -s libglut.so.3.12 libglut.so.3 #was necessary in older ubuntus
    python3 -m venv ~/.local/venv
    source ~/.local/venv/bin/activate
    pip install robotic numpy
    ry-info
    ry-test
    

Installation from source with real Franka & realsense support

This assumes a standard Ubuntu 24.04 (or 22.04, 20.04) machine.

  • Install Ubuntu and python packages:

    sudo apt install --yes \
      g++ clang make gnupg cmake git wget libstdc++-14-dev \
      liblapack-dev libf2c2-dev libqhull-dev libeigen3-dev \
      libjsoncpp-dev libyaml-dev libhdf5-dev libpoco-dev libboost-system-dev portaudio19-dev libusb-1.0-0-dev \
      libx11-dev libxi-dev libxxf86vm-dev libglu1-mesa-dev libglfw3-dev libglew-dev libglm-dev freeglut3-dev libpng-dev libassimp-dev libfreetype6-dev \
      python3-dev python3 python3-pip
    
    python3 -m pip install numpy pybind11 pybind11-stubgen
    
  • Install some external libs by source. You can skip librealsense and libfranka if you disable below. (To speed up compilation, e.g., set

    export MAKEFLAGS="-j $(command nproc --ignore 2)"
    

    To standardize installations, I use a basic script:

    wget https://github.com/MarcToussaint/rai/raw/refs/heads/marc/_make/install.sh; chmod a+x install.sh
    ./install.sh libccd
    ./install.sh fcl
    ./install.sh libann
    ./install.sh physx
    ./install.sh librealsense
    ./install.sh libfranka  ## for OLD frankas instead:   ./install.sh -v 0.8.0 libfranka (and you need to patch it...)
    
  • Clone, compile and install this repo (note the USE_REALSENSE and USE_LIBFRANKA options!):

    cd $HOME/git
    git clone --recursive https://github.com/MarcToussaint/robotic.git
    cd robotic
    cp _make/CMakeLists-ubuntu.txt CMakeLists.txt
    export PY_VERSION=`python3 -c "import sys; print(str(sys.version_info[0])+'.'+str(sys.version_info[1]))"`
    cmake -DPY_VERSION=$PY_VERSION -DUSE_REALSENSE=ON -DUSE_LIBFRANKA=ON . -B build
    make -C build _robotic install
    
  • The following should also compile docstrings, but might fail as this is not yet robust across Ubuntu distributions:

    make -C build _robotic docstrings install
    
  • This should install the compiled libraries (which are the python module) in the local src/robotic folder, next to other parts of the python module. To install:

    pip install -e .
    ry-info  #to test the installation
    
  • For using Franka, recall that the user needs to be part of the realtime and dialout unix group:

    sudo usermod -a -G realtime <username>
    sudo usermod -a -G dialout <username>
    

    You need to log out and back in (or even reboot) for this to take effect. Check with groups in a terminal.

  • Now follow the Real Robot Operation Tutorial on the tutorials page to test and debug first steps with the real franka. In particular test ry-bot -real -up -home and debug as explained there.

Building the wheels within a manylinux docker

  • Build the docker
_make/build-docker.sh
  • Compile wheels (this runs local/_make/build-wheels.sh inside the docker -- see inside the Makefile)
make wheels
  • Install these wheels locally with pip or push wheels to pypi -- see inside the Makefile
make wheels-install
make wheels-upload

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

robotic-0.3.7-cp314-cp314-manylinux2014_x86_64.whl (23.0 MB view details)

Uploaded CPython 3.14

robotic-0.3.7-cp313-cp313-manylinux2014_x86_64.whl (23.0 MB view details)

Uploaded CPython 3.13

robotic-0.3.7-cp312-cp312-manylinux2014_x86_64.whl (23.0 MB view details)

Uploaded CPython 3.12

robotic-0.3.7-cp311-cp311-manylinux2014_x86_64.whl (23.0 MB view details)

Uploaded CPython 3.11

robotic-0.3.7-cp310-cp310-manylinux2014_x86_64.whl (23.0 MB view details)

Uploaded CPython 3.10

File details

Details for the file robotic-0.3.7-cp314-cp314-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for robotic-0.3.7-cp314-cp314-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 81e3fa9ab57288606f5ebe3bfa53ae4032cf25fd0bbf1b6c85352d3452c9f248
MD5 044d28e614e7c31815ae49c020cd241a
BLAKE2b-256 df39116d41ec5d8d283a4f435bf27106ca7c888b248ba2fabb99db79d64d7d8b

See more details on using hashes here.

File details

Details for the file robotic-0.3.7-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for robotic-0.3.7-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48d71d0857b7e7bd5b00c07e9c18e18c16b0a311e6422a27482ca7c6f3989843
MD5 e6d76e9e8090c226d9741f7571f534e5
BLAKE2b-256 9b0af6dfb9be07fca13bb1ba79d98e8067e3f1e57d859a8d989ca73466ae5df9

See more details on using hashes here.

File details

Details for the file robotic-0.3.7-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for robotic-0.3.7-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3d3444afda39026572ab33bc3d28efc7950c02c44f328c20281ccbbf736da63d
MD5 c0332e6aa1a7fb7dce621c70a70574d5
BLAKE2b-256 1ac671e27dddd560c7f72057a244fa9a4929409d68bb4751351d13a2bde98e6a

See more details on using hashes here.

File details

Details for the file robotic-0.3.7-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for robotic-0.3.7-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f41018bdaccc766cf6abe2e8b861922cf624a70f203dd5d8451b0e8ee8e6c794
MD5 40e70d9a11129a0ca48ae17229bb9dcc
BLAKE2b-256 08480d1bf0f58fb0299a583ee160daf883349932aaf2bcfd84de07c09c955be0

See more details on using hashes here.

File details

Details for the file robotic-0.3.7-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for robotic-0.3.7-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7139b2f7cbc76c98de2802ff381a87df4e1ce1245955f106533ef0f387388ac1
MD5 4a58c4a6c79f7bbaecf4291f2bc39712
BLAKE2b-256 ce6bfe045e40a513b77c70143d42084934561c32f203c7476c2176a864d2e9d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page