Orocos Kinematics and Dynamics Library (KDL)

repository·master·Indexed 21 days ago

https://github.com/orocos/orocos_kinematics_dynamics

A real-time capable library for rigid body kinematics and dynamics calculations. It provides representations for kinematic structures and includes forward and inverse kinematic solvers. The library is implemented in C++ (orocos_kdl) with available Python bindings (python_orocos_kdl) and supports installation via CMake or ROS/catkin.

Tokens
12.2K
Snippets
38
Records
50
Agent score
73%

What's inside orocos_kinematics_dynamics

  1. Understand the KDL directory structure

    master

    The KDL repository is organized into several functional areas. When using the library, be aware of the following directory roles:

    • utilities: Contains utility classes for KDL. Note: These should not be included separately by a user.
    • experimental: Contains preliminary code snippets and non-stable features.
    • bindings: Contains code for binding KDL to other libraries or programming languages.
  2. Build Orocos KDL without catkin

    master

    To build Orocos KDL as a standalone library using CMake, follow these steps:

    1. Clone the repository.
    2. Create and enter a build directory to avoid building in the source folder.
    3. Run cmake .. with optional flags:
      • -DCMAKE_INSTALL_PREFIX=<path>: Set the installation directory.
      • -DENABLE_TESTS:BOOL=ON: Enable unit tests.
      • -DCMAKE_BUILD_TYPE=<type>: Set the build type (e.g., Release, Debug).
    4. Run make to compile.
    5. Run sudo make install to install the library.

    Additional Commands:

    • Run tests: make check (requires -DENABLE_TESTS:BOOL=ON during cmake).
    • Generate API docs: make docs. Documentation is located at <builddir>/doc/api/html.
    • Uninstall: sudo make uninstall.
    cd orocos_kdl
    mkdir build && cd build
    cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_TESTS:BOOL=ON -DCMAKE_BUILD_TYPE=Release
    make
    sudo make install
  3. Compile python_orocos_kdl with catkin

    master

    If you are working within a ROS workspace, follow these steps to build the Python bindings and the underlying C++ library using catkin:

    1. Clone the repository into your workspace.
    2. Initialize the pybind11 submodule.
    3. Build using your preferred catkin tool (e.g., catkin_make or catkin build).
    4. Source your workspace.

    Note: To generate API documentation, you can use rosdoc_lite or catkin_tools_document.

    git submodule update --init
    # Use your preferred catkin build tool
    catkin_make
    source devel/setup.bash
  4. Install Python dependencies for python_orocos_kdl

    master

    Before compiling the Python bindings, ensure the required Python modules are installed on your Debian/Ubuntu system:

    1. Install psutil and future (Mandatory).
    2. Install Sphinx (Optional, used for generating API documentation).
    # Mandatory dependencies
    sudo apt-get install python3-psutil python3-future
    
    # Optional: for API documentation
    sudo apt-get install python3-sphinx
  5. Build Orocos KDL with catkin

    master

    If you are working within a ROS environment, you can build Orocos KDL using catkin:

    1. Clone the repository into your catkin workspace.
    2. Build using your preferred catkin tool (e.g., catkin_make or catkin build).
    3. Source the workspace.

    To generate API documentation in a catkin environment, you can use rosdoc_lite or catkin_tools_document.

  6. Compile python_orocos_kdl without catkin

    master

    To build the Python bindings manually outside of a ROS workspace:

    1. Clone the repository.
    2. Initialize the pybind11 submodule.
    3. Mandatory: Ensure the C++ library (orocos_kdl) is compiled following the instructions in orocos_kdl/INSTALL.md.
    4. Create and enter a build directory.
    5. Run cmake ... You can optionally set CMAKE_INSTALL_PREFIX or CMAKE_BUILD_TYPE.
    6. Run make to compile.
    7. Run sudo make install to install the bindings.
    8. Update the shared library cache with sudo ldconfig.
    9. Ensure /usr/local/lib is in your LD_LIBRARY_PATH.

    Verification & Documentation:

    • Run tests: python3 ../tests/PyKDLtest.py
    • Generate docs: sphinx-build ../doc docs
    git submodule update --init
    # (Ensure C++ library is already compiled)
    mkdir build && cd build
    cmake ..
    make
    sudo make install
    sudo ldconfig
    
    # Set LD_LIBRARY_PATH if necessary
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    
    # Optional: Run tests
    python3 ../tests/PyKDLtest.py