|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
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.
|
|
#2
|
||||
|
||||
|
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. Last edited by Phalanx : 12-02-2014 at 12:09. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
|||||
|
|||||
|
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. Last edited by Mark McLeod : 12-02-2014 at 13:15. |
|
#6
|
||||
|
||||
|
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. Last edited by Phalanx : 12-02-2014 at 16:19. |
|
#7
|
||||
|
||||
|
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. |
|
#8
|
|||||
|
|||||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Congratulations on finding and fixing the problem.
In normal usage, an incorrect RefNum name should have given you an error message on the Driver Station. Did you do something with the error output on the RefNum Get function that would have caused the system to think you were checking and handling the error yourself? |
|
#9
|
||||
|
||||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
Quote:
I've got to do a better job teaching this stuff. This is for a team that had zero programmers at the start of build season. I'm not that dissatisfied with where they've gotten given the short time. |
|
#10
|
||||
|
||||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
If my understanding of the LabVIEW compiler/optimizer is correct, if you were to inline that VI, every instance of that VI would be copied down into the code and the controls would all be optimized out. The case structure would also be optimized out leaving the 'normal' method for accessing resources. This would give you the less CPU usage overhead compared to format into string or a subVI call, while supporting the normal methodology used by the WPI Library. |
|
#11
|
|||
|
|||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
I was asking just to see if there was a bug or something that could be improved for the future.
One such thing is to make the errors be on the front page instead of the second page. Other things can be done so that the errors or number of errors are more obvious. The other issue is that the current error routing is too slow and often causes watchdog issues. I believe that is fixed for next year along with a deploy issue that it can sometimes cause. As for the string dictionary that was demonstrated. That is a great way of preventing inconsistent spelling. I'm not sure if it is necessary or good for all teams, but if you have the skills to make the subVI and update the typedef enum, it is a great solution. The overhead of the subVI should be quite small. Making it a subroutine would shrink that by quite a bit. Making it be inlined will, as pointed out, should make it disappear entirely as the compiler substitutes the code, then propagates constants, then removes unreachable code. Greg McKaskle |
|
#12
|
||||
|
||||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
We are not really concerned with the efficiency of the string dictionary as these are only called once at the entry of Begin, Periodic Tasks, Finish and Disabled if they are motors.
The references returned are stored in the Shift Register for the duration of the execution. With our rule of only a single Get Reference allowed, it has not been a problem with speed, just planning. |
|
#13
|
|||||
|
|||||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
Quote:
Last edited by plnyyanks : 14-02-2014 at 19:05. |
|
#14
|
|||
|
|||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Once the code is inlined, the compiler will propagate constants, we call it constant-folding. The result of this is that the string is known at compile time and all other cases are eliminated for that instance because they are unreachable. The overhead when inlined, both in runtime size and execution is equivalent to wiring a constant.
Greg McKaskle |
|
#15
|
||||||
|
||||||
|
Re: 100% CPU Utilization Using 10ms Periodic Task
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|