View Single Post
  #7   Spotlight this post!  
Unread 14-02-2003, 02:57
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
Quote:
Originally posted by Lord Nerdlinger
i thought the controller looped the code once every 26 milliseconds? so you would make a little counting function in the main loop, and assume that for each additional value of the counter the program has run for another 26 milliseconds?
Count loops if you like, but there is no guarantee that it will work - if there is a problem, you may skip a loop or two, and thro timing way off.

It is recommended that the count-up-delta_t method, or the change in packet_num be used, as they don't skip. Every 26 ms, the Operator Interface sends a new packet of instructions, and each packet has a serial number, the packet_num. The Robot Controiler stores the packet_number for its own purposes, and reports it to you via the serin statement in your prohram if you select it.

The RC also calculates the differrence between the current packet_num and the last one it stored, and will similarly pass this info on to your program.

If your program starts to take too long in the loop when you add the last code, delta_t may rise to 2 even 3 (packets / time periods have been missed. Don't $@#$@#$@# U ME it makes an $@#$@#$@# out of you & me