Quote:
Originally Posted by nighterfighter
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.
|
That's not true
Code:
97 } else {
98 // call TeleopInit() if we are now just entering teleop mode from
99 // either a different mode or from power-on
100 if (!m_teleopInitialized) {
101 lw->SetEnabled(false);
102 TeleopInit();
103 m_teleopInitialized = true;
104 // reset the initialization flags for the other modes
105 m_disabledInitialized = false;
106 m_autonomousInitialized = false;
107 m_testInitialized = false;
108 Scheduler::GetInstance()->SetEnabled(true);
109 }
110 HALNetworkCommunicationObserveUserProgramTeleop();
111 TeleopPeriodic();
112 }
113 // wait for driver station data so the loop doesn't hog the CPU
114 m_ds.WaitForData();
115 }
116 }
TeleopPeriodic is called every time you get data from the driver station.
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.