Go to Post People... chill. It is week 1. Recall week 1 last year when many teams said "no one is capping with the 2x ball"... "only a few teams are hanging". - Andy Baker [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 13-02-2011, 18:42
MAldridge's Avatar
MAldridge MAldridge is offline
Lead Programmer
AKA: Rube #1
FRC #0418 (LASA Robotics)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Austin
Posts: 117
MAldridge will become famous soon enoughMAldridge will become famous soon enough
Exclamation PID kills safety thread

I just got finished putting in PID VI's into a loop in the periodic tasks VI. I am feeding the PID with global variables so that PID can be used in autonomous as well as teleop.

When I enable, I get a string of error messages that tell me that my code isn't running fast enough and that the RobotDrive VI is not being updated enough! I need to use PID because the robot doesn't drive straight. I figured that the closed-loopedness of PID would alleviate these problems, not add to them!

Simplified: How do I make PID work so that the wheels are driven at the speeds they should be and make the safety thread happy as well.
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2011, 19:12
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: PID kills safety thread

It's most likely how you've structured your code, rather than the PID calculations.

The warnings are going to be based on how often you update your Arcade/Tank/Holo drive. PID shouldn't be slowing that down.

Where do you call Arcade/Tank/Holo drive and how often?
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2011, 22:08
MAldridge's Avatar
MAldridge MAldridge is offline
Lead Programmer
AKA: Rube #1
FRC #0418 (LASA Robotics)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Austin
Posts: 117
MAldridge will become famous soon enoughMAldridge will become famous soon enough
Re: PID kills safety thread

I am calling the tank drive VI from the periodic loops in the same loop as the PID code. It's being called as fast as the loop will run (I think the cRIO is 40mips)!
Reply With Quote
  #4   Spotlight this post!  
Unread 13-02-2011, 22:32
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: PID kills safety thread

You can measure your loop time with a utility vi that NI (Greg) included with the Framework.

From the project explorer window open up the Support Code folder and drag the Elapsed Times.vi into your Periodic Tasks loop.

Now if you Run from Robot Main you can open up the Elapsed Times front panel and watch the number of milliseconds each loop takes.
Anything greater than 100 ms is trouble.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #5   Spotlight this post!  
Unread 13-02-2011, 22:43
MAldridge's Avatar
MAldridge MAldridge is offline
Lead Programmer
AKA: Rube #1
FRC #0418 (LASA Robotics)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Austin
Posts: 117
MAldridge will become famous soon enoughMAldridge will become famous soon enough
Re: PID kills safety thread

I'll try that, I also get the 'not running fast enough' error when I attempt to engage my follow-a-line-on-demand code in the teleop loop. It basically works as a giant state machine and no, its not just a copy of the default code. This loop I know runs several hundred times a second though.
Reply With Quote
  #6   Spotlight this post!  
Unread 14-02-2011, 23:52
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: PID kills safety thread

Make sure that you aren't using any while loops in your code, these can delay the update of PWM outputs, therefore cause a watchdog error. (The Periodic loop itself doesn't count)
Reply With Quote
  #7   Spotlight this post!  
Unread 15-02-2011, 16:43
MAldridge's Avatar
MAldridge MAldridge is offline
Lead Programmer
AKA: Rube #1
FRC #0418 (LASA Robotics)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Austin
Posts: 117
MAldridge will become famous soon enoughMAldridge will become famous soon enough
Re: PID kills safety thread

If I can't use a while loop, what should I do to make my code repeat?! I need the PID updated every 25ms by my calculations for safe operation. Should I move the moterdrive VI out of the PID loop?
Reply With Quote
  #8   Spotlight this post!  
Unread 16-02-2011, 09:39
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: PID kills safety thread

Don't use loops in Teleop. It gets called repeatedly and rapidly by the project framework, and it needs to finish quickly in order to keep from holding up the communication processes.

Loops are perfectly reasonable, expected, and indeed necessary in the Periodic Tasks vi.
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 20:31.

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