![]() |
100% CPU Utilization Using 10ms Periodic Task
Here's what I'm doing. In the 10ms loop in Periodic Tasks I have the following:
2 separate GET digital I/O VI's Each output I perform a Boolean NOT Each output is stored in a Boolean global variable. The RefnumGet VI's are outside the loop. When this code is added, my CRIO cpu spikes to 100%. When I remove this code my CRIO CPU is at 50%. I'm rather puzzled/stumped that this little bit of code causes that much pain. Any ideas? |
Re: 100% CPU Utilization Using 10ms Periodic Task
Check the diagnostics window on the Driver Station for any error messages. If you have a broken RefNum or something similar, the error processing has a significant effect on the CPU.
|
Re: 100% CPU Utilization Using 10ms Periodic Task
We observed similar symptoms. We tried a 10ms PID timed loop which read some I2C sensors and wrote to the PWM outputs and we measured periods of 11ms to 16ms. We have changed our scheduler to do 15ms since this appears to be the limit of either the cRIO or the scheduler. Do you really need 10ms?
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Alan,
I don't get any error messages other than RobotDrive isn't running fast enough when that code is enabled. Without that code enabled, I receive no error messages at all. Hence, my puzzlement. Quote:
In a worst case scenario I work something else out. |
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
What else are you considering for your worst case scenario? Keep in mind that all actuator controls must come directly from the cRIO - safety feature so that the field can shut it down. |
Re: 100% CPU Utilization Using 10ms Periodic Task
We've got a winch and pulley that pulls down our spring loaded launcher, and there's a limit switch to let us know when it's fully tensioned so we can turn off the motor and lock it in place.
The winch is really fast, it takes less than 1 second to reload. So I wanted something really fast to make sure we turn off the motor quickly to avoid breaking anything. In a worst case scenario, I can slow it down and monitor it all in Teleop. I just didn't want to do that. The global variables are later sent in Teleop to the dashboard via network tables as indicators of it's readiness, although we may move that code to the 100ms loop. |
Re: 100% CPU Utilization Using 10ms Periodic Task
I dropped what you described into a (almost) default project and didn't see the major jump in CPU utilization that you got.
Sounds like other code cross influences may be at work. If you want a second set of eyes on your code we can do that. |
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
Lots of calculations is a relative term, we are doing the heavy lifting (atan) in the teleop routine and as little as possible in the PID routine. If I were coding it, it could be even faster, but we try to stay within the capabilities of the students. 15ms should be fine for a drive train PID (WPI uses 50ms). Most of our sensors have programmable on chip filtering which we set to <50Hz bandwidth to minimize aliasing. |
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
Quote:
Quote:
Quote:
Thanks everyone for your input and advice. Time to delve deeper, cross "T's" dot "I's" and make sure there isn't something stupid, which there probably is. |
Re: 100% CPU Utilization Using 10ms Periodic Task
I found the problem. One of the GetRefNum's had an incorrect name. The name in Begin.VI was "Ball Collector Limit Switch" and in PeriodicTasks.VI it was "Ball Limit Switch". I corrected that issue and now CPU is back to normal levels.
So as I'm fond of saying.... "Programmers don't need to spell correctly, just consistently!!!" Thanks for your insights, help and input. |
| All times are GMT -5. The time now is 04:41. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi