LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graphing movement in LabView

Hello,

I am using LabView to control two ThorLabs stepper motors and stages. My code moves them automatically with no user input after you press run. Now I would like to make a graph the graphs points of the position as the two motors move along there route. They stop at designated points along the route, which are the points I want to graph. One motor is an x axis and one motor is a y axis so I thought it wouldn't be too hard but I can't figure it out.

Thanks!

0 Kudos
Message 1 of 6
(2,876 Views)

Hi winterfresh,

 

when you have XY coordinates you should use an XY graph!

 

Collect your coordinates in X and Y arrays and build a plot from them. The context help of the XY graph shows how to build such a plot…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,862 Views)

Indeed - when you hit a stopping point, simply append a cluster of the current {X | Y} to an array, and pass the array to an X-Y Graph.

 

If you want to get fancier, limit the array to the last 50 points (for example).  Then your old history dies off.

 

If you want to get fancier, set the color of each point to be a dimmer shade of white.  Then the old history fades away.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 6
(2,841 Views)

The problem I am having is colecting the points, and updating the array and graph with new points as the code runs and the motor stops along is designated path. How do you go about doing this?

0 Kudos
Message 4 of 6
(2,674 Views)

presumably your program is sending a command to a motor driver somewhere.  Whether that is discrete pulses or a pulsetrain or a serial command to a smart motor, you should know when it is being told to move. Append your current position to the X-Y array of data points with and refresh (write to) the XY graph  every time you send a command to move. 

 

What architecture are you using?  If you have multiple loops (e.g. motor control and UI) you may need to communicate between them to get the graph to update.  Is that the issue?

0 Kudos
Message 5 of 6
(2,665 Views)

@winterfresh11 wrote:

The problem I am having is colecting the points, and updating the array and graph with new points as the code runs and the motor stops along is designated path. How do you go about doing this?


There are almost as many ways as there are programmers.  If you want specific help on your particular method, post your code so we know what you're trying to do...

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 6 of 6
(2,657 Views)