LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to graph joystick coordinate in real time?

Hello all,

I am new to the Labview software and am trying to make a program using the software that graphs a joystick's Y axis inputs onto a graph in the program.  I would like the x axis to represent the time elapsed since the program started and the y axis to represent the position of the joystick. Can anybody point me in the right direction to start? Thank you. (I am using a Thrustmaster joystick)

0 Kudos
Message 1 of 10
(3,874 Views)

There is a sub vi in LabVIEW that could get you the coordinate info of mouse/joystick, and you can plot the y axis with time. Just search "mouse" in the example.

0 Kudos
Message 2 of 10
(3,859 Views)

Joysticks are a little different from Keyboards and Mice, but have a set of VIs that are lumped with these two input devices.  If you Google "LabVIEW Joystick", you'll fine a VI that shows how to set up a Joystick and take a single reading.  You will probably want to add a While Loop with a Wait Timer to take multiple readings and graph them.

 

Note that not all Joysticks will show up in LabVIEW.  There's a suggestion on the LabVIEW Idea Exchange here that I posted about 5 years ago and reposted last year when not enough people "Kudo-ed" it to nudge NI into fixing this problem.  If you intend to use joysticks, I recommend you read the Idea and Kudo it.

 

Bob Schor

0 Kudos
Message 3 of 10
(3,842 Views)

Do you have problems reading the joystick, or problems graphing the data, or both.

0 Kudos
Message 4 of 10
(3,833 Views)

the program is reading the joystick inputs, I am having trouble graphing this data as a function of elapsed time

0 Kudos
Message 5 of 10
(3,825 Views)

If the points are randomly spaced in time, you probably want to use an xy graph and build the xy data (e.g. as a complex 1D array) in a shift register. Do you want absolute or relative time? What is the max number of points?

 

0 Kudos
Message 6 of 10
(3,815 Views)

You should post your code (attach the actual VI, not a picture).  Did you read my post, where I said "You will probably want to add a While Loop with a Wait Timer to take multiple readings and graph them."?  

 

Bob Schor

0 Kudos
Message 7 of 10
(3,803 Views)

Here is a file of my current VI. The VI can read the input data from the joystick, but it is unable to plot the data in a graph! any help is appreciated thank you

0 Kudos
Message 8 of 10
(3,777 Views)

You "Build xy graph" express VI is configured to "clear data on each call", meaning it will never graph more than one point, and since your plot style only shows lines (not points!), nothing can ever be drawn. Double-click the express VI and un-check the option.

0 Kudos
Message 9 of 10
(3,759 Views)

I don't know whether to "blame" NI for inventing Express VIs or Instructors who don't caution students "Do Not Use An Express VI until you understand how to do without it!".  Yes, they look simple, and are designed so a LabVIEW Sales Engineer can show "how easy it is to get started collecting data in LabVIEW", but they cover up a multitude of sins.  Of course, reading carefully the Help documentation and poking around in the corners before slapping down the "simple answer" also would help ...

 

Bob Schor

0 Kudos
Message 10 of 10
(3,752 Views)