View Single Post
  #4   Spotlight this post!  
Unread 13-01-2004, 13:11
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
Re: Questions on timers/simulator

Timers: I haven't done it yet, but there is information about how to use the timers (see prior post). I think it's the way to go, and we will probably create an autonomous mode environment that allows time driven elements by using one of the on-chip timers.

Simulation: look at the RoboEmu work that Rob Bayer did for the stamp RCs, and he is working on a version for the current RC. I don't know when it will be ready, but RoboEmu was extremely useful last year. There was a graphical input system for pushing the joystick and buttons, and graphical output showing drive levels on PWMs.

MPLAP SIM: I find it tedious and difficult to use. It knows nothing about RC i/o and the master/user processor setup, so getting inputs into it is a challenge (somebody who's figured it out please tell me I'm wrong). And I couldn't find any way to get it to display outputs other than it's variable watch feature. No printf display window or anthing like that. It's somewhat useful for testing/debugging functions in isolation, but not for simulating high level robot stimulus/response.

EDURC - perhaps the best way to test and debug code is to use a real RC. The EDURC is reasonably cheap, so your team could maybe afford to have a couple of them for programmer use. At least you can get a printf window that way, though no breakpoints or single step.

An alternative: we constructed an environment using another C IDE. In our case we used lcc but any good C IDE would work as well. The attraction to lcc is that it's free for non-commercial use and reasonably small and simple to install (compared to gcc). Comes from Univ of Virginia. The debugger is pretty good, breakpoints, single step, step into/over functions, watch variables, and so on. Anyway, we built a top level C program that reads an input file of a time sequence of joystick values and switch settings, runs the C code that will eventually be in the FRC, and writes the inputs and resulting outputs to another file. You can then read the output file to see if the behavior is as expected. Our environment is very specific to a prototype we built in the fall, so wouldn't directly meet the needs of any other robot. It is also incomplete - there are many things it does not simulate and we add to it almost daily to meet changing needs. But it could serve as a starting point if anybody's interested.

Bill