Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   help with turret code (http://www.chiefdelphi.com/forums/showthread.php?t=74637)

windell747 16-02-2009 02:42

help with turret code
 
right now im attempting to write some code for our turret to scan back and forth across the field between two limit switched until a large enough target is seen. I just had one failed attempted in which I created a state machine using some boolean operators to modify the direction of the motor based on which of the two limit switches was hit and which direction the motor was last commanded to go. The motor flickered back and forth. I think it had something to do with passing the last motor command to a shift register for evaluation the next cylce.

I'm wondering if anyone has any suggestions that are simple that I can use? Only got a day left and really want to get our turret working for testing tomorrow. I'm sure that this has been done before.

One suggestion was to just stop the motor however I want the turret to "scan" back and forth across the field.

Suggestions much appreciated! Mahalo!

Uberbots 16-02-2009 03:07

Re: help with turret code
 
your state machine approach is correct, though i dont exactly know what you hope to accomplish with the shift registers... youd hope that part of the code would be in the "main loop".

id just store the state in a local variable. The only reason i can think of for the states "flickering" back and forth is you have inverse logic on the switches; your transition condition is satisfied immediately (true on release, false on press). its kinda hard to diagnose exactly without a vi and how its called.

windell747 16-02-2009 15:36

Re: help with turret code
 
okay got more and my batteries are recharged. This might be a dumb question, but how do you create a local variable exactly for storing the state variable? I redid the state diagram and realized that the state table is much simpler than I had thought.

Alan Anderson 16-02-2009 16:01

Re: help with turret code
 
Quote:

Originally Posted by windell747 (Post 822237)
how do you create a local variable exactly for storing the state variable?

I'd use a shift register for this. Maybe a feedback node, depending on how simple the state machine logic is.

windell747 19-02-2009 07:25

Re: help with turret code
 
Thanks Alan! I was able to get the code to work as you say using a shift register.


All times are GMT -5. The time now is 10:37.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi