Go to Post Don't bring a distraction to the field. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-02-2009, 02:42
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
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!
Reply With Quote
  #2   Spotlight this post!  
Unread 16-02-2009, 03:07
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
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.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2009, 15:36
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-02-2009, 16:01
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: help with turret code

Quote:
Originally Posted by windell747 View Post
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 19-02-2009, 07:25
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
Re: help with turret code

Thanks Alan! I was able to get the code to work as you say using a shift register.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP WITH CODE!!! :( nick_champ_2 Technical Discussion 6 16-01-2009 01:57
Help with VB code Setsanto Programming 8 08-02-2007 16:04
Help with code b-rant Programming 1 05-04-2006 13:52
Need help with code CaseyKasem_1251 Programming 3 18-02-2006 09:39
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 21:46


All times are GMT -5. The time now is 08:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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