This example demonstrates using the NI MathScript node to calculate required angles (and PWM values) to move the end effector of a 4 DOF robotic arm to a given position in XYZ co-ordinates, while keeping the End Effector perpendicular to the base.
This code was written as part of a project to use a myRIO to control a Draughts playing robot. A robotic arm was used to pick and place the pieces based instructions from the AI.
This piece of code uses the MathScript node to implement the Inverse Kinematic equations derived for this task. It allows for the dimensions etc. to be changed, so long as consistent units are used throughout.
Information about the Inverse Kinematic equations can be found in the attached Excel sheet.
The calibration equations for the servo's were based on moving each servo to two points, and then using them to derive a straight line equation based on y=mx+c, where y is the PWM value and x is the angle.
LabVIEW 2013 (or compatible)
Steps to Implement or Execute Code
Enter the XYZ position you wish to move to
Enter the Arm Dimensions
Enter constants (m and c) into the indicated section of the MathScript node which correspond to your servos
Run the code
Additional Information or Resources
VI Block Diagram
Derivation of the Algorithm
**This document has been updated to meet the current required format for the NI Code Exchange.**