|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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)!
|
|
#2
|
|||||
|
|||||
|
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. |
|
#3
|
||||
|
||||
|
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.
|
|
#4
|
||||
|
||||
|
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)
|
|
#5
|
||||
|
||||
|
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?
|
|
#6
|
|||||
|
|||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|