Example Code

4DOF IK implemented in NI MathScript Maintaining Perpendicular End Effector in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Motion Control

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

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.

 

Description

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.

 

Requirements

LabVIEW 2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Enter the XYZ position you wish to move to
  2. Enter the Arm Dimensions
  3. Enter constants (m and c) into the indicated section of the MathScript node which correspond to your servos
  4. Run the code

 

Additional Information or Resources

VI Block Diagram

Capture3.PNG

Derivation of the Algorithm

Capture1.PNGCapture2.PNG

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Regards,

Al C
National Instruments,
Application Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
nickksh
Member
Member
on

Hi icouldnt find the type definition available so i was not able to run the program. could you please provide them also.

Thanks

Al.C
Member
Member
on

Hi nickksh,

Thank you for flagging this up, I have uploaded the .ctl files for LV 13.

Regards,

Al C
National Instruments,
Application Engineer
nickksh
Member
Member
on

Hello AI.C

I followed your program and got the concept u are using but I am sorry I am not able to get the angles for my robotic arm correct. In regards to my arm the servos are contrained by 180 degrees with angles going from -90 to +90. I did implement some changes but still the angles fail to work. could you please explain where am i going wrong.