1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Merge remote-tracking branch 'origin/steve/OP-1903_Add_TxPID_controls_for_AttitudeSettings' into rel-nano-15.05

This commit is contained in:
abeck70 2015-05-30 19:31:46 +10:00
commit c8ff29c404
3 changed files with 31 additions and 1 deletions

View File

@ -55,6 +55,7 @@
#include "accessorydesired.h"
#include "manualcontrolcommand.h"
#include "stabilizationsettings.h"
#include "attitudesettings.h"
#ifdef REVOLUTION
#include "altitudeholdsettings.h"
#endif
@ -195,6 +196,10 @@ static void updatePIDs(UAVObjEvent *ev)
}
StabilizationSettingsData stab;
StabilizationSettingsGet(&stab);
AttitudeSettingsData att;
AttitudeSettingsGet(&att);
#ifdef REVOLUTION
AltitudeHoldSettingsData altitude;
AltitudeHoldSettingsGet(&altitude);
@ -203,6 +208,7 @@ static void updatePIDs(UAVObjEvent *ev)
uint8_t needsUpdateBank = 0;
uint8_t needsUpdateStab = 0;
uint8_t needsUpdateAtt = 0;
#ifdef REVOLUTION
uint8_t needsUpdateAltitude = 0;
#endif
@ -365,6 +371,16 @@ static void updatePIDs(UAVObjEvent *ev)
case TXPIDSETTINGS_PIDS_ACROPLUSFACTOR:
needsUpdateBank |= update(&bank.AcroInsanityFactor, value);
break;
case TXPIDSETTINGS_PIDS_ACCELTAU:
needsUpdateAtt |= update(&att.AccelTau, value);
break;
case TXPIDSETTINGS_PIDS_ACCELKP:
needsUpdateAtt |= update(&att.AccelKp, value);
break;
case TXPIDSETTINGS_PIDS_ACCELKI:
needsUpdateAtt |= update(&att.AccelKi, value);
break;
#ifdef REVOLUTION
case TXPIDSETTINGS_PIDS_ALTITUDEPOSKP:
needsUpdateAltitude |= update(&altitude.VerticalPosP, value);
@ -390,6 +406,9 @@ static void updatePIDs(UAVObjEvent *ev)
if (needsUpdateStab) {
StabilizationSettingsSet(&stab);
}
if (needsUpdateAtt) {
AttitudeSettingsSet(&att);
}
#ifdef REVOLUTION
if (needsUpdateAltitude) {
AltitudeHoldSettingsSet(&altitude);

View File

@ -28,6 +28,7 @@
#include "configtxpidwidget.h"
#include "txpidsettings.h"
#include "hwsettings.h"
#include "attitudesettings.h"
#include "stabilizationsettings.h"
#include "stabilizationsettingsbank1.h"
#include "stabilizationsettingsbank2.h"
@ -305,6 +306,15 @@ float ConfigTxPIDWidget::getDefaultValueForPidOption(int pidOption)
if (pidOption == TxPIDSettings::PIDS_GYROTAU) {
StabilizationSettings *stab = qobject_cast<StabilizationSettings *>(getObject(QString("StabilizationSettings")));
return stab->getGyroTau();
} else if (pidOption == TxPIDSettings::PIDS_ACCELTAU) {
AttitudeSettings *att = qobject_cast<AttitudeSettings *>(getObject(QString("AttitudeSettings")));
return att->getAccelTau();
} else if (pidOption == TxPIDSettings::PIDS_ACCELKP) {
AttitudeSettings *att = qobject_cast<AttitudeSettings *>(getObject(QString("AttitudeSettings")));
return att->getAccelKp();
} else if (pidOption == TxPIDSettings::PIDS_ACCELKI) {
AttitudeSettings *att = qobject_cast<AttitudeSettings *>(getObject(QString("AttitudeSettings")));
return att->getAccelKi();
}
int pidBankIndex = m_txpid->pidBank->currentIndex();

View File

@ -20,7 +20,8 @@
Roll+Pitch Attitude.Kp, Roll+Pitch Attitude.Ki, Roll+Pitch Attitude.ILimit, Roll+Pitch Attitude.Resp,
Yaw Attitude.Kp, Yaw Attitude.Ki, Yaw Attitude.ILimit, Yaw Attitude.Resp,
Roll.Expo, Pitch.Expo, Roll+Pitch.Expo, Yaw.Expo,
GyroTau,AcroPlusFactor,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta"
GyroTau,AcroPlusFactor,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta,
AccelTau, AccelKp, AccelKi"
defaultvalue="Disabled"/>
<field name="MinPID" units="" type="float" elementnames="Instance1,Instance2,Instance3" defaultvalue="0"/>
<field name="MaxPID" units="" type="float" elementnames="Instance1,Instance2,Instance3" defaultvalue="0"/>