LSRobotics / 2016Robot

2016 FRC Robot Code
GNU General Public License v3.0
3 stars 10 forks source link

Delay in run() method in autonomous.java (Add delay timing method) #26

Closed thefangbear closed 8 years ago

thefangbear commented 8 years ago

So Connor and I figured out sth in run() caused the delay of code execution in autonomous. Tomorrow we must figure out a way to time the delay and define timeStep variable. The problem is 1) where it is happening 2) is the actual delay arithmetic ( which means a static value or a static value of increase will solve the problem or geometric (exponential? This well explains why the robot will be relative slow at first and relatively fast in the end. The problem is after we added an additional while() loop in run() it actually disappeared. Not to mention that 3) the Thread.sleep() actually shuts autonomous down for timeStep amount of time and actually hampers the robot from general execution. So Connor added a while loop using timeStep to execute the code timeStep times to solve the problem, and Thread.sleep() is set to one miliseconds. The problem is 1 is still too high however if we comment the entire Thread.sleep out it becomes too fast. Therefore a Delay timing method is needed.

thefangbear commented 8 years ago

Also after adding while loop robot started behaving mysterious under teleOperated. It will actually move without any control during teleoperated which I think will be the dilemma of multithreading; the thread of autonomous hasn't been actually stopped before teleoperated had started which results in autonomous still running, caused by the extra while loop

msbense commented 8 years ago

It will actually move without any control during teleoperated

I'm scared

thefangbear commented 8 years ago

It tried to kill you, it also tried to kill me to day. On Wed, Feb 3, 2016 at 21:57 Mark Bense notifications@github.com wrote:

It will actually move without any control during teleoperated

I'm scared

— Reply to this email directly or view it on GitHub https://github.com/team5181/2016Robot/issues/26#issuecomment-179591218.

Connor-Devitt commented 8 years ago

Recorder now works; see commit: https://github.com/team5181/2016Robot/commit/bbc713533384366dc2f3e9ff4c3b7abc40a78ab3