Log in

View Full Version : Inserting Naviagation code into Default code?


actorindp
28-01-2004, 13:48
Hey everyone... please bare with me.

I was approached (ambushed) by my robotics team to see if i could program this year.

I have no idea what i'm doing, to be frank. Yet I'm catching on quickly, and I have a quick question.

I have the default code on my bot. I have the navigation code.
How do I merge the two together, so i have my default code and once I switch to autonomous mode, It starts running that navigation code?

Thanks..

Please help the n00b

Nick, a lost soul who was kidnapped by his robotics team in hopes of a success.

jskene
28-01-2004, 17:07
There is an excellent Powerpoint presentation on many aspects of programming the new controllers at:
http://www.usfirst.org/robotics/C_help.htm

It includes a section describing where you insert autonomous code. You should be able to simply copy the code you have and insert it into the autonomous section of user_routines_fast.c.

deltacoder1020
28-01-2004, 18:07
If you have the "navigate" package for the IR sensors, you're almost good to go - both this code and the default code are based off the same template. Essentially what you'll need to do is take all of the manual control code from the default code (all of which is in user_routines.c), and merge it into the navigate code. Also, you'll have to change user_routines_fast.c in the navigate code so that it will only navigate when the robot is in autonomous mode. Functions to look at are as follows:

user_routines.c
void User_Initialization() - make sure everything is set up like it needs to be (assigning IO pins, et cetera)
void Process_Data_From_Master_uP() - add stuff from default to navigate
void Default_Routine() - this entire function needs to be copied from default to navigate

user_routines_fast.c
void Process_Data_From_Local_IO() - move the call to Navigate() into the while loop and if statement in User_Autonomous_Code()
void User_Autonomous_Code() - any other autonomous mode stuff can go here, along with the call to Navigate()

that should be just about it, if i've forgotten or not noticed anything, feel free to tell me.

actorindp
28-01-2004, 18:12
Thanks a lot!!!