May 122013
 

Robot sunbeam
As a followup to our reverse engineering and configuration of 6DOF PUMA robot arms, we’ve updated our controller source code to have full closed form inverse kinematics support. The math is based on A Geometric Approach in Solving the Inverse Kinematics of PUMA Robots, by Lee and Ziegler (1983). Due to the configuration of prismatic and rotational joints in the PUMA arms, it is possible to derive a two part direct trigonometric solutions to the IK problem for this type of arm.

PUMA 560 joint diagram
The IK solution uses the DH Parameters to compute the three joint angles for the major axes (the rotation around the stalk, the upper-arm angle, and the fore-arm angle) such that the center of the spherical joint will be placed at a given XYZ position. There are two binary additional binary parameters for this configuration: RIGHT/LEFT controls the orientation of the arm on the right or left side of the stalk, and OVER/UNDER for the configuration of the elbow pointing up or down. See figure 5 in the paper for a diagram of the four possible combinations of these two parameters.

PUMA wrist diagram
Once the first three theta angles are known, the second phase of the IK solution computes the last three wrist joint angles given the third binary parameter UP/DOWN, and three vectors: the “approach vector” a[] that points in the direction of the tool, the “sliding vector” s[] that points in the direction of the grasping joint, and the “normal vector” n[] that points towards the top of the tool. Figure 4 from the paper shows the relationship of these three vectors in the hand coordinate system.


This video shows the IK iterating between two points (in RIGHT and OVER mode) and generating a piecewise linear path that holds the tool (a cheap pen) mostly level on a constant heading aligned with the X axis. It is a little jerky since the motor controllers don’t have a way to chain commands between points and my calibration on the joint lengths and angles isn’t perfect. Also note that the wrist joints are cross-coupled and require proportional adjustments based on the other joints positions, so the code has some fudge factors to try to account for this behaviour. There are also some corner cases to be sorted out when the “best” joint angles switch quadrants, which will swing the tool around in a circle.

The code isn’t super clean and can use some refactoring to move the DH parameters into a config file, but hopefully you’ll enjoy the human readable code compared to the machine generated ikfast output.

Apr 232013
 


A year ago Super Awesome Sylvia demoed MarioChron for the Adafruit MonoChron dekstop clock kit. It’s really neat — once per minute Mario hits the box and receives a coin, so his score is equal to the time. Now thanks to the GPL license on the code, you can carry it on your wrist with the port of MarioChron to the Pebble Smart Watch:
MarioChron, Pebble edition
You can install the prebuilt mario.pbw binary and the source is available for further hacking. Here’s a short video of Mario’s coin collecting action (the jump height has since been fixed in the source code).

The code is a straightforward port that reuses almost all of the original logic. The only change is to rearrange the screen slightly from the MonoChron’s 128×64 LCD to the Pebble’s 168×144. This involved translating the glcdClearDot() and glcdSetDot() calls to 2×2 rectangles using the Pebble’s graphics_fill_rect() functions. Unfortunately the e-paper display on the Pebble is designed for mostly static images, and updating it at 10 Hz for the animation draws far more power than a once-per-minute clock face. This means that this watch face consumes lots of power and the Pebble only lasts part of one day instead of an entire week. Perhaps optimizing the redraws instead of redrawing the entire screen would let it last longer.

Want to learn how to write your own watches for the Pebble? Sign up for the May 18 Pebble programming class at NYCR or come to the hackathon after!

Apr 162013
 

Pebble Polar Map
What time is it? It’s time to #MakeAwesomeHappen and learn to program the new Pebble Smart Watch! We’ll be teaching a three hour class on 18 May on how to write custom watch faces that work with the official Pebble SDK. The programming environment is low-level C, with no memory protection, and no emulator nor a debugger, so you’ll need to be fairly comfortable with writing embedded code or at least not afraid to debug with printf()*. If you’ve programmed a device like an Arduino you should be ok with the class. Tickets for the class are on sale for $125. The hackathon afterwards is free!

Pebble wordsquare watch
If you haven’t heard of it, Pebble was the wildly successfull kickstarter project that pre-sold over 80,000 watches. The watch has a 144×168 transreflective e-paper display, an ARM M3, Bluetooth, an accelerometer and lots of potential. MyPebbleFaces has a few hundred ideas for fun projects and many people have already programmed their dream watch faces.

NYCR Lan party
After the class, we’ll be holding an all-night hackathon to write some new watches. Developers from Team Pebble will be here to hack with us and help answer any deep questions about the API. The hackathon is open to everyone with a Pebble and is a great chance to meet other wearable wrist-watch computing enthusiasts in New York. If you don’t have your Pebble yet or don’t want to risk your prized wristwatch, we’ll have a limited quantity of factory seconds that might not be waterproof, might have glue bubbles, or discoloured bezels or other QC issues available for $75. Tickets for the class and hackable watches are available here!