OCCRA
Go to Post Want the TL;DR of it? Keep it simple, effective, and easy to use. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Events   CD-Media   CD-Spy   FRC-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 02-12-2010, 04:30 PM
killerofall killerofall is offline
Registered User
FRC #2611
 
Join Date: Jan 2010
Location: jackson MI
Posts: 4
killerofall is an unknown quantity at this point
Exclamation code not working

We tried each of these sections of code separately and they worked then, but when we combined them they did not work. I did copy over the refnums to the build.vi for this project. Any errors that you see? please help!
Attached Thumbnails
Click image for larger version

Name:	main code.GIF
Views:	43
Size:	73.2 KB
ID:	8642  Click image for larger version

Name:	other cases.GIF
Views:	33
Size:	7.7 KB
ID:	8643  
Reply With Quote
  #2   Spotlight this post!  
Unread 02-12-2010, 05:06 PM
Greg McKaskle Greg McKaskle is online now
Registered User
no team (Team NI)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 3,999
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: code not working

This appears to be the diagram of the teleop VI. If that is True, as the comment says, you want your code to respond to the telelop message and complete within 20ms. That will be difficult when the Button 1 on joystick 3 is False and the code sleeps for 2 seconds. I'm not sure what you are resetting after 2 seconds, but you can either build a small state machine, storing the timestamp when the button was pressed, then leaving the state after two seconds even thought code returns quickly each time.

You can also put the code to set and reset in a parallel loop such as Periodic tasks. In there, you can wake up every 20ms or so, and if a global is set, you set the relay and DIO, then wait 2 seconds in the parallel loop, reset the relay and DIO and the global. Meanwhile, the teleop will read the button and set the global only.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 02-16-2010, 03:01 PM
killerofall killerofall is offline
Registered User
FRC #2611
 
Join Date: Jan 2010
Location: jackson MI
Posts: 4
killerofall is an unknown quantity at this point
Re: code not working

so, essentially if i just move the case structure with the delay out of the main case structure and just put it on its own, it should work? or do i have to reduce the delay down to just 20ms and have it repeat a bunch of times?
in any case, thanks
Reply With Quote
  #4   Spotlight this post!  
Unread 02-17-2010, 06:12 AM
Greg McKaskle Greg McKaskle is online now
Registered User
no team (Team NI)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 3,999
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: code not working

You do not want a 2 second delay in the teleOp code.

Either break it up into a larger number of 20ms teleop packets and use a state machine to keep track, or move it out and run it in parallel. The thing you'd do in the teleop is to quickly modify a global informing the other loop what state you want the motor to be in. By the way, don't just move it outside the teleop loop, but completely outside the teleop VI.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 02-17-2010, 03:12 PM
killerofall killerofall is offline
Registered User
FRC #2611
 
Join Date: Jan 2010
Location: jackson MI
Posts: 4
killerofall is an unknown quantity at this point
Re: code not working

ok... so I just put it in main if i dont want to change how it works? if so, how does that work?
Reply With Quote
  #6   Spotlight this post!  
Unread 02-18-2010, 06:19 AM
Greg McKaskle Greg McKaskle is online now
Registered User
no team (Team NI)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 3,999
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: code not working

You could put it in Robot Main in a parallel loop, but the framework has a VI called Periodic Tasks which is pretty much what this is. So you could try to put it there and keep things organized by function.

Greg McKaskle
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
Solenoid code not working ssmith2 NI LabVIEW 6 02-03-2010 10:11 AM
C++ Sample Code not working... hm29168 CAN 5 01-27-2010 08:59 PM
Working with code in OSX Loki1989 Programming 11 02-18-2008 01:12 PM
Can't use pointers nor refrences. cibressus53 Programming 9 11-05-2004 03:44 PM
Working Pump Code Dan 550 Technical Discussion 1 02-02-2002 11:30 AM


All times are GMT -5. The time now is 07:03 AM.

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


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