🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

kinematics-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kinematics-js

A forward and inverse kinematics package for a basic 6 axis robotic arm.

1.0.8
latest
npm
Version published
Weekly downloads
4
-42.86%
Maintainers
1
Weekly downloads
 
Created
Source

Kinematics.js

A forward and inverse kinematics package for a basic 6 axis robotic arm.

Robot Move Robot Euler

Inverse

import { inverse } from 'kinematics-js';

inverse(5, 0, 11, 0, 0, 0, {
  base: 1,
  v1: 2.5,
  v2: 3,
  v3: 2.5,
  v4: 2.5,
  v5: 2.5,
  v6: 2,
});
ParameterDescription
xx cartesian coordinate in the three dimensional space relative to the base frame
yy cartesian coordinate in the three dimensional space relative to the base frame
zz cartesian coordinate in the three dimensional space relative to the base frame
r1euler angle 1, the rotation around the z1 axis of the end effector
r2euler angle 2, the rotation around the x axis of the end effector
r3euler angle 3, the rotation around the z2 axis of the end effector
configrobot configuration see table below
KeyrequiredDescription
basenoheight of the base
v1yeslength between joint 1 and 2
v2yeslength between joint 2 and 3
v3yeslength between joint 3 and 4
v4yeslength between joint 4 and 5
v5yeslength between joint 5 and 6
v6yeslength between joint 6 and the end effector

Examples:


// First define a config for the robot
const config == {
  v1: 2.5,
  v2: 3,
  v3: 2.5,
  v4: 2.5,
  v5: 2.5,
  v6: 2,
};

/**
 *     |
 *    [ ]
 *     |
 *    ( )
 *     |
 *    [ ]
 *     |
 *    ( )
 *     |
 *    ( )
 *     |
 *    [ ]
 */
inverse(0, 0, 15, 0, 0, 0, config)
// ==> [0, 0, 0, 0, 0, 0]

/**
 *                  [ ]
 *                   |
 *    ( ) -- [ ] -- ( )
 *     |
 *    ( )
 *     |
 *    [ ]
 */
inverse(5, 0, 10, 0, 0, 0, config)
// ==> [0, 0, -Math.PI / 2, 0, Math.PI / 2, 0 ]

/**
 *                  [ ]
 *                   |
 *    ( ) -- [ ] -- ( )
 *     |
 *    ( )
 *     |
 *    [ ]
 */
inverse(5, 0, 11, 0, 0, 0, { ...config, base: 1 })
// ==> [0, 0, -Math.PI / 2, 0, Math.PI / 2, 0 ]

Forward

import { forward } from 'kinematics-js';

forward(0, 0, -Math.PI / 2, Math.PI, -Math.PI / 2, 0, {
  v1: 2.5,
  v2: 3,
  v3: 2.5,
  v4: 2.5,
  v5: 2.5,
  v6: 2,
});
// ==>
// [-1, 0, 0, 5],
// [0, -1, 0, 0],
// [0, 0, 1, 10],
// [0, 0, 0, 1],
//
// The return value gives you the rotation matrix and also the cartesian location which you can get below
// const x = res[0][3];
// const y = res[1][3];
// const z = res[2][3];
ParameterDescription
theta1angle of joint j1 in radians
theta2angle of joint j2 in radians
theta3angle of joint j3 in radians
theta4angle of joint j4 in radians
theta5angle of joint j5 in radians
theta6angle of joint j6 in radians
configrobot configuration see table below
KeyrequiredDescription
basenoheight of the base
v1yeslength between joint 1 and 2
v2yeslength between joint 2 and 3
v3yeslength between joint 3 and 4
v4yeslength between joint 4 and 5
v5yeslength between joint 5 and 6
v6yeslength between joint 6 and the end effector

Live Demo

See the kinematics in action here

Robot Move

Kinematics Diagram

Kinematics Diagram

Keywords

kinematics

FAQs

Package last updated on 10 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts