关于四轴飞行器的航向问题,下面的程序有人能看明白么
{
int16_t ftemp=0;
Target.Pitch = (1500-RC_Data.PITCH)/(20 + 7*RC_Data.SENSITIVITY);//Target.Pitch?
Target.Roll = (RC_Data.ROLL-1500)/(20 + 7*RC_Data.SENSITIVITY);
//??±êo??ò?????£μ±óí??′óóú×?D??ì2é?μê±£?è??aó??§?£í??e·é?£???′′?ê±μ?o??ò×??a??±êo??ò
if(RC_Data.THROTTLE > RC_MINCHECK ) {
if(flag.LockYaw != 1){
flag.LockYaw = 1;
Target.Yaw = AngE.Yaw; //??μ±?°μ?o??ò×??a??±êo??ò
}
}
else {
flag.LockYaw = 0;
Target.Yaw = AngE.Yaw;
}
//o??ò?ú?Dμ?éè??ò????à??
if((RC_Data.YAW > 1600)||(RC_Data.YAW < 1400)){
ftemp = 1500 - RC_Data.YAW;
Target.Yaw += (ftemp / 200.0f)*0.1f;
//×a[-180.0,+180.0]
if(Target.Yaw >180.0f) Target.Yaw -= 360.0f;
else if(Target.Yaw <-180.0f)Target.Yaw += 360.0f;
}
}
///////////////////////////////////////////////////////////////////////////////////////////
这些程序看不懂呢
void Calculate_Target(void)
{
int16_t ftemp=0;
Target.Pitch = (1500-RC_Data.PITCH)/(20 + 7*RC_Data.SENSITIVITY);
Target.Roll = (RC_Data.ROLL-1500)/(20 + 7*RC_Data.SENSITIVITY);
//油门是否大于最小值
if(RC_Data.THROTTLE > RC_MINCHECK )
{
if(flag.LockYaw != 1)
{
//Yaw 锁定标志
flag.LockYaw = 1;
//目标航向
Target.Yaw = AngE.Yaw;
}
}
else
{
flag.LockYaw = 0;
Target.Yaw = AngE.Yaw;
}
//遥控给定的偏航增量范围
if((RC_Data.YAW > 1600)||(RC_Data.YAW < 1400))
{
//偏航增量 = 中间值 - 遥控给定值
ftemp = 1500 - RC_Data.YAW;
//新的偏航角 Target.Yaw += ftemp *0.005f;
Target.Yaw += (ftemp / 200.0f)*0.1f;
//偏航角规整到正负180°之间
if(Target.Yaw >180.0f)
Target.Yaw -= 360.0f;
else if(Target.Yaw <-180.0f)
Target.Yaw += 360.0f;
}
}
Target.Pitch = (1500-RC_Data.PITCH)/(20 + 7*RC_Data.SENSITIVITY);
Target.Roll = (RC_Data.ROLL-1500)/(20 + 7*RC_Data.SENSITIVITY);
请问这是怎么得的呢?
遥控给定的偏航增量范围那是干什么的呢?
应该就是当遥控器返回值在1400到1600之间时不执行航向修改,应该是为了防止校准问题或者是误差问题设计的