Skip to content
Donovan Buck edited this page Dec 1, 2015 · 14 revisions

Tharp is an inverse kinematics solver and robot controller for Johnny-Five. Tharp makes hard things easy.

Big Robot

Things To Know

To get enjoyment out of Tharp you should be comfortable with Javascript, node.js, npm, and johnny-five. You do not need to know much about robotics, robot gaits, linear algebra or trigonometry unless you will be adding your own chain types or robots.

Getting Started

  1. Get Oriented

You are now at the point where you can pass in an array of positions to Robot["@@render"] and Tharp will position them. Don't feel like writing your own code to determine positions? Johnny-Five can help with that.

  1. Working with Johnny-Five's Animation() class.
  • Building a simple sequence
  • Building a walk sequence
  • Building a turn sequence

You should now be able to create your animation sequences and control your robot. Don't feel like creating your own animation sequences? Check the list of predefined robot control programs below. If your robot is not listed, I'm happy to add it but I need hardware so that would have to be worked out.

Predefined robots

Lynxmotion Phoenix

Tharp Classes

A Tharp chain will Wrap the actuators so that we have all the info and methods we need to define and solve for a single kinematic chain. More info

A Tharp Robot() will group chains, giving you a single object for managing the robot's orientation and making sure that all required chains can be solved before rendering the movement. More info


Tharp Helper Methods

Tharp.radToDeg(radians)

Converts radians to degrees

Tharp.degToRad(degrees)

Converts degrees to radians

Tharp.solveAngle(a, b, c)

Given three sides this will solve a triangle using law of cosines

  • @param {Number} a: An adjacent side's length
  • @param {Number} b: The other adjacent side's length
  • @param {Number} c: The opposite side's length

Returns the angle in radians

Tharp.findValidAngle(radians, range)

Given an angle in radians and a range in degrees this will find the correct quadrant for the servo given the range/angle.

Returns the angle in degrees unless no solution can be found. In which case an error is returned.