Beispiel #1
0
task autonomous()
{
	switch(AutoSelect)
	{
		//AUTO SKILLS
	case 1:
		RedSkills();
		break;
		// AUTO ROUTINES
	case 2:
		//BALL AUTO
		Balls(3500);
		break;
	case 3:
		Park();
		break;
	case 4:
		WalloB();
		break;
	case 5:
		WalloR();
		break;
	case 6:
		FrontMiddleL();
		break;
	case 7:
		FrontMiddleR();
		break;
	case 8:
		SideMiddleB();
		break;
	case 9:
		SideMiddleR();
		break;

		///// TEST CODE /////
	case 17:
		//PID TURN TEST
		TurnLeft(900);
		wait1Msec(500);
		TurnRight(900);
		break;
	case 18:
		//PID DRIVE TEST
		Drive(36);
		break;
	case 19:
		// LEFT TEST
		LeftTest();
		break;
	case 20:
		// RIGHT TEST
		RightTest();
		break;
	default:
		//NOTHING
	}
}
//
// Function for interpreting a command string of the format ": COMMAND <ARGUMENT> #"
//
void Dome::interpretCommand(Messenger *message)
{
  message->readChar(); // Reads ":"
  char command = message->readChar(); // Read the command
  
  switch(command){
    case 'P':
      Park();
      break;
    case 'O':
      OpenCloseShutter(message->readInt());
      break;
    case 'S':
      Slew(message->readLong());
      break;
    case 'H':
      AbortSlew();
      break;
    case 'T':
      SyncToAzimuth(message->readInt());
      break;
  }
}
Beispiel #3
0
void Mount::syncTelescopeInfo()
{
    INumberVectorProperty * nvp = currentTelescope->getBaseDevice()->getNumber("TELESCOPE_INFO");

    if (nvp)
    {

        primaryScopeGroup->setTitle(currentTelescope->getDeviceName());
        guideScopeGroup->setTitle(i18n("%1 guide scope", currentTelescope->getDeviceName()));

        INumber *np = NULL;

        np = IUFindNumber(nvp, "TELESCOPE_APERTURE");
        if (np && np->value > 0)
            primaryScopeApertureIN->setValue(np->value);

        np = IUFindNumber(nvp, "TELESCOPE_FOCAL_LENGTH");
        if (np && np->value > 0)
            primaryScopeFocalIN->setValue(np->value);

        np = IUFindNumber(nvp, "GUIDER_APERTURE");
        if (np && np->value > 0)
            guideScopeApertureIN->setValue(np->value);

        np = IUFindNumber(nvp, "GUIDER_FOCAL_LENGTH");
        if (np && np->value > 0)
            guideScopeFocalIN->setValue(np->value);

    }

    ISwitchVectorProperty *svp = currentTelescope->getBaseDevice()->getSwitch("TELESCOPE_SLEW_RATE");

    if (svp)
    {
        slewSpeedCombo->clear();
        slewSpeedCombo->setEnabled(true);

        for (int i=0; i < svp->nsp; i++)
            slewSpeedCombo->addItem(i18nc(libindi_strings_context, svp->sp[i].label));

        int index = IUFindOnSwitchIndex(svp);
        slewSpeedCombo->setCurrentIndex(index);
        connect(slewSpeedCombo, SIGNAL(activated(int)), currentTelescope, SLOT(setSlewRate(int)), Qt::UniqueConnection);
    }
    else
    {
        slewSpeedCombo->setEnabled(false);
        disconnect(slewSpeedCombo, SIGNAL(activated(int)), currentTelescope, SLOT(setSlewRate(int)));
    }

    if (currentTelescope->canPark())
    {
        parkB->setEnabled(!currentTelescope->isParked());
        unparkB->setEnabled(currentTelescope->isParked());
        connect(parkB, SIGNAL(clicked()), currentTelescope, SLOT(Park()), Qt::UniqueConnection);
        connect(unparkB, SIGNAL(clicked()), currentTelescope, SLOT(UnPark()), Qt::UniqueConnection);
    }
    else
    {
        parkB->setEnabled(false);
        unparkB->setEnabled(false);
        disconnect(parkB, SIGNAL(clicked()), currentTelescope, SLOT(Park()));
        disconnect(unparkB, SIGNAL(clicked()), currentTelescope, SLOT(UnPark()));
    }

}
void DMA1_Channel1_IRQHandler(void) 
{
	uint8_t ii;

	/* Test DMA1 TC flag */
	if((DMA_GetFlagStatus(DMA1_FLAG_TC1)) != RESET ) 
	{
		/* Clear DMA TC flag */
		DMA_ClearFlag(DMA1_FLAG_TC1);
			
		if(Motor_State==INIT)
		{
			ADCTemp_Init(ADC_Tab);
		}
		else
		{						
			//LED_ON();
			if(FOC_Flag)
			{
				for(ii=0;ii<6;ii++)  TPWM_Cnt[ii+1]++;
				
				PWM_Cnt++;
				
				if(Limit_angle<(ANGLE_60D+ANGLE_60D/8))
				{
					SVM_Angle=SVM_Angle+Delta_angle;				
					Limit_angle+=Delta_angle;
				} 	
				
//  				SVM_Angle_Test=0;
//  				IQ_Reference=0;
// 				ID_Reference=1000;
// 				Test_Hall=HALL_DATA();				
			
				SVPWM_2ShuntGetPhaseCurrentValues(&Curr_a_b);
				Clarke(&Curr_alfa_beta,&Curr_a_b);
				Park(&Curr_q_d,&Curr_alfa_beta,SVM_Angle); 	//			
	#ifdef OPEN_I								
				Volt_q_d.qV_Component1=VQ_Reference;
	#else
				Volt_q_d.qV_Component1=PID_Regulator(IQ_Reference,Curr_q_d.qI_Component1,&IQ_PID_t);				//			
	#endif
				Volt_q_d.qV_Component2=PID_Regulator(ID_Reference,Curr_q_d.qI_Component2,&ID_PID_t);				

				RevPark_Circle_Limitation(&Volt_q_d);
				Rev_Park(&Volt_alfa_beta,&Volt_q_d);
				SVPWM_2ShuntCalcDutyCycles(&Volt_alfa_beta);											  				
			} else PWM_Cnt=1000;
			//LED_OFF();
			DAC_SetChannel1Data(DAC_Align_12b_R,SVM_Angle/16);	
		}			
		
		if(++T2ms_Temp>T2MSTEMP)			//2ms
		{	
			T2ms_Temp=0;
			T2ms_Flag=1;
		}	
		if(++T100ms_Temp>T100MSTEMP)	//100ms 
		{				
			T100ms_Temp=0;
			T100ms_Flag=1;
		}else{}

	}
}