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

tharp

v3.0.0

Published

Inverse Kinematic solvers and robot control, optimized for Johnny-Five

Downloads

85

Readme

tharp

Dancing Robots

Join the chat at https://gitter.im/dtex/tharp

Build Status

Tharp is an inverse kinematics solver and robot manager designed to work with Johnny-Five. It makes the hard things easy. Check out this video highlighting Tharp's performance.

Installation

npm install tharp

Documentation

Tharp documentation can be found in the wiki.

Example

// This is a simple excerpt, illustrating the configuration
// of robot with two legs
var five = require("johnny-five"),
  tharp = require("tharp");

var board = new five.Board().on("ready", function() {

  /* === Begin robot configuration === */

  // Tharp.Chain() wraps our actuators and adds properties
  // that define the kinematic system. The "chainType" property defines
  // the joint/link configuration.
  var leftLeg = new tharp.Chain({
    constructor: five.Servos,
    chainType: "ZYY",
    origin: [4.25, 0.15, 2.875],
    links: [ 2.6, 7.6125, 10.4],
    actuators: [
      {pin:40, offset: 24, startAt: 0, range: [0, 90] },
      {pin:39, offset: 87, startAt: 78, range: [-80, 78] },
      {pin:38, offset: 165, invert: true, startAt: -140, range: [-160, -10] }
    ]
  });

  var rightLeg = new tharp.Chain({
    constructor: five.Servos,
    chainType: "ZYY",
    origin: [-4.25, 0.15, 2.875],
    links: [ 2.6, 7.6125, 10.4],
    actuators: [
      {pin:27, offset: -31, startAt: 180, range: [90, 180] },
      {pin:26, offset: -77, startAt: 102, range: [110, 260] },
      {pin:25, offset: -176, invert: true, startAt: 320, range: [180, 340]}
    ]
  });

  // Robot() wraps our chains, gives us a place to orient the
  // robot chassis and ensures that all chains can be rendered
  // before rendering the entire robot movement
  var robot = new tharp.Robot({
    chains: [rightLeg, leftLeg]
  });

  /* === End robot configuration === */

  // Now we can orient the chassis
  robot.orientation({ pitch: 0.1, roll: -0.08, yaw: -0.13 });
  robot.offset([ 1, -1, -0.2 ]);

  // And position our end effectors
  rightLegChain.solve({position: [8.25, 2.5, -5.0]});
  leftLegChain.solve({position: [-8.25, -2.25, -5.0]});

  // Move everything
  robot.render();

});

Breaking Changes

  • 1.0.0 Swapped Y and Z axes to better match best practices. Renamed "CoxaY-FemurZ-TibiaZ" chain type to "ZYY".
  • 2.0.0 Changes segments to an array since part names are arbitrary. One person's "coxa" is another person's "hip" and then another person's "shoulder".
  • 3.0.0 Changes segments to links to reflect the proper name.