Go to Post Could you explain this concept of a break from FIRST? Did my wife put you up to this? - Gary Dillard [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 30-01-2012, 20:40
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
How often is code run in teleop?

Hello -

I'm looking to migrate some of my code which I have written into Teleop.vi (mainly moving motors and servo's with buttons) into Periodic Tasks.vi, mainly to cut down on the Watchdog errors we get periodically.

However, I know that I must put the code within a while loop and tell it how long to wait till the loop executes again.

If I'm getting the value of a joystick button, and if someone is holding the button then we are changing a case structure to true which moves a servo +1 degree, how much wait between each iteration of the code will result in the fluid motion we see within Teleop.vi?

Thanks.

EDIT - Also, is the Select function more efficient than a Case Structure?
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2012, 20:48
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,034
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: How often is code run in teleop?

Quote:
Originally Posted by DominickC View Post
Re: How often is code run in teleop?
Roughly 20ms.

Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2012, 20:59
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,748
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: How often is code run in teleop?

Ether is correct. But I posted a notice to the CPU usage thread pointing out that the loops have no delays and are probably running hundreds of times in the 500ms and are maxing out the CPU.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 30-01-2012, 21:22
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: How often is code run in teleop?

Awesome, thanks.

Now, how can I set code to write a value, sleep/wait for x ms, then write another value?
Reply With Quote
  #5   Spotlight this post!  
Unread 30-01-2012, 21:24
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,034
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: How often is code run in teleop?

Quote:
Originally Posted by DominickC View Post
Awesome, thanks.

Now, how can I set code to write a value, sleep/wait for x ms, then write another value?
Use a state machine or a parallel loop (thread).

Explained here:

http://www.chiefdelphi.com/forums/sh...96&postcount=3

... and here:

http://www.chiefdelphi.com/forums/sh...21&postcount=6

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


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

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