Go to Post When fun is outlawed, only outlaws will have fun. - Gadget470 [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 14-02-2012, 23:20
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
Timed While loop within Teleop

Hello -

I'm looking to drive a Drive motor for 1/8th of a second with the press of a Joystick button. So, here's what I've come up with.

Basically, checking to see if the button is pressed. If not, pass on the set values assigned by the joystick axis. If it's pressed, substitute the value of -0.8 for 125 iterations, amounting to 1/8th of a second.

Since the Drive Motors will be assigned a value during this time, will I see any watchdog errors?

Thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 14-02-2012, 23:32
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: Timed While loop within Teleop

Quote:
Originally Posted by DominickC View Post
...125 iterations, amounting to 1/8th of a second...
So these iterations are happening at 1000Hz??

Reply With Quote
  #3   Spotlight this post!  
Unread 14-02-2012, 23:36
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: Timed While loop within Teleop

It's just a conceptual value to see if I'm understanding the issue/solution at hand. I know that Teleop runs at 20ms, so I'd also be able to do around 6 iterations at a 20ms delay, however I don't know how Watchdog would respond.

I assume I would start at 1, and keep increasing the delay till Watchdog got unhappy.
Reply With Quote
  #4   Spotlight this post!  
Unread 14-02-2012, 23:37
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Timed While loop within Teleop

Use a state machine instead.

The Safety vi defaults to .1sec, so delaying for .125sec will trigger it.
If you feed the Drive motors the same value (-0.8) at a faster rate than .1 sec, then it won't trip.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 14-02-2012 at 23:40.
Reply With Quote
  #5   Spotlight this post!  
Unread 14-02-2012, 23:43
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is online now
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,709
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Timed While loop within Teleop

You might trip the watchdog. You'll certainly mess with your drivers, since everything will pause for 1/8 of a second.

Teleop.vi happens pretty regularly. You really can use it as your timing loop. Have some value that passes between each run of Teleop.vi. (Use a feedback node for this.) If the value =0, do nothing and pass your joystick value through. If the value >0, subtract one from it and substitute 0.8 for your joystick value. To trigger it, set the value = 125 (or whatever's appropriate. I forget the timing of Teleop.vi) if the button is triggered.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #6   Spotlight this post!  
Unread 14-02-2012, 23:47
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: Timed While loop within Teleop

Quote:
Originally Posted by Kevin Sevcik View Post
You'll certainly mess with your drivers, since everything will pause for 1/8 of a second.
That's actually a desired outcome, believe it or not.

As for State Machines, I've always had trouble comprehending those and still have this issue..
Reply With Quote
  #7   Spotlight this post!  
Unread 14-02-2012, 23:55
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: Timed While loop within Teleop

Quote:
Originally Posted by DominickC View Post
As for State Machines, I've always had trouble comprehending those and still have this issue..
You actually already understand the basic concept, judging from your original post. You just used the wrong numbers.

Since TeleOp runs at ~20ms, just override the joysticks (with the -0.8 command) for 6 iterations (6*20ms = 120ms = approx 1/8 second).

Your motor will be happy because it is being commanded more often than 100ms, so neither the safety nor the watchdog will trip.

Reply With Quote
  #8   Spotlight this post!  
Unread 14-02-2012, 23:58
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: Timed While loop within Teleop

Ah, I see! ~~ 6 iterations it is. Thanks!
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 22:13.

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