Example Code

Servo Easing algorithm using 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.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Overview
This is an extension to my colour tracking project - myTracker. I used this Servo Easing algorithm on two servos in a pan/tilt mechanism in order too smoothen their movement, as they appeared to be "jerky" and made the colour tracking with the mechanism much harder than it had to be. The source of the algorithm can be found here.

Servo Easing is whenservos change their position gradually, first changing quickly and slowing down near the target position in order to make the movement smooth.


Description
The position values here range from 0.01 to 0.99 as you would provide the PWM terminals on a myRIO. The user has the ability to set the initial position target as well as change  the target in order to observe how the position changes over time. The example code initially has a 100ms delay in order to make it easier to see the dynamic behaviour of the algorithm, the delay can be set to 0 ms in order to see how the position would change in near real-time conditions. It is worth noting that the time in the code cannot have a a resolution finner than 1ms due to OS limitations, for example, being run on Windows.

Below you have the easing algorithm and an example that helps to visualise what the algorithm does.


Requirements

Software:

LabVIEW 2014(or compatible)

 

Steps to Implement or Execute Code

  1. Download the .zip file
  2. Set your desired configuration (a, x1, x2, degrees, etc)
  3. Run the VI

 

Additional Information or References
VI Block Diagram

1.png

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

Applications Engineer
National Instruments UK & Ireland

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

Comments
qasim03354420475
Member
Member
on

 hi, sir i run your program mytracker on myrio but it not work smoothly i don't understand how implement the ease algorithm on that project to smooth the motors.    

qasim03354420475
Member
Member
on