mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
CameraStab: rename UAVO field
This commit is contained in:
parent
9c35570df6
commit
b01e332e03
@ -63,8 +63,8 @@
|
||||
// Private variables
|
||||
static struct CameraStab_data {
|
||||
portTickType lastSysTime;
|
||||
float inputs[CAMERASTABSETTINGS_INPUTS_NUMELEM];
|
||||
float inputs_filtered[CAMERASTABSETTINGS_INPUTS_NUMELEM];
|
||||
float inputs[CAMERASTABSETTINGS_INPUT_NUMELEM];
|
||||
float inputs_filtered[CAMERASTABSETTINGS_INPUT_NUMELEM];
|
||||
} *csd;
|
||||
|
||||
// Private functions
|
||||
@ -142,9 +142,9 @@ static void attitudeUpdated(UAVObjEvent* ev)
|
||||
csd->lastSysTime = thisSysTime;
|
||||
|
||||
// Read any input channels and apply LPF
|
||||
for (uint8_t i = 0; i < CAMERASTABSETTINGS_INPUTS_NUMELEM; i++) {
|
||||
if (cameraStab.Inputs[i] != CAMERASTABSETTINGS_INPUTS_NONE) {
|
||||
if (AccessoryDesiredInstGet(cameraStab.Inputs[i] - CAMERASTABSETTINGS_INPUTS_ACCESSORY0, &accessory) == 0) {
|
||||
for (uint8_t i = 0; i < CAMERASTABSETTINGS_INPUT_NUMELEM; i++) {
|
||||
if (cameraStab.Input[i] != CAMERASTABSETTINGS_INPUT_NONE) {
|
||||
if (AccessoryDesiredInstGet(cameraStab.Input[i] - CAMERASTABSETTINGS_INPUT_ACCESSORY0, &accessory) == 0) {
|
||||
float input_rate;
|
||||
switch (cameraStab.StabilizationMode[i]) {
|
||||
case CAMERASTABSETTINGS_STABILIZATIONMODE_ATTITUDE:
|
||||
@ -175,15 +175,15 @@ static void attitudeUpdated(UAVObjEvent* ev)
|
||||
float output;
|
||||
|
||||
AttitudeActualRollGet(&attitude);
|
||||
output = bound((attitude + csd->inputs_filtered[CAMERASTABSETTINGS_INPUTS_ROLL]) / cameraStab.OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_ROLL], 1.0f);
|
||||
output = bound((attitude + csd->inputs_filtered[CAMERASTABSETTINGS_INPUT_ROLL]) / cameraStab.OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_ROLL], 1.0f);
|
||||
CameraDesiredRollSet(&output);
|
||||
|
||||
AttitudeActualPitchGet(&attitude);
|
||||
output = bound((attitude + csd->inputs_filtered[CAMERASTABSETTINGS_INPUTS_PITCH]) / cameraStab.OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_PITCH], 1.0f);
|
||||
output = bound((attitude + csd->inputs_filtered[CAMERASTABSETTINGS_INPUT_PITCH]) / cameraStab.OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_PITCH], 1.0f);
|
||||
CameraDesiredPitchSet(&output);
|
||||
|
||||
AttitudeActualYawGet(&attitude);
|
||||
output = bound((attitude + csd->inputs_filtered[CAMERASTABSETTINGS_INPUTS_YAW]) / cameraStab.OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_YAW], 1.0f);
|
||||
output = bound((attitude + csd->inputs_filtered[CAMERASTABSETTINGS_INPUT_YAW]) / cameraStab.OutputRange[CAMERASTABSETTINGS_OUTPUTRANGE_YAW], 1.0f);
|
||||
CameraDesiredYawSet(&output);
|
||||
}
|
||||
|
||||
|
@ -75,11 +75,11 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
|
||||
|
||||
UAVObjectField *field;
|
||||
|
||||
field = cameraStab->getField("Inputs");
|
||||
field = cameraStab->getField("Input");
|
||||
Q_ASSERT(field);
|
||||
inputs[i]->clear();
|
||||
inputs[i]->addItems(field->getOptions());
|
||||
inputs[i]->setCurrentIndex(cameraStabData.Inputs[i]);
|
||||
inputs[i]->setCurrentIndex(cameraStabData.Input[i]);
|
||||
|
||||
field = cameraStab->getField("StabilizationMode");
|
||||
Q_ASSERT(field);
|
||||
@ -193,9 +193,9 @@ void ConfigCameraStabilizationWidget::applySettings()
|
||||
cameraStabData.OutputRange[CameraStabSettings::OUTPUTRANGE_PITCH] = m_camerastabilization->pitchOutputRange->value();
|
||||
cameraStabData.OutputRange[CameraStabSettings::OUTPUTRANGE_YAW] = m_camerastabilization->yawOutputRange->value();
|
||||
|
||||
cameraStabData.Inputs[CameraStabSettings::INPUTS_ROLL] = m_camerastabilization->rollInputChannel->currentIndex();
|
||||
cameraStabData.Inputs[CameraStabSettings::INPUTS_PITCH] = m_camerastabilization->pitchInputChannel->currentIndex();
|
||||
cameraStabData.Inputs[CameraStabSettings::INPUTS_YAW] = m_camerastabilization->yawInputChannel->currentIndex();
|
||||
cameraStabData.Input[CameraStabSettings::INPUT_ROLL] = m_camerastabilization->rollInputChannel->currentIndex();
|
||||
cameraStabData.Input[CameraStabSettings::INPUT_PITCH] = m_camerastabilization->pitchInputChannel->currentIndex();
|
||||
cameraStabData.Input[CameraStabSettings::INPUT_YAW] = m_camerastabilization->yawInputChannel->currentIndex();
|
||||
|
||||
cameraStabData.StabilizationMode[CameraStabSettings::STABILIZATIONMODE_ROLL] = m_camerastabilization->rollStabilizationMode->currentIndex();
|
||||
cameraStabData.StabilizationMode[CameraStabSettings::STABILIZATIONMODE_PITCH] = m_camerastabilization->pitchStabilizationMode->currentIndex();
|
||||
@ -255,9 +255,9 @@ void ConfigCameraStabilizationWidget::refreshValues()
|
||||
m_camerastabilization->pitchOutputRange->setValue(cameraStab.OutputRange[CameraStabSettings::OUTPUTRANGE_PITCH]);
|
||||
m_camerastabilization->yawOutputRange->setValue(cameraStab.OutputRange[CameraStabSettings::OUTPUTRANGE_YAW]);
|
||||
|
||||
m_camerastabilization->rollInputChannel->setCurrentIndex(cameraStab.Inputs[CameraStabSettings::INPUTS_ROLL]);
|
||||
m_camerastabilization->pitchInputChannel->setCurrentIndex(cameraStab.Inputs[CameraStabSettings::INPUTS_PITCH]);
|
||||
m_camerastabilization->yawInputChannel->setCurrentIndex(cameraStab.Inputs[CameraStabSettings::INPUTS_YAW]);
|
||||
m_camerastabilization->rollInputChannel->setCurrentIndex(cameraStab.Input[CameraStabSettings::INPUT_ROLL]);
|
||||
m_camerastabilization->pitchInputChannel->setCurrentIndex(cameraStab.Input[CameraStabSettings::INPUT_PITCH]);
|
||||
m_camerastabilization->yawInputChannel->setCurrentIndex(cameraStab.Input[CameraStabSettings::INPUT_YAW]);
|
||||
|
||||
m_camerastabilization->rollStabilizationMode->setCurrentIndex(cameraStab.StabilizationMode[CameraStabSettings::STABILIZATIONMODE_ROLL]);
|
||||
m_camerastabilization->pitchStabilizationMode->setCurrentIndex(cameraStab.StabilizationMode[CameraStabSettings::STABILIZATIONMODE_PITCH]);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<xml>
|
||||
<object name="CameraStabSettings" singleinstance="true" settings="true">
|
||||
<description>Settings for the @ref CameraStab mmodule</description>
|
||||
<field name="Inputs" units="channel" type="enum" elementnames="Roll,Pitch,Yaw" options="Accessory0,Accessory1,Accessory2,Accessory3,Accessory4,Accessory5,,None" defaultvalue="None"/>
|
||||
<field name="Input" 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="uint16" elementnames="Roll,Pitch,Yaw" defaultvalue="150"/>
|
||||
|
Loading…
Reference in New Issue
Block a user