Calibration of the Lynxmotion Robotic Arm
The documentation that comes with the Lynxmotion robotic arm provides detailed steps for how to calibrate the servos. This level of calibration is good enough for recording and playing back arm moves. However, in order to be able to satisfactorily drive the arm using inverse kinematics, more accuracy is needed. In order to facilitate the calibration I used a grid with horizontal and vertical lines (each five mm apart) plus rays (one degree separation) from the origin to facilitate angle measurements. The grid is printed out and affixed to the base plate that the robot arm is mounted on:
In order to create the grid I built a small console application called SvgGridBuilder (C# source code) that uses Ben Peterson's Svg.Net library (for details see the associated CodeProject article http://www.codeproject.com/KB/cs/svgnet.aspx). The application creates a Scalable Vector Graphics (SVG) file that then subsequently can be opened in the open source Inkscape SVG editor (http://www.inkscape.org/) and printed. To simplify the printing I split the overall grid into three letter size tiles:
With this grid in place it is very easy to accurately calibrate the base servo. By using inverse kinematics and measuring the wrist point's height from the base and distance from the base center it is also fairly straight forward to calibrate the shoulder and elbow servos. To further improve the accuracy I took multiple measurements for different angles and then used linear regression in OpenOffice Calc (file extension .ods) to calculate the zero point and the slope (ods file for my robot arm). Excel can be used in the same way. Again for the base angle this is straight forward. However, for the shoulder and elbow servos the angles first need to be calculated using inverse kinematics from the location of the wrist angle. This could be done directly in the spreadsheet. Since I needed the inverse kinematics calculations in code anyway I created a small WPF UI application that allows the user to specify the location of the wrist point and then calculates the associated angles:
The application can also be used to load a robot calibration file (once it is created) and then actually drive the robot arm; but for now we are only interested in its inverse kinematics calculations. The source project (Robot.Kinematics.UI) is part of the Robot.Kinematics.sln solution.
Ultimately the determined calibration parameters are stored in a calibration file (example: RobotCalibration.cfg) that is later loaded by the various robot arm applications.The first line of the file constitutes the header:
Index Name MinPosMilliSecs MaxPosMilliSecs Slope YIntercept
The first column holds the index of the servo starting with 0 for the base servo. The next column specifies a user friendly name for the servo (used in some of the UI applications). Min/MaxPosMilliSecs defines the limits of the servos in milliseconds. Typically servos have a range from 500 to 2500 milliseconds (for details see the Getting Started section of this document: http://www.lynxmotion.com/images/data/ssc-32.pdf). Slope specifies how much the milliseconds value changes per unit of the value of interest (which typically is an angle but is a mm distance in the case of the gripper). Finally, the column YIntercept specifies the milliseconds when the value of interest is zero.
Once the calibration file is saved it can be loaded via the File menu into the Robot.Kinematics.UI application (see screenshot above) and tested by having the robot arm move to the specified location.