Please Help: Programming the Robovation Kit

:o Hi.
I’m starting a rookie team (#1529) in Indianapolis, and we’ve received the little robot kit. The electronics / mechanical doesn’t “scare” me, but the programming is pretty confusing to me at this point. I’ve downloaded files from www.innovationfirst.com/info, loaded the CD stuff and installed the software … If anyone could give me very very simplified cookbook step by step instructions as to how to connect and specifically what to type to make the robot say go forward / backward / left / right, that would be a tremendous help. Thanking you in advance, The Murf

Read the white paper Programming Quickstart. It will have lots of good basic information.Do some of the tutorials mentioned. They will probably help you.

Specifially, what to type… You should be able to control your robot form an RC controller with the default code. Please be more specific… Do you need help in loading the default code?

Hey, I just started myself the other day.
If you look on your processor, theres like 10 PWM Outputs, thats where you plug your motors into.
To drive your bot, it’d be something like this (Default Routine function in user_routines.c)


void Default_Routine(void)
{
  
   pwm01 = 255; // Motor on PWM Output 1 go forward full thrust
   pwm02 = 0; // Motor on PWM Output 2 go reverse full thrust
   pwm03 = 127 // Motor on Pwm Output 3 neutral

}

To make your coding a little easier to read, in user_routines.h you can use #define like so


/* Used in limit switch routines in user_routines.c */
#define OPEN        1     /* Limit switch is open (input is floating high). */
#define CLOSED      0     /* Limit switch is closed (input connected to ground). */

// I edited from here
#define LeftMotor	pwm01
#define RightMotor	pwm02
#define FrontMotor	pwm03
// to here

and then your code in user_routines.c would be


void Default_Routine(void)
{
  
   RightMotor = 255; // Motor on PWM Output 1 go forward full thrust
   LeftMotor = 0; // Motor on PWM Output 2 go reverse full thrust
   FrontMotor = 127 // Motor on Pwm Output 3 neutral

}

Hopefully I helped, :slight_smile:

hey i have a question. i am playing with the little bot in preparation for this up coming regional (if we get money :mad: ) and i want to know how to make the bot do things using time, like run this motor for x amount of time then switch and do this. could you help me out because our programmers who knew what they were doing left last year and me and the other programmer are doing this for the first time and the only backgroung i have w/programming is from my sam’s teach yourself C. i tried a few things but i had no luck. also how could i make an r\c controller to plug into the little box to control it remotely? any help w/this would be appreciated greatly. :smiley:

Looks like you want to set a counter

Declare a variable counter:
int counter;

if (counter<100)
{
pwm01=254;
pwm02=254;

counter++;
}
if (counter<200)
{
pwm01=180;
pwm02=180;
counter++
}

//EDIT: had wrong code earlier on, this one should work //

and continue on…

Another way it to use Timers. I would suggets looking at all the help documents included with the compiler and at innovationfirst.com . If you study those and test, you will get where you have to, it has almost anything you need. Yet, if you need help feel free to post

Regarding your second question, are you using a full size controller of robovation?

Make a counter, declare a static variable
static unsigned int intCycles = 0;
static unsigned int intSeconds = 0;

in Process_Data_From_Master_uP:


cycleCounter	=	cycleCounter + 1;
intSeconds	=	cycleCounter / 59;

Process_Data_From_Master_uP in user_routines.c is run every 17ms, so thats roughly 59 times a second. Then when you want to run something after x seconds you’d do


if(intSeconds > 5) // just an example
{
// do your code
}

The above suggestions will work but are not totally deterministic. If you add code (particularly debug printf statements) the timing can be affected.

I implemented the interrupt timer outlined in Timers_White_Paper and it works like a champ.

thank you to all of you, i will try all of your suggestions and see which one works best. I would look for that documentation but i think we might have lost it last year but i’ll check. Abyways this might help us with autonomous mode this year because last year we got it to follow the line (which was really hard and pretty good i think for a rookie team) and it didn’t quite work. And about my second question i was wondering if there were any what kind of r/c controller i could use on the little box to make it remote controled . Like would i have to customly wire like an r/c car control unit into it or use like the big controller from the big kit? :smiley:

Just like an RC car…

so what just wire the r/c outputs from the car to the r/c pwm in?

Connect as per the diagram on page 6 of this: EDU-RC-2004_Ref_Guide

Didn’t know that, as I said I just started myself 3 days ago =/

wel i would do what that guide said but we don’t have $150 - $200 for a hobby r/c controller, as it is we don’t even have money to register yet. but that other guide for timers worked with a few mods. thanks :smiley:

I haven’t had a chance to put together formal documentation, but there is a Windows applications and C code library that you can use to control the mini-RC from your PC. You can download a sample project and the windows program from http://members.cox.net/seanwitte. The project is for the newest version of MPLAB so you might need to create a new workspace and manually add the .c, .h, .lkr, and .lib files to it.

Sample screen shots are in this document.

The project is set up as a single-stick drive using PWM outputs 1 and 2. Joystick 1 in the PC interface is used as the drive input. If you download the hex file and connect to the RC from PCInterface you will need to check the Enable checkbox before it will run.

If you have an Analog Devices ADXRS150EB gyro connected to input 1 the sample program will integrate the signal and send the value back as analog feedback channel 1. In the program the value will be robot.heading, in the robot struct defined in robot.h. If you click the “Show Workspace” button you’ll see a model of the robot rotating in realtime as you move the gyro.

Feel free to send a PM if you need help.