From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Creating a Path for your Mouse Pointer

Hi all,

I'm currently working on a project where the main goal is to send the mouse through a pre-made path or maze. This program will test your ability to quickly navigate through the maze, so it will calculate your error for going outside of the set path and also the elapsed time through it. I have designed a simple state machine to track the mouse and graph the position. The problem I am having is figuring out how to create this path. I want it to have set coordinates that I will be able to compare to the mouse coordinates, but I'm struggling to figure out how to do this. Currently I'm just using decorative blocks to map my path. 

 

Another issue I was trying to figure out was that I wanted to either put up "barriers" or "walls" for the mouse so it couldn't move too far outside the path, or possibly just not allow the mouse to progress around the path/grid area without physically being inside the path. I have some idea what I want to do for this, but I wasn't going to tackle this until I first solved the above problem. 

 

The end product would look something similar to the one below if that helps. Graph 2

 

If anyone had suggestions or resources to use to help this, I would appreciate it greatly. 

Thanks!

0 Kudos
Message 1 of 3
(2,846 Views)

You can represent your arena by a 2D array containing integers (same size as image), each value representing a different state (open, wall, etc.). Detecting the flavor of the mouse location would simply involve a lookup of the indices obtained from the (mapped) mouse coordinates using "index array". If you make all legal values non-zero, all outside locations would return zero (the default), allowing you to detect outside positions.

 

 

Are you using a picture indicator or an intensity graph?

 

Also please explain what you mean by "mouse". A virtual mouse that follows the cursor or the cursor itself?

0 Kudos
Message 2 of 3
(2,830 Views)

I'm currently just using an XY graph since it's just a stand in for the real path at the moment, but I'm seeing that the Intensity graph would work best for this. I just recently started researching the picture indicator because I haven't used this tool before, so would it be easier to use one or the other or should I just stick with the graph? 

 

Also, I was just using the actual cursor itself and mapping it's index like you said. I didn't know I could make a virtual mouse, still relatively new to Labview.

 

But I think that's exactly what I wanted to do. I'll start playing around with it and see what I can make! Thanks for the suggestions

0 Kudos
Message 3 of 3
(2,822 Views)