![]() |
CPU usage idles at 80% and hits 100% when running teleop code
Just recently we ran into an issue during competition that lead to our robot being disabled due to data pack loss issues. when going over the logs of the roborio we realized that basically since any code was loaded to the RIO the robot's CPU has been idling at 80%. when teh code is put into teleop mode we max out eh CPU at 100%. until just recently this appears to have not affected us, but today it appears the stars aligned ans cause our robot to fail during competition. We systematically went through our code removing things to try to figure out what was causing the issue. We basically have the code stripped down to the class calls of the attached devices and that is it and the CPU still idles at 80% with a non-existent teleop code at 100%. does anybody have any suggestion on what our problem might be. our code was never that complex to begin with so i see no reason as to why the code would peg the CPU during the teleop mode. here is a link to our robot code: http://pastebin.com/KVbgbMXF
list of trouble shooting we have tried 1. reflash the roborio -- with absloutly no code on the rio the cpu ran at a resonable CPU usage. as soon as code was loaded idle 80%, teleop 100% 2. strip down code to just class calls, variable ids, and empty voids. -- CPU idle 80%, teleop (with basically no code) 100% 3. load robot with last year code -- CPU idle 80%, teleop 100% (last year cod has significantly less in it... no camera, no CANTalon, no encoders for autonomous); |
Re: CPU usage idles at 80% and hits 100% when running teleop code
![]() But seriously, a few things I would try: Why is Scheduler being run at all?, especially in disabled? Do you have the latest roboRio image? SSH into the 'rio and run Code:
top |
Re: CPU usage idles at 80% and hits 100% when running teleop code
Try putting a Wait(0.05) at the end of your tele-op periodic.
Right now, your code just hammers through the teleop periodic. Having a tiny Wait() should bring your CPU usage down. |
Re: CPU usage idles at 80% and hits 100% when running teleop code
Quote:
Code:
97 } else {Try removing the CameraServer and seeing if that reduces your CPU usage. I'd suggest trying to comment out parts of your code and see what is causing the high usage. FYI, you are sleeping in TeleopPeroidic. This will cause none of the rest of your motors to update while you are sleeping. |
| All times are GMT -5. The time now is 10:58. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi