Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   how are we going to do this (http://www.chiefdelphi.com/forums/showthread.php?t=27033)

omega 22-03-2004 10:02

how are we going to do this
 
This is what we have for our automous code but we want to go from the Navigate(); to what is beneath it when both of the sensors see nothing becuase we don't want to risk loseing all of that time.



void User_Autonomous_Code(void)
{
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. */

Navigate();

if(rc_dig_in01 ==1 )
{
pwm13 = 137;
pwm14=100;
}
else
{
pwm13 = pwm14 = 140;
}
if(rc_dig_in02 == 1)
{
pwm13 = 100;
pwm14 = 137;
}
else
{
pwm13 = pwm14 = 140;
}

Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}

gnormhurst 22-03-2004 10:44

Re: how are we going to do this
 
Quote:

Originally Posted by omega
This is what we have for our automous code but we want to go from the Navigate(); to what is beneath it when both of the sensors see nothing becuase we don't want to risk loseing all of that time.

I think you said it yourself, just say it in C:

Code:

void User_Autonomous_Code(void)
{
  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. */
 
  Navigate(); 

  if ( NEITHER_SENSOR_SEES )
  {
  if(rc_dig_in01 ==1 )
    {
    pwm13 = 137;
    pwm14=100;
    }
    else
    {
    pwm13 = pwm14 = 140;
    }
  if(rc_dig_in02 == 1)
    {
    pwm13 = 100;
    pwm14 = 137;
    }
  else
    {
    pwm13 = pwm14 = 140;
    }
  }
  Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

        Putdata(&txdata);  /* DO NOT DELETE, or you will get no PWM outputs! */
    }
  }
}

However, it may be more appropriate to change Navigate() to keep going when blind. Are you using IR trackers?

Kevin Karan 22-03-2004 11:32

Re: how are we going to do this
 
You should move navigate() to before the spidata thing if you are using the old navigate routine


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

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