LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stuck in joystick while loop

Hello All,

 

Disclaimer: No proprietary information is indicated in the screenshots.

 

Here is a screen shot of the current logic ("JoystickLogic.jpg") which is embedded in a legacy (inherited) Pedestal while loop which does not have Wait ms function. The legacy Pedestal Loop has a case statement which handles different modes of moving the pedestal (point out, slewing, and now joystick) and also gets status (AZ/EL) from the pedestal. This joystick logic is very similar to LabVIEW's joystick example except for my Rate X,Y subvi which just scales the input to values which are in the acceptable ranges of the PED subvi. The problem with this logic, as stated, is that the data flow produced by the user's deflection of the joystick seems to prevent the joystick's 100 ms loop from exiting and allowing the outer loop to process pedestal status. With the actual hardware, this logic moves the pedestal just fine, but I am not updating the status (AZ/EL) processed in the outer loop.

 

The new logic ("NewJoystickLogic.jpg") uses the suggested producer/consumer architecture and works fine stand-alone. I now need to somehow integrate it into the outer loop.

Download All
0 Kudos
Message 11 of 12
(584 Views)

A few small suggestions on NewJoyStickLogic.

  1. Get rid of the Frame ("Initialization").  You don't need it (the Error lines serialize everything for you), and it just adds clutter.  I'm VERY glad to see that the Stacked Frames are gone -- my least-favorite Structure in LabVIEW (as they are clumsy to use and obscure, rather than hide, details).
  2. In the Producer loop, bring the Queue all the way across and tunnel it out to the Release Queue function (rather than send a branch up-and-over the loop).  It emphasizes the flow better, especially emphasizing that the Queue is Released when the Producer loop exits.
  3. In your Consumer loop, you can do away with the Stop Local Variable and the Boolean Or.  Just wire the Error line itself (no need to pull out the Status component) to the Stop indicator.  When the Producer Loop exits, the Queue is released, which will cause the Dequeue Element in the Consumer loop to throw an error which you will trap, exiting the Consumer loop.

With this simpler, more compact, code, you should be able to integrate it with the rest of your project.

 

BS

0 Kudos
Message 12 of 12
(569 Views)