Giter Club home page Giter Club logo

dlkinematics's Introduction

dlkinematics

Deep Learning Kinematics

Differentiable Forwad Kinematics for TensorFlow and Keras

Supported Joint Types:

  • Fixed
  • Revolute
  • Continuous
  • Prismatic
  • Floating - 6-DoF joint (not coverd by unit tests)
  • Planar (not coverd by unit tests)

Installation

Install from PyPi

$ pip install 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.

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

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

  3. 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

dlkinematics's People

Contributors

lumoe avatar jkbjh avatar

Stargazers

Cheng Guo avatar ZhengmaoHe avatar Anton Weiss avatar Linux *User avatar Bernhard Reiterer avatar Martin Stohanzl avatar Andreas Hartl-Bachinger avatar  avatar Peer David avatar Tadashi avatar Giseop Kim avatar  avatar Elizaveta Zaburunova avatar

Watchers

 avatar Tadashi avatar Giseop Kim avatar singh281 avatar  avatar Kostas Georgiou avatar

Forkers

nexus1203

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.