Quote:
|
Originally Posted by Pattyta
hi there,,,
does any one knows how to convert the cycles of the autonomous mode 26.2ms to like actual seconds to keep a counter in seconds???
Thnx
Rockie team
help plz competition in 2 days 
|
Time can be measured in seconds, or minutes, or hours, or microseconds. Why do you need to work in units of seconds? That conversion requires floating point arithmetic, and that means a lot of CPU time is used up. But how about using a new unit for time? Call it "ticks". The conversion factor for seconds to ticks is
ticks = seconds * (10e6 / 2e18 );
The autonomous period lasts 572 ticks. The entire match is 4578 ticks.
You can keep track of ticks using integers and integer math, and avoid all that floating point stuff that takes up memory and CPU time.
BTW, I programmed my auton to take a swipe at the trigger ball starting at 534 ticks (38 ticks before the end of auton). It knocked off the ball, but the blue balls were not released. They claimed it was too late. It was our last match and the first time everything came together for IR tracking (i.e. we didn't get rammed) Hmmm.... At nationals I'm gonna back that down to 80 ticks before the end of auton.
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the
USPTO.
My favorite error message from gcc:
main is usually a function
My favorite error message from Windows:
There is not enough disk space available to delete this file.