View Full Version : kevin watsons scripting . . .
I have kevins nav code, and I have my drive commands entered and those work just great. Now I just need some help with the autonomous scripting. I know that its supposed to be easy, and from what I have read, it seems as though it is very easy. But after looking through the code, and reading tons of things on scripting and coding, I still need some help. I need someone to give me some code that will get my scripting commands in the command.h file to start running in auton. I dont know how to start the auton to test it. I dont really know antything about auton at all. PLEASE help me get started on this! Time is running out, I only have 5 days left!
Chris_Elston
18-02-2005, 00:49
All you need to do is put robot_control(); in user_routines_fast.c
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
/* Add your own autonomous code here. */
robot_control(); //call automous mode
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}
I have kevins nav code, and I have my drive commands entered and those work just great. Now I just need some help with the autonomous scripting. I know that its supposed to be easy, and from what I have read, it seems as though it is very easy. But after looking through the code, and reading tons of things on scripting and coding, I still need some help. I need someone to give me some code that will get my scripting commands in the command.h file to start running in auton. I dont know how to start the auton to test it. I dont really know antything about auton at all. PLEASE help me get started on this! Time is running out, I only have 5 days left!
Fuzzypanda007
18-02-2005, 17:52
It actually isn't really hard at all. I have been able to make a small code, but it hasn't worked for my bot yet :/ . Anyway, to use it, go to the top and under the part that says something like "declare all variables here" put "static unsigned int t;" Then, in the area mentioned by Chakorules that says "add your own autonomous code here" put this:
t++;
if (t < 95) //turn left for 2.5 seconds
{
pwm01 = 95; //left motor goes in reverse
pwm02 = 150; //right motor goes forward
}
else if (t < 285) //go straight for 5 seconds
{
pwm01 = 150;
pwm02 = 150;
}
else if (t < 380) //turn right for 2.5 seconds
{
pwm01 = 150;
pwm02 = 95;
}
else //stop after 10 seconds
{
pwm01 = 127;
pwm02 = 127;
}
I( am not sure if this will work 100%, considering this is my first year as a freshman, but if you put this part of the code in a loop, is really should work. well, i hope this helped. see you at the competition.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.