1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

CameraStab: change ResponseTime type from float to int16

This commit is contained in:
Oleg Semyonov 2011-12-18 01:34:45 +02:00
parent 2eb5130a7c
commit e11904c42f
2 changed files with 5 additions and 4 deletions

View File

@ -154,14 +154,15 @@ static void attitudeUpdated(UAVObjEvent* ev)
break;
case CAMERASTABSETTINGS_STABILIZATIONMODE_AXISLOCK:
input_rate = accessory.AccessoryVal * cameraStab.InputRate[i];
if (abs(input_rate) > cameraStab.MaxAxisLockRate)
if (fabs(input_rate) > cameraStab.MaxAxisLockRate)
csd->inputs[i] = bound(csd->inputs[i] + input_rate * csd->dT / 1000.0f, cameraStab.InputRange[i]);
break;
default:
PIOS_Assert(0);
}
csd->inputs_filtered[i] = (cameraStab.ResponseTime[i] / (cameraStab.ResponseTime[i] + csd->dT)) * csd->inputs_filtered[i]
+ (csd->dT / (cameraStab.ResponseTime[i] + csd->dT)) * csd->inputs[i];
float rt = (float)cameraStab.ResponseTime[i];
csd->inputs_filtered[i] = (rt / (rt + csd->dT)) * csd->inputs_filtered[i]
+ (csd->dT / (rt + csd->dT)) * csd->inputs[i];
}
}
}

View File

@ -4,7 +4,7 @@
<field name="Inputs" units="channel" type="enum" elementnames="Roll,Pitch,Yaw" options="Accessory0,Accessory1,Accessory2,Accessory3,Accessory4,Accessory5,,None" defaultvalue="None"/>
<field name="InputRange" units="deg" type="uint8" elementnames="Roll,Pitch,Yaw" defaultvalue="20"/>
<field name="InputRate" units="deg/s" type="uint8" elementnames="Roll,Pitch,Yaw" defaultvalue="50"/>
<field name="ResponseTime" units="ms" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="150"/>
<field name="ResponseTime" units="ms" type="uint16" elementnames="Roll,Pitch,Yaw" defaultvalue="150"/>
<field name="StabilizationMode" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="Attitude,AxisLock" defaultvalue="Attitude"/>
<field name="MaxAxisLockRate" units="deg/s" type="float" elements="1" defaultvalue="1"/>
<field name="OutputRange" units="deg" type="uint8" elementnames="Roll,Pitch,Yaw" defaultvalue="20"/>