Go to Post I would love access to the crystal ball granting you the insight into these changes. - sdcantrell56 [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 03-03-2010, 10:26
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,372
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Programming Autonomous pneumatic kicker

Quote:
Originally Posted by tanguma26 View Post
Can you explain me more about what you said about a single state machine i dont understand

or if you have any more advise i would apresiated.


thank you
Let's start with what a State Machine is. It is a series of steps, or states, that a machine or software runs through to perform a task.

Let's use the kicker as an example.

State 1: Precharge Kicker
State 2: Wait for "Fire" signal. Release kicker.
State 3: Wait .5 sec. for kick to complete.
State 4: Retract kicking mechanism.
State 5: Wait for retraction to complete.
State 6: Latch mechanism. Return to state 1.

The best advice I can give at this point is to visit http://www.lvmastery.com/tipjar

It will teach you all you need to know to start building state machines.
(This is not a paid advertisement for LVMastery.com)

I'm attaching an example vi. You will also need to create the DevRefNum's in the begin.vi.
Attached Files
File Type: vi Kicker State Machine.vi (17.5 KB, 35 views)
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist

Last edited by billbo911 : 03-03-2010 at 11:46. Reason: Added Kicker State Machine.vi
Reply With Quote
  #2   Spotlight this post!  
Unread 06-03-2010, 19:36
archwaykitten archwaykitten is offline
Registered User
AKA: John McBryan
FRC #1212 (Sentinels)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Arizona
Posts: 10
archwaykitten is an unknown quantity at this point
Re: Programming Autonomous pneumatic kicker

I am trying to make a very similar state machine kicker myself.

My problem is this: Say you tell your program to "wait" in a particular state for two seconds while a piston extends... I would expect the rest of your program to "freeze" for two seconds while that state machine code waits to execute. We want to be able to continue driving around and entering comands while our ball kicker state machine does its thing.
Reply With Quote
  #3   Spotlight this post!  
Unread 06-03-2010, 20:52
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,372
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Programming Autonomous pneumatic kicker

Quote:
Originally Posted by archwaykitten View Post
I am trying to make a very similar state machine kicker myself.

My problem is this: Say you tell your program to "wait" in a particular state for two seconds while a piston extends... I would expect the rest of your program to "freeze" for two seconds while that state machine code waits to execute. We want to be able to continue driving around and entering comands while our ball kicker state machine does its thing.
The key is to have the vi run parallel to all other process. This way the other process, ie teleop.vi, do not have to wait for the kicker to cycle. We did this by placing the kicker state mchine in the main.vi. (See the attached picture) It requires no input from any other processes to complete, therefore it runs immediately. It also doesn't output any information that other vis need.
Attached Thumbnails
Click image for larger version

Name:	main w kicker.jpg
Views:	66
Size:	34.9 KB
ID:	8838  
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist

Last edited by billbo911 : 06-03-2010 at 21:48.
Reply With Quote
  #4   Spotlight this post!  
Unread 07-03-2010, 20:56
I am error's Avatar
I am error I am error is offline
The Error
FRC #0686 (Bovine Intervention)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Frederick
Posts: 20
I am error is an unknown quantity at this point
Re: Programming Autonomous pneumatic kicker

Hi,
I tried you example, changed everything around and put it in the main vi, but it did not function properly and i could not drive my motors in teleop. I'm trying to make so that when a button a latch is released by a piston retracting to fire a kicker from the default, then two pistons extend to reach the kicker and the latch piston extends to grab the kicker. Then the two pistons retract to rearm the device and the cycle repeats. I tried to implement that to your example but with no luck and also while running I could not drive the motors on the robot. Thanks for any help.
__________________
I am Error. Yes.

Reply With Quote
  #5   Spotlight this post!  
Unread 07-03-2010, 21:40
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Programming Autonomous pneumatic kicker

You can of course do what you want with your code, but the framework gave you places to put code so that you wouldn't need to modify Robot Main.

Any code that you put into TeleOp or the Robot Main loop needs to finish within 20ms or it will start to affect the joystick code handling. This can be done provided you write the code to retain when something started and do time comparisons to determine when to move to the next kicker stage, note that time, etc.

OR

You can write the code with delays, but put that code into a parallel loop such as Periodic. Then in teleOp, you read the joystick and other stuff and if the conditions are right, you trigger a kick by setting a global. In periodic, you poll the global and start the sequence. At the end of the sequence, you clear the global.

Greg McKaskle
Reply With Quote
  #6   Spotlight this post!  
Unread 07-03-2010, 21:31
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Programming Autonomous pneumatic kicker

Quote:
Originally Posted by archwaykitten View Post
I am trying to make a very similar state machine kicker myself.

My problem is this: Say you tell your program to "wait" in a particular state for two seconds while a piston extends... I would expect the rest of your program to "freeze" for two seconds while that state machine code waits to execute. We want to be able to continue driving around and entering comands while our ball kicker state machine does its thing.
The "wait" in a state machine is NOT code that causes the processor to loop there until a desired amount of time has passed. Rather, it is code that tests whether the desired amount of time has passed, and if not, allows execution to continue. On the next iteration, it tests again. It keeps testing every new iteration until the desired time has elapsed, at which point it performs some action and changes state so it is no longer waiting.

You can put such a state machine in teleop along with other state machines and they will all peacefully coexist - i.e. they will all appear to execute "simultaneously", since none of them contain any code that "freezes" the processor waiting for time to elapse.

~
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
Team 1522's pneumatic kicker kornjones Robot Showcase 0 15-02-2010 20:59
pic: Pneumatic Kicker Rev_0 preparing to fire professor1212 Extra Discussion 5 18-01-2010 00:31
pic: Pneumatic Kicker Rev_1 professor1212 Extra Discussion 6 17-01-2010 23:07
pic: Pneumatic Kicker Rev_0 professor1212 Extra Discussion 0 17-01-2010 01:15
pneumatic programming stephenthe1 Programming 5 16-02-2006 12:01


All times are GMT -5. The time now is 21:58.

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