GithubHelp home page GithubHelp logo

kustomzone / kinematics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glumb/kinematics

0.0 1.0 0.0 13 KB

๐Ÿค– JavaScript 6DOF robot kinematics library

License: MIT License

JavaScript 100.00%

kinematics's Introduction

kinematics.js

GitHub license Travis npm Codecov

6DOF robot kinematics in JavaScript.

Install

npm install kinematics --save

Use

const Kinematics = require('kinematics').default

const geometry = [
      [1,  1,  0], // V0: 1x 1y
      [0, 10,  0], // V1: 10y
      [5,  0,  0], // V2: 5x
      [3,  0,  0], // V3: 3x
      [0, -3,  0], // V4: -3y
    ]

const RobotKin = new Kinematics(geometry)

let angles = [1.57, 1.2, 0, 0.3, 2.2, 1.1]

const pose = RobotKin.forward(...angles)[5]

angles = RobotKin.inverse(...pose)

Geometry

The geometry array consists of 5 entries describing the links V0-V5. Each Vn is a tuple of 3 coordinates from Jn to Jn+1. One constraint: The y,z of V3 and x,z of V4 must be 0 for the kinematics to work.

API

forward

RobotKin.forward(R0, R1, R2, R3, R4, R5)

returns

[ 
  [  0,      0,     0 ], //J0
  [  0.5,    1,  -0.8 ], //J1
  [ -0.2, -8.8,   0.3 ], //J2
  [  1.8, -5.6,  -2.8 ], //J3
  [  3.0, -3.6,  -4.7 ], //J4
  [  4.7, -1.3,  -5.5,  1,  6,  -2.8 ] //J5 + TCP Euler angles
]

inverse

X,Y,Z coordinates, A,B,C Euler angles in order 'abc'.

RobotKin.inverse(X, Y, Z, A, B, C)

returns

[  2, 1.6,  2.1, -3.5,  1, -1.5 ] //array of angles
[  1, 2.3,  3.1,  NaN, NaN, NaN ] //NaN for out of reach angles

kinematic coupling

kinematics.js assumes a robot with a series of joints. Some robots may have different kinematics. The depicted robot has a hinge at J1 and R1/R2 are at the same kinematic position. Therefore moving R1 also changes the angle at J2. To account for that, R2 has to move the same amount.

sr_geometry_kinematic_coupling

Using that information, you can use kinematics.js to calculate the initial angles and correct them according to your kinematics.

let angles = RobotKin.inverse(...pose)
angles[2] += angles[1]
//set angles, do stuff ๐Ÿค–

TODO

  • robot configuration
  • comply with DH for TCP orientation?
  • more kinematic chains

Demo

See the kinematics in action: http://robot.glumb.de (Use Chrome or FF due to ES6 features) robot-gui The gui is available in this repo:https://github.com/glumb/robot-gui

kinematics's People

Contributors

glumb avatar

Watchers

 avatar

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.