This release is a pre-release and may not be stable for production use.
Deep Learning Kinematics
Differentiable Forwad Kinematics for TensorFlow and Keras
Supported Joint Types:
- Fixed
- Revolute
- Continious
- Prismatic
- Floating (not coverd by unit tests)
- 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:
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
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.
-
Build the docker image for tests:
$ docker build -t dlkinematics_tests . -
Start the container in the root folder of the project:
$ docker run -it -v $PWD:/work dlkinematics_tests python3 -m pytest -
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
Metadata
Release files for dlkinematics 0.1.0rc4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dlkinematics-0.1.0rc4.tar.gz | 19.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dlkinematics-0.1.0rc4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.6 kB
Release files / dlkinematics-0.1.0rc4.tar.gz
| Download URL | dlkinematics-0.1.0rc4.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4208f71e059e86f9cee97746ceccc50615f8838ee745c0e9c238df6b5a3345c6
|
|
BLAKE2b-256 checksum How to use checksums |
cfdbc10d289d3ae7eeaef4590b1723c384995d6b879fc24b898f92b464f06964
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.10 Linux/5.8.13-050813-generic
|
Release files / dlkinematics-0.1.0rc4-py3-none-any.whl
| Download URL | dlkinematics-0.1.0rc4-py3-none-any.whl |
|---|---|
| Size | 22.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9403dd458a9bc3e47120790ed5774af90c60187de232ae693edc8ff9d271d36
|
|
BLAKE2b-256 checksum How to use checksums |
17c1c5a09e84c36e6ec3b8e04451e99a065e7a5271440d53e8e52ed039999c6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.10 Linux/5.8.13-050813-generic
|