dlkinematics


Namedlkinematics JSON
Version 0.1.0rc4 PyPI version JSON
download
home_pagehttps://github.com/lumoe/dlkinematics
SummaryDifferentiable Forward Kinematics for TensorFlow and Keras based on URDF files
upload_time2022-11-30 19:04:46
maintainer
docs_urlNone
authorLukas Mölschl
requires_python>=3.8,<3.11
licenseBSD 3-Clause License
keywords tensorflow kinematics forward-kinematics urdf robotics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![dlkinematics](https://github.com/lumoe/dlkinematics/actions/workflows/main.yml/badge.svg)](https://github.com/lumoe/dlkinematics/actions/workflows/main.yml)

# Deep Learning Kinematics

### Differentiable Forwad Kinematics for TensorFlow and Keras

Supported Joint Types:

- [x] Fixed
- [x] Revolute
- [x] Continious
- [x] Prismatic
- [x] Floating (not coverd by unit tests)
- [x] Planar (not coverd by unit tests)

## Installation

### Install from PyPi

`$ pip install dlkinematics`

### Install from source

`$ pip install -e git+https://github.com/lumoe/dlkinematics.git@main#egg=DLKinematics`

## Usage:

```python
import tensorflow as tf
from dlkinematics.urdf import chain_from_urdf_file
from dlkinematics.dlkinematics import DLKinematics

# Load URDF
chain = chain_from_urdf_file('data/human.urdf')

# Create DLKinematics
dlkinematics = DLKinematics(
   chain,
   base_link="human_base",
   end_link="human_spine_2",
   batch_size=2)

# Joint configuartion
thetas = tf.Variable([1., 2., 3., 4.], dtype=tf.float32)

# Forward pass
with tf.GradientTape() as tape:
    result = dlkinematics.forward(thetas)

print(result)
print(tape.gradient(result, thetas))

```

## As Keras Layer

```python
from dlkinematics.training_utils import ForwardKinematics
from tensorflow import keras
import tensorflow as tf

model = keras.Sequential()

FK_layer = ForwardKinematics(
   urdf_file = 'path/to/urdf',
   base_link = 'link0',
   end_link = 'linkN',
   batch_size = 2)

model.add(FK_layer)
# Output shape of FK_layer is (batch_size, 4, 4)
```

## Run tests

The tests use ROS packages to validate the result of the dlkinematics module.

1. Build the docker image for tests:  
   `$ docker build -t dlkinematics_tests .`

1. Start the container in the root folder of the project:  
   `$ docker run -it -v $PWD:/work dlkinematics_tests python3 -m pytest`

1. Execute all tests:  
   `$ docker run -it -v $PWD:/work dlkinematics_tests python3 -m pytest`  
   Execute only a single testfile:  
   `$ docker run -it -v $PWD:/work dlkinematics_tests python3 -m pytest tests/test_prismatic.py`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lumoe/dlkinematics",
    "name": "dlkinematics",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.11",
    "maintainer_email": "",
    "keywords": "tensorflow,kinematics,forward-kinematics,urdf,robotics",
    "author": "Lukas M\u00f6lschl",
    "author_email": "lukas+pypi@moelschl.com",
    "download_url": "https://files.pythonhosted.org/packages/cf/db/c10d289d3ae7eeaef4590b1723c384995d6b879fc24b898f92b464f06964/dlkinematics-0.1.0rc4.tar.gz",
    "platform": null,
    "description": "[![dlkinematics](https://github.com/lumoe/dlkinematics/actions/workflows/main.yml/badge.svg)](https://github.com/lumoe/dlkinematics/actions/workflows/main.yml)\n\n# Deep Learning Kinematics\n\n### Differentiable Forwad Kinematics for TensorFlow and Keras\n\nSupported Joint Types:\n\n- [x] Fixed\n- [x] Revolute\n- [x] Continious\n- [x] Prismatic\n- [x] Floating (not coverd by unit tests)\n- [x] Planar (not coverd by unit tests)\n\n## Installation\n\n### Install from PyPi\n\n`$ pip install dlkinematics`\n\n### Install from source\n\n`$ pip install -e git+https://github.com/lumoe/dlkinematics.git@main#egg=DLKinematics`\n\n## Usage:\n\n```python\nimport tensorflow as tf\nfrom dlkinematics.urdf import chain_from_urdf_file\nfrom dlkinematics.dlkinematics import DLKinematics\n\n# Load URDF\nchain = chain_from_urdf_file('data/human.urdf')\n\n# Create DLKinematics\ndlkinematics = DLKinematics(\n   chain,\n   base_link=\"human_base\",\n   end_link=\"human_spine_2\",\n   batch_size=2)\n\n# Joint configuartion\nthetas = tf.Variable([1., 2., 3., 4.], dtype=tf.float32)\n\n# Forward pass\nwith tf.GradientTape() as tape:\n    result = dlkinematics.forward(thetas)\n\nprint(result)\nprint(tape.gradient(result, thetas))\n\n```\n\n## As Keras Layer\n\n```python\nfrom dlkinematics.training_utils import ForwardKinematics\nfrom tensorflow import keras\nimport tensorflow as tf\n\nmodel = keras.Sequential()\n\nFK_layer = ForwardKinematics(\n   urdf_file = 'path/to/urdf',\n   base_link = 'link0',\n   end_link = 'linkN',\n   batch_size = 2)\n\nmodel.add(FK_layer)\n# Output shape of FK_layer is (batch_size, 4, 4)\n```\n\n## Run tests\n\nThe tests use ROS packages to validate the result of the dlkinematics module.\n\n1. Build the docker image for tests:  \n   `$ docker build -t dlkinematics_tests .`\n\n1. Start the container in the root folder of the project:  \n   `$ docker run -it -v $PWD:/work dlkinematics_tests python3 -m pytest`\n\n1. Execute all tests:  \n   `$ docker run -it -v $PWD:/work dlkinematics_tests python3 -m pytest`  \n   Execute only a single testfile:  \n   `$ docker run -it -v $PWD:/work dlkinematics_tests python3 -m pytest tests/test_prismatic.py`\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "Differentiable Forward Kinematics for TensorFlow and Keras based on URDF files",
    "version": "0.1.0rc4",
    "split_keywords": [
        "tensorflow",
        "kinematics",
        "forward-kinematics",
        "urdf",
        "robotics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "db1b1f06957a3ed3a530d564666c98f7",
                "sha256": "c9403dd458a9bc3e47120790ed5774af90c60187de232ae693edc8ff9d271d36"
            },
            "downloads": -1,
            "filename": "dlkinematics-0.1.0rc4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db1b1f06957a3ed3a530d564666c98f7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.11",
            "size": 22130,
            "upload_time": "2022-11-30T19:04:44",
            "upload_time_iso_8601": "2022-11-30T19:04:44.561401Z",
            "url": "https://files.pythonhosted.org/packages/17/c1/c5a09e84c36e6ec3b8e04451e99a065e7a5271440d53e8e52ed039999c6f/dlkinematics-0.1.0rc4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "4edc69892f8ceb20a0fbe9f829db3ef8",
                "sha256": "4208f71e059e86f9cee97746ceccc50615f8838ee745c0e9c238df6b5a3345c6"
            },
            "downloads": -1,
            "filename": "dlkinematics-0.1.0rc4.tar.gz",
            "has_sig": false,
            "md5_digest": "4edc69892f8ceb20a0fbe9f829db3ef8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.11",
            "size": 19430,
            "upload_time": "2022-11-30T19:04:46",
            "upload_time_iso_8601": "2022-11-30T19:04:46.624346Z",
            "url": "https://files.pythonhosted.org/packages/cf/db/c10d289d3ae7eeaef4590b1723c384995d6b879fc24b898f92b464f06964/dlkinematics-0.1.0rc4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-11-30 19:04:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "lumoe",
    "github_project": "dlkinematics",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dlkinematics"
}
        
Elapsed time: 0.06523s