Template Project

I’m making a Template Project. What do you want in it?

Here’s my list:

  • Kevin’s Interupts.c
  • TTL support (Flag to redirect Printf()s to TTL?)
  • Variables.c/.h
  • multiple autons
  • flags.h
#define __NO_PRINTF_
#define __EDU_RC_
#define __USE_TTL_
//etc...
  • sgn, abs, absdif (macros, math.h)
#define sgn(Number) ( (0 - ((Number) < 0)) || ((Number) > 0) )
#define abs(Number) ( ((Number) < 0) ? (0 - (Number)) : (Number) )
#define absdif(Num1,Num2) ( ((Num1) < (Num2)) ? ((Num2) - (Num1)) : ((Num1) - (Num2)) )
  • EDU & FRC (flag)
  • // C++ style Comments
  • main.c bug fixed
  • Botalias.h
  • Kevin’s EDU RC code?
  • DoData macro.
#define DoData ( (statusflag.NEW_SPI_DATA) ? (Getdata(&rxdata) | Putdata(&txdata)) : 0)

You might add some debug/test routines. E.g.,


Set_Debug_Level (HIGH); // or maybe Set_Debug_Level (5), etc.
...
debug (msg, threshold); // i.e., if debug level < threshold, print msg
eq (some_var, some_val, severity); // i.e., if some_var!=some_val do action based on severity
// etc., more tests/debug features

Just a thought … it’s nice sometimes to write code based on certain tests, and since you don’t always have the robot with you while coding, it can be helpful to print out errors where something unexpected occurrs, but then have it go silent when you are doing the competition … but still have it ready to go if you change something and need to make sure it all works. Wow, I’m going to stop rambling now.

No, no. that’s the point. And it’s better than mine, I think.

This would be kinda cool. Can I suggest that you look into adding a circular buffer too? For extra credit, how about making it interrupt driven?

-Kevin

“Gah!” -JVN

I’ll see what I can do…

Something to make tweaking variables easer would be really nice (you know, for those situations where you need to get the deadzone on the joystick just right or tweak the speed so the right motor goes a little slower).

Some teams created a command prompt, via a terminal program, to change constants and make other changes to the robot without uploading new code.

I don’t know what your talking about, but this is entirely within the standard MPLAB project. So add:

*]Interpret_Data()
for checking that sort of thing. The challenge is making it extremely flexible and general, yet doing that sort of thing easily, W/O BLOAT.

Thats a really good idea! How is it done? Do you know where I can take a look at the code?

Well by some teams, i only meant one specific example, but I’m sure there are more. Let me see if I have can get permission to post the relevant part of the code.