Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   PID kills safety thread (http://www.chiefdelphi.com/forums/showthread.php?t=91743)

MAldridge 13-02-2011 18:42

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.

Mark McLeod 13-02-2011 19:12

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?

MAldridge 13-02-2011 22:08

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)!

Mark McLeod 13-02-2011 22:32

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.

MAldridge 13-02-2011 22:43

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.

baronep 14-02-2011 23:52

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)

MAldridge 15-02-2011 16:43

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?

Alan Anderson 16-02-2011 09:39

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.


All times are GMT -5. The time now is 09:15.

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