Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   kevin watsons scripting . . . (http://www.chiefdelphi.com/forums/showthread.php?t=34815)

Moloch 17-02-2005 10:28

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

Re: kevin watsons scripting . . .
 
All you need to do is put robot_control(); in user_routines_fast.c



Code:

  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! */
    }
  }
}



Quote:

Originally Posted by Moloch
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

Re: kevin watsons scripting . . .
 
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.


All times are GMT -5. The time now is 00:00.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi