From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY graph as control input device

I'm trying to use a XY graph as an input device (virtual joystick) that controls a crosshair nad also provides coordinates inside a live video feedback from a webcam in labview 2012 64bit , but I can't get the VI to work properly. I've made the VI for the "virtual joystick" and for the video feedback . I can't figure out how to make the VI for the crosshair.

 

Download All
0 Kudos
Message 1 of 4
(3,479 Views)

Nikio17,

 

Please take a look at these two forums. I think this will  help you. 

 

How do I add a cross hair to a xy chart - Discussion Forums
http://forums.ni.com/t5/LabVIEW/How-do-I-add-a-cross-hair-to-a-xy-chart/td-p/627088

 

XY Graph Cursor - Discussion Forums
http://forums.ni.com/t5/LabVIEW/XY-Graph-Cursor/m-p/110625?query.id=8335#M66922

 

William Fernandez

Applications Engineer

National Instruments

0 Kudos
Message 2 of 4
(3,432 Views)

To use a cursor of an XY graph as a 2D control, the graph does not need to be a control, it can as well be an indicator.

 

It seems using an xy graph is overkill adds a bit too much overhead, because you only use 5% of the xy-graph functionality. You could easily use e.g. a picture indicator. If you would use a picture indicator, you could even draw some stylized background looking like a joystick as a function of mouse position, for example. You would need to keep the "mouse down" state in a shift register, and only react to mouse positions while the button is held down.

 

If you want to use a cursor of an xy graph, you should do a few things. For example you should disable "cursors scroll graphs", else the axes will scroll when the cursor is moved past the boundary. Your code also spins the while loop like crazy. All you need is spin the loop when the cursor changes. Use an event structure. Attached is a very simple rewrite of your code. (You still should ensure that the cursors remain coerced to the plot area, not shown).

0 Kudos
Message 3 of 4
(3,421 Views)

As I said, a 2D picture is probably an better way to do this. Here is a very simple example.

 

 

0 Kudos
Message 4 of 4
(3,414 Views)