|
Re: What are we supposed to do!?!?!?!??!?!
Remember that this program actually runs in a HUGE loop. In other words, the program runs through lots of times per second. Program will check the status of the Operator Interface and will adjust the values of the PWMs accordingly. This is how the robot is able to have variable speeds.
As for the PWMs, looks in user_routines.c and look around for the "pwm=xx;" where xx is a number or perhaps another variable like the value of the joysticks.
The default code provided by FIRST controls the Kitbot rather nicely. If hooked up correctly, the Kitbot can move with either 1 joystick or 2.
-----------------------------
The following explaination is based off of the code we used 2 years ago. I'm sorry if I get some things wrong and if I do, please correct me. It has been 2 years since I was a programmer.
void User_Initialization (void)
this is where you initialize the ports on the RC. In other words, you are setting those pins on the Robot Controller to do something, like be an output(gives out power) or input(receives a signal for a sensor).
void Default_Routine(void)
this is where the controls are at. Remember how I said that the program runs in a HUGE loop? Well this is part of that loop. This function looks at all the values of the Operator Interface (like the joystick values) and through some "if" and "else" statements, it can control the motor's speed.
---------------------------------------
Like Qbranch said, easyC is a good introduction to C programming. I think it is setup so there is an "operator control" section and "autonomous" section so it well orgranized.
|