Go to Post You really don't want to mess with an engineer. - ChrisH [more]
Home
Go Back   Chief Delphi > Technical > National Instruments LabVIEW and Data Acquisition
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 08-10-2008, 12:27
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
State machine in LabVIEW?

Hey,

So I have been wondering...

I want to help students write in LabVIEW next year, but I really don't know it all that well myself yet.

First off, last year I had, in C, a state machine for autonomous. It was an integer paired up with a giant switch/case; there were states for "moving forward", "turning left", "short segment moving forward", etc. It worked well. But it only worked well because there was a round robin method of execution--the arm control code got executed (feedback loops for the arm joints), the drivetrain control code got executed (feedback loops for the two crab drive mechanisms), and any other support code got called, once a loop. Now that we have LabVIEW, how do I implement a similar setup?

I have seen a Case statement for LabVIEW, but does that exclude any other code that might need to be executing? I need my feedback loops in one spot, executing all the time. How are auton and teleop separated in LabVIEW?

I am trying to write up something that will at least take user controls as input (instead of encoders and sensors) and output to "motors"--indicators.

Is there a better method to learn LabVIEW?

Thanks for your help...now that I am back to being a n00b...

JBot

EDIT: For that matter, how do I regulate a feedback loop to run exactly every X milliseconds?
__________________
Aren't signatures a bit outdated?

Last edited by JBotAlan : 08-10-2008 at 12:32.
Reply With Quote
  #2   Spotlight this post!  
Unread 08-10-2008, 13:06
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,574
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: State machine in LabVIEW?

Quote:
Originally Posted by JBotAlan View Post
First off, last year I had, in C, a state machine for autonomous. It was an integer paired up with a giant switch/case; there were states for "moving forward", "turning left", "short segment moving forward", etc. It worked well. But it only worked well because there was a round robin method of execution--the arm control code got executed (feedback loops for the arm joints), the drivetrain control code got executed (feedback loops for the two crab drive mechanisms), and any other support code got called, once a loop. Now that we have LabVIEW, how do I implement a similar setup?

I have seen a Case statement for LabVIEW, but does that exclude any other code that might need to be executing? I need my feedback loops in one spot, executing all the time.
Labview is inherently parallel. If you want your feedback loops to run all the time, put them outside the case statement. If it depends on something from inside the case statement, run a wire from inside the case statement to your feedback loops outside.

Quote:
Originally Posted by JBotAlan View Post
How are auton and teleop separated in LabVIEW?
See the code team 39 posted for an example: http://forums.usfirst.org/showthread...8186#post18186

Quote:
Originally Posted by JBotAlan View Post
EDIT: For that matter, how do I regulate a feedback loop to run exactly every X milliseconds?
See this thread on the FIRST forums: http://forums.usfirst.org/showthread.php?t=9906
Reply With Quote
  #3   Spotlight this post!  
Unread 23-10-2008, 00:47
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: State machine in LabVIEW?

Quote:
Originally Posted by JBotAlan View Post
Hey,
EDIT: For that matter, how do I regulate a feedback loop to run exactly every X milliseconds?
Be warned... When you say exactly, be sure that's what you need. If you use a timed loop to do everything, you will have lots of problems. It's not like there is a turbo button on the controller and making everything on the controller high priority will keep the CPU from being lazy. Consider the timed loop to be a timer interrupt service routine. Only put the things in it that NEED to be exact... and it had better be a small amount of code.

For the general case, a simple "Wait Until Next ms Multiple" VI will do the trick. It takes into account the time that the code in the loop takes to execute and should give you a consistent loop rate.

-Joe
Reply With Quote
  #4   Spotlight this post!  
Unread 23-10-2008, 07:59
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: State machine in LabVIEW?

Thanks for the advice.

Quote:
Originally Posted by Joe Hershberger View Post
Be warned... When you say exactly, be sure that's what you need.
I am beginning to understand how LabView works. It seems like there would be a way to configure the cRio to sample every x milliseconds, and that time-critical part of the code would be isolated from my user code. If that's the case, there's not much use in using a timed loop; if I write it correctly, the data flow of each sample coming in should do that.

I wish things weren't so fuzzy. Working on a beta team would have been so exciting!

JBot
__________________
Aren't signatures a bit outdated?
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
Hawaii Gov. Lingle State of State speech-FIRST and STEM MoeMom FIRST In the News... 0 29-01-2008 17:04
What to machine? sanddrag Technical Discussion 8 14-06-2004 11:22
EDU Demo Code: Serial Data Transmitter Using a State-Machine Kevin Watson Programming 3 28-12-2003 22:56
machine shop?? trollin1st Off-Season Events 0 12-02-2003 21:02
Choosing a machine shop (Re: How important is a machine shop archiver 2001 9 24-06-2002 04:20


All times are GMT -5. The time now is 14:25.

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