View Single Post
  #10   Spotlight this post!  
Unread 08-02-2007, 19:12
937Programmers 937Programmers is offline
Registered User
AKA: Phil M - Programming Leader
FRC #0937 (North Stars)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Kansas
Posts: 7
937Programmers is an unknown quantity at this point
Re: PWMs not outputting in Autonomous

Well, all the motors work under human operation, and I haven't gotten around to messing with it yet today (I just got here )

Anyways, here's my autonomous function before modification today:

Code:
void User_Autonomous_Code(void)
{
  /* Initialize all PWMs and Relays when entering Autonomous mode, or else it
     will be stuck with the last values mapped from the joysticks.  Remember, 
     even when Disabled it is reading inputs from the Operator Interface. 
  */
  pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
  pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
  relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
  relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
  relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
  relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;

  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. */
		// STEP 1 - Initialize the Camera
		Tracking_Info_Terminal();
		Camera_Handler();
		Servo_Track();

		if(Get_Tracking_State() >= TARGET_IN_VIEW)
		{
			// STEP 2 - Make Robot Face the Light
			if((((int)PAN_SERVO-124)*65)/124 < 0)
			{
				pwm13 = pwm14 = 62;
				pwm15 = pwm16 = 192;
				centered = 0;
			}
			else if((((int)PAN_SERVO-124)*65)/124 > 0) 
			{
				pwm13 = pwm14 = 192;
				pwm15 = pwm16 = 62;
				centered = 0;
			}
			else
			{
				pwm13 = pwm14 = pwm15 = pwm16 = 127;
				centered = 1;
			}
		
			// STEP 3 - Drive Robot forward until 4 feet in front of Rack

			if((((int)TILT_SERVO-144)*25)/50 < 67 && centered == 1)
			{
				pwm13 = pwm14 = pwm15 = pwm16 = 192;
			}
			
			if(centered == 1 && (((int)TILT_SERVO-144)*25)/50 >= 67)
			{
				pwm13 = pwm14 = pwm15 = pwm16 = 127;
				
				// STEP 4 - Move the arm to the center position
				if(counter < 624 && arminpos == 0)
				{
					pwm08 = 254;
					counter++;
					if(counter == 624)
					{
						arminpos = 1;
					}
				}	
			}
			counter = 0;

			// STEP 5 - Place the tube on the leg
			if(arminpos == 1)
			{
				pwm13 = pwm14 = pwm15 = pwm16 = 192;
				counter++;
				if(counter == 26) 
				{
					overdisk = 1;
					pwm13 = pwm14 = pwm15 = pwm16 = 127;
				}		
			
				if(counter < 208 && clawopen == 0)
				{
					pwm05 = 192;
					if(overdisk == 1)
					{
						counter++;
					}
				}

				if(counter == 208)
				{
					clawopen = 1;  counter = 0;  pwm05 = 127;
				}
			}

			if(clawopen == 1)
			{
				pwm13 = pwm14 = pwm15 = pwm16 = 62;
			}
			// END AUTONOMOUS CODE
		}

	    PWM(pwm13,pwm14,pwm15,pwm16);

        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
    }
  }
}
Thanks for the help. Hopefully this gets fixed today.