No project description provided
Project description
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 source
$ pip3 install -e git+https://github.com/lumoe/dlkinematics.git@main#egg=DLKinematics
Install from PyPi
Coming soon
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
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 Distribution
Built Distribution
File details
Details for the file dlkinematics-0.1.0rc1.tar.gz
.
File metadata
- Download URL: dlkinematics-0.1.0rc1.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.8.10 Linux/5.8.13-050813-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ab49718c7cbc753f22c0a23c55f2791694518fe21966f7f533220638351184 |
|
MD5 | dce4fe9d02d1c595b215579d0d2aa509 |
|
BLAKE2b-256 | 08f9f3bc4683474d0d434b1a2b52f12a303bec43368a0359853c38bc88ccebfe |
File details
Details for the file dlkinematics-0.1.0rc1-py3-none-any.whl
.
File metadata
- Download URL: dlkinematics-0.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.8.10 Linux/5.8.13-050813-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9ed1a79e23cc08957dcf02ae7f757962ffce857f19ed8d9919f1e8cf079bbf9 |
|
MD5 | bc22aaac39e26bd02048c5e3156e0bfb |
|
BLAKE2b-256 | d90eb93c204933bf90c5b4e8270346cfcc80c6f17ff3d014297134206d31b62d |