156 lines
3.1 KiB
C
156 lines
3.1 KiB
C
|
|
/*
|
|||
|
|
* Created: 2022/11/4 11:02:40
|
|||
|
|
* Author: wangzk zhengmengxing
|
|||
|
|
*/
|
|||
|
|
#include "..\PrjCommon\CommonDef.h"
|
|||
|
|
#include "AttCtrlMain.h"
|
|||
|
|
#include "AttMath.h"
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD>̳<EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
void ZKDYInit(void)
|
|||
|
|
{
|
|||
|
|
sAttPriData *tmpAtt=(sAttPriData *)ATTCLT_DATA1_ADDR;
|
|||
|
|
sAttGuidLawPara_t *pGuide=&tmpAtt->sGuidLawPara;
|
|||
|
|
if(NULL==tmpAtt)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
memset(pGuide->TargAng, 0.0, 3*sizeof(TYPE_CAL));
|
|||
|
|
memset(pGuide->TargAngRat, 0.0, 3*sizeof(TYPE_CAL));
|
|||
|
|
pGuide->AttGuid_Type=0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***********************************************
|
|||
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
***********************************************/
|
|||
|
|
void ZKDYDirSun(void)
|
|||
|
|
{
|
|||
|
|
sAttPriData *tmpAtt = NULL;
|
|||
|
|
sAttDeterPara_t *pDeter = NULL;
|
|||
|
|
sAttEnvPara_t *pEnv = NULL;
|
|||
|
|
sAttGuidLawPara_t *pGuide = NULL;
|
|||
|
|
tmpAtt=(sAttPriData *)ATTCLT_DATA1_ADDR;
|
|||
|
|
if(NULL==tmpAtt)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
pDeter = &tmpAtt->sDeterPara;
|
|||
|
|
pEnv = &tmpAtt->sEnvPara;
|
|||
|
|
pGuide=&tmpAtt->sGuidLawPara;
|
|||
|
|
|
|||
|
|
if(0==pDeter->CLPAttValid)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(0x55==pEnv->bInOutShadow)
|
|||
|
|
{
|
|||
|
|
memcpy(pGuide->TargAng, pDeter->CLPAttAng, 3*sizeof(TYPE_CAL));
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(0x55 == pDeter->AngToSun_ValidFlg)
|
|||
|
|
{
|
|||
|
|
if(pGuide->CaptureSunCnt<200)
|
|||
|
|
pGuide->CaptureSunCnt++;
|
|||
|
|
|
|||
|
|
if(pGuide->CaptureSunCnt>=5)
|
|||
|
|
{
|
|||
|
|
memset(pGuide->TargAng, 0.0, 3*sizeof(TYPE_CAL));
|
|||
|
|
memset(pGuide->TargAngRat, 0.0, 3*sizeof(TYPE_CAL));
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>̫<EFBFBD><CCAB>
|
|||
|
|
if (pDeter->CLPAttAngRatPre[0] < 0)
|
|||
|
|
{
|
|||
|
|
pGuide->TargAngRat[0] = - 0.1 * ANG2RADIAN; //zmx20230915
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
pGuide->TargAngRat[0] = 0.1 * ANG2RADIAN; //zmx20230915
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
pGuide->CaptureSunCnt=0;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>̫<EFBFBD><CCAB>
|
|||
|
|
if (pDeter->CLPAttAngRatPre[0] < 0)
|
|||
|
|
{
|
|||
|
|
pGuide->TargAngRat[0] = - 0.1 * ANG2RADIAN; //zmx20230915
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
pGuide->TargAngRat[0] = 0.1 * ANG2RADIAN; //zmx20230915
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/***********************************************
|
|||
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD>Ŀ<EFBFBD>굼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
***********************************************/
|
|||
|
|
void ZKDYTarget(void)
|
|||
|
|
{
|
|||
|
|
sAttPriData *tmpAtt=(sAttPriData *)ATTCLT_DATA1_ADDR;
|
|||
|
|
sAttGuidLawPara_t *pGuide=&tmpAtt->sGuidLawPara;
|
|||
|
|
|
|||
|
|
if(NULL==tmpAtt)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if((ATTMOD_MagTOSUN == tmpAtt->sModePara.WorkMode)
|
|||
|
|
||(ATTMOD_WHEELTOEARTH == tmpAtt->sModePara.WorkMode)
|
|||
|
|
||(ATTMOD_ATTAJUSTPRE == tmpAtt->sModePara.WorkMode)
|
|||
|
|
||(ATTMOD_ORBITCTL == tmpAtt->sModePara.WorkMode)
|
|||
|
|
||(ATTMOD_ATTAJUST ==tmpAtt->sModePara.WorkMode))
|
|||
|
|
{
|
|||
|
|
pGuide->TargAng[0]=0;
|
|||
|
|
pGuide->TargAng[1]=0;
|
|||
|
|
pGuide->TargAng[2]=0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if((ATTMOD_ONLTOEARTH ==tmpAtt->sModePara.WorkMode)||(ATTMOD_ATTAJUST ==tmpAtt->sModePara.WorkMode))
|
|||
|
|
{
|
|||
|
|
pGuide->TargAng[2]=tmpAtt->sDeterPara.CLPAttAng[2];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/************************************************
|
|||
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>
|
|||
|
|
<EFBFBD><EFBFBD><EFBFBD>룺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|||
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
************************************************/
|
|||
|
|
void ZKDYAction(void)
|
|||
|
|
{
|
|||
|
|
sAttPriData *tmpAtt=(sAttPriData *)ATTCLT_DATA1_ADDR;
|
|||
|
|
sAttGuidLawPara_t *pGuide=&tmpAtt->sGuidLawPara;
|
|||
|
|
|
|||
|
|
if(NULL==tmpAtt)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC>
|
|||
|
|
ZKDYInit();
|
|||
|
|
if((ATTMOD_WhlTOSUN ==tmpAtt->sModePara.WorkMode))
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD>ն<EFBFBD><D5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
pGuide->AttGuid_Type=1;
|
|||
|
|
ZKDYDirSun();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//<2F>̶<EFBFBD>Ŀ<EFBFBD>굼<EFBFBD><EAB5BC><EFBFBD><EFBFBD>
|
|||
|
|
pGuide->AttGuid_Type=2;
|
|||
|
|
ZKDYTarget();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|