Team THRUST - Kevin's Code and Camera Code Combine

Ok before you guys beat us up…please read the following:

thrust_1.0 version

Here is Kevin’s Navigation Script and the Default Camera Code from IFI in one program.

PS: Thank you Kevin for your responses and e-mail answers! Also thank you IFI for providing some default code to get started…

Before you get too excited, know this…

Just as the program sits now, it compiles to 30K of user memory. And we haven’t even begun to write any automous mode scripting.

Also, to even get it to compiled…we had to comment out sections of the code…

Basically look for this in user_routines.c
line 318 or so…in MPLAB IDE.




You’ll want to place robot_control(); function in drive.c
void auto_drive (void) section…

Also you’ll need to uncomment all the vision controls in drive.c
void auto_drive (void) section…

If you have enough space left, it might let you compile the code. Version 1.1 below will compile barely with enough space left. The changes we have described above are included in version 1.1. Basically start with version 1.1 below and you should be able to see the camera code and navigation code work independently of each other just as if you were downloading them separately.

thrust_1.1 version has all of the above ready to go.

We’ve tested this and each part works correctly, we’ve decided that we are not going to use both types of code because compiled as is, the program is 30K…good luck writting your automous mode with 2k left.

Kevin’s code complies to 20K and the camera code complies to 19K.
Together they are 30K.

Basically press the button PORT 1 to select a color, and you can still wait for the bump switch too from Kevin’s code. (If your not Camera code Enabled) We are using PWM 11 and PWM 12 with this code.

Anyway like we said, good luck if you plan on taking this approach. We pretty much have canned the idea after seeing the memory usage tonight so not much more time was spent on cleaning up this code to perfection. We hope there is enough code here for someone to pick it up and use it if you wish.

Team THRUST programmers can answer any questions you’d like to ask.
However you’ll have to come up with your own memory saving games.

Also when using the code, don’t forget to:

  1. TUNE your PID
  2. Set your encoder direction in encoder
  3. Set your drive motor direction in pid
  4. Set your wheelbase and encoder resolution
  5. Change your PWM values to your setting.
  6. Set your own color settings, (lighting varibles)

If you’re like us, you know what we are talking about if you’ve played with Kevin’s Navigation Script and the Camera code script independently.

We hope this helps someone…

Hey thanks for the work you guys put into that, I’ll probably directly try the code out tomorrow and see how well it is doing.
The Memory Problem sounds bad so. Is you .hex file 30 kb or the File that is really saved on your RC Controler, so is there maybe some more space than you guys think?

The way we checked it was by looking at the last hex decimal number in the .lst file after building the code. I know there are other ways…but i couldn’t remember them at the time.

This link may help: Reading how much memory is used.

There could be. I am not an expert PIC programmer nor an expert C programmer…(I am an expert PLC programmer), so there could be places that I don’t know that you could conserve memory.

I do know if you remove stdio and all the printf functions, this will save you another 4K of memory…but how in the world are you gonna debug your code without those tools…eh…?