LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

X,Y coordinates and stepper motor sequencing

Hello Labview Community,

 

I am back with my rookie questions. 

I have to develop a plate consisting of screws. Under the plate there will be in total 3 motors with the help of which i can loose or tight a screw . For the postioning of screwdriver, i am using linear actuators along x and y axis and they have a 0 point (refrence point at one end). I am using the motors and controllers from Nanotec alongwith their controllers. I can control all the motors with the help of USB cable using a VISA bridge. Till now i am able to control the motors and position them by giving the coordinates manually. Now i want to automate the process and that where it gets hard for me. The screw plate has 300 screws need to be positioned.

 

What i want: i want to take the coordinates x, y, z from an external excel sheet and and sequence the motors so that they can 1 by 1 loose or tight the screws as needed. X and Y motor take the coordinate from excel and move to first screw, then a pause of 100ms and then z motor use the coordinate and move the screw, when this is finished, x and y motors take the coordinate of  second screw and move to that position and so on till the complete 300 screws are in the required position. 

 

Just to keep things simple and in control i have started only with x and y motors. As written above i can give the cordinates manually but how to do that in automated matter. I dont find any good example. It would be nice if somebody could push me in the right direction. Lately i was reading about the flat sequence structures, maybe that would be one way but i am not so sure.

 

Hope to have some advices from the experts. Thanks in advance

0 Kudos
Message 1 of 3
(3,256 Views)

@acuteboy wrote:

I dont find any good example. It would be nice if somebody could push me in the right direction. Lately i was reading about the flat sequence structures, maybe that would be one way but i am not so sure.

 

Hope to have some advices from the experts. Thanks in advance


Dear Acute (you can call me Chronic),

 

     I wouldn't call myself an Expert, but I do have some important advice, even without looking at your code (don't worry, I'll look and come right back) -- do not use a flat sequence structure.  The purpose of this structure is to enforce Data Flow -- you have to do everything in the first sequence block before you can do anything in the second.

     A much better way to deal with sequence flow (I would call it "The LabVIEW Way") is to use wires, particularly the Error Line which runs through the bottom left and right connectors on the vast majority of the functions that NI provides, and that should be in every VI that you develop.  Almost the only time I use them is when I need to use a function, such as some of the Time functions (which lack Error Lines) and need to "sequence" them ("Start the clock when this function finishes") -- I put the Time function in a little Sequence box and tunnel the Error Line from the "Start timing after this" function through the Sequence.  This makes the Time function run "next".

 

Bob Schor

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

OK, I've now peeked at your VI.  First suggestion -- read the description you wrote about what it is you want to do.  Then start over, trying to develop (and think) in a Top-Down fashion how to accomplish your goal(s).

  • Open a new LabVIEW Project.  Anytime you need to develop code that is more than a trivial one-VI-with-five-or-six-functions example, you should be thinking of organizing it in a Project.
  • Create (perhaps before you create your Project) a Directory Structure for your Project.  I recommend a Top-Level folder (give it a better name than "My Project", with sub-folders "Type Defs", "Sub-VIs", "Test Code", and "Documentation".
  • Create virtual folders in your Project that match your physical folders.  The easiest way to do this is to simply "Add Folder".
  • Your Top-Level VI is your Control Tower.  Strive to keep it simple, and keep it relevant to the task.  Don't try to "monitor everything" or to "micro-manage everything".
  • Look at your Problem.  Can you divide it into Big Steps?  These Big Steps might suggest an organization of the Top Level, say, perhaps, a State Machine.
    • Open Excel spreadsheet (I assume you mean "Excel", i.e. an .xlsx file)
    • For each row, get a sub-Task.
    • Do the sub-Task.
      • Move to X, Y specified by Excel
      • Move Z axis as appropriate
      • Return (or not) to starting position
  • Do you see how there's a natural hierarchy to this particular Project?  Hierarchies in LabVIEW generally mean "Sub-VIs".
  • When writing a LabVIEW VI (including the Top Level VI !), keep the Block Diagram small, taking no more than a single Laptop screen (if you have huge monitors, strive for using a quarter of the monitor, or, better, get a smaller monitor).  One very easy way to do this is to encapsulate "details" in sub-VIs, which take only 32 x 32 pixels of screen space.
  • When writing sub-VIs, be sure to create an Icon (with the Icon Editor) for every one (do it before you save the sub-VI).  Even if it's a Black Square Outline with three short words ("Get Excel Data"), it will serve to "self-document" your code.
  • Try to find a LabVIEW Guru and apprentice yourself.

Bob Schor

Message 3 of 3
(3,238 Views)