npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stewart

v1.0.2

Published

A library to calculate the inverse kinematics of a Stewart Platform

Downloads

45

Readme

Stewart Platform

NPM Package MIT license

Stewart Platforms are used for motion platforms with six dimensions of freedom. With this library you can simulate Stewart Platforms as well as use the calculated angles to drive a real platform.

Visualization

Stewart-Platform

The code can run headless, but to set up all parameters properly, a visualization of the platform can help a lot. To do so, we use p5.js and quaternion.js

<script src="p5.js"></script>
<script src="quaternion.js"></script>
<script src="stewart.js"></script>
<script>
var sketch = function(p) {

  p.setup = function() {
    p.createCanvas(600, 600, p.WEBGL);

    p.camera(100.0, -290.0, (p.height / 2.0) / Math.tan(Math.PI / 6),
            0.0, 0.0, 0.0,
            0.0, 1.0, 0.0);

    platform = new Stewart;
    platform.initHexagonal(/*{ options }*/);
  };

  p.draw = function() {

    p.background(255);

    p.push();

    p.translate(50, -70, 200);
    p.rotateX(Math.PI / 2); // Work in correct X-Y-Z plane

    // Set correct position where to drive to
    platform.update([0, 0, 0], Quaternion.ONE);

    // Draw the updated platform
    platform.draw(p);

    // Send to servos
    // platform.getServoAngles();

    p.pop();
  };
};
new p5(sketch, 'canvas');
</script>

Examples

In the examples folder are use cases documented.

Default

The default example can be controlled via key presses on letters from a-z on the keyboard. Not all letters have a function.

Stewart-Platform

Here is a list:

  • q: Skewed square
  • w: wobble
  • e: eight
  • r: rotate
  • t: tilt
  • y: lissajous
  • m: mouse control
  • g: Gamepad control, using Gamepad Web API
  • b: Simulation of breath
  • h: Helical animation

SVG Plotter

SVG paths are parsed and used for motion commads. This way SVG images can be plotted with a Stewart platform by attaching a pen:

Stewart-Platform

LeapMotion

The hand tracking device LeapMotion can be read via JavaScript using the leapjs package. The example uses the LeapMotion to use the hand position and orienttion as input for the platform.

Options

The platform visualization is meant to draw a platform in milimeter. When you work headless, the unit does not matter. The following options are available:

rodLength

The length of the rod attached to the servo horn and the platform. Default=130

hornLength

The length of the servo horn attached to the motor shaft and the rod. Default=50

hornDirection

The horn direction indicates if the servo horn is rotated to the left or to the right. 0=right, 1=left, Default=0

servoRange

A valid range for the servo motors to rotate. A typical low-cost servo has 180° working space. The value is an array [minAngle, maxAngle]. Default=[-pi/2, pi/2]

servoRangeVisible

A boolean if the servo range should be visible in the drawing. Default=false

baseRadius + baseRadiusOuter

When a hexagonal stewart platform is used, the baseRadiusOuter is used to draw the base plate in accordance to the description.

platformRadius + platformRadiusOuter

When a hexagonal stewart platform is used, the platformRadiusOuter is used to draw the platform plate in accordance to the description.

shaftDistance + ankerDistance

For a circular platform this indicates the radial distance of pairs of rod ankers between the shafts on the base plate and the platform plate. For hexagonal platforms this indicates the distance from the middle of a side to attach the rod ankers. Default=20

platformTurn

A boolean for hexagonal platforms to indicate if the platform shall look into the same direction as the base plate. Default=true

Installation

Installing Stewart is as easy as cloning this repo or use one of the following command:

npm install stewart

Copyright and licensing

Copyright (c) 2019, Robert Eisele Dual licensed under the MIT or GPL Version 2 licenses.