34 #include "actuatorcommand.h"
35 #include "actuatorsettings.h"
36 #include "stabilizationdesired.h"
37 #include "flightstatus.h"
38 #include "subtrimsettings.h"
39 #include "systemalarms.h"
58 StabilizationDesired *stabilizationDesired =
62 SubTrimSettings *subTrimSettings = SubTrimSettings::GetInstance(
getObjectManager());
63 SubTrimSettings::DataFields subTrimSettingsData = subTrimSettings->getData();
66 if (systemAlarms->getAlarm_ManualControl() != SystemAlarms::ALARM_OK) {
71 if (flightStatus->getArmed() != FlightStatus::ARMED_DISARMED) {
76 if (flightStatus->getFlightMode() != FlightStatus::FLIGHTMODE_LEVELING
77 && flightStatus->getFlightMode() != FlightStatus::FLIGHTMODE_ALTITUDEHOLD
78 && flightStatus->getFlightMode() != FlightStatus::FLIGHTMODE_STABILIZED1
79 && flightStatus->getFlightMode() != FlightStatus::FLIGHTMODE_STABILIZED2
80 && flightStatus->getFlightMode() != FlightStatus::FLIGHTMODE_STABILIZED3) {
85 if ((stabilizationDesired->getStabilizationMode_Pitch()
86 != StabilizationDesired::STABILIZATIONMODE_ATTITUDE)
87 || (stabilizationDesired->getStabilizationMode_Roll()
88 != StabilizationDesired::STABILIZATIONMODE_ATTITUDE)) {
93 subTrimSettingsData.Roll += stabilizationDesired->getRoll();
94 subTrimSettingsData.Pitch += stabilizationDesired->getPitch();
95 subTrimSettings->setData(subTrimSettingsData);
96 subTrimSettings->updated();
114 StabilizationDesired *stabilizationDesired =
118 ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(
getObjectManager());
119 ActuatorCommand::DataFields actuatorCommandData = actuatorCommand->getData();
122 ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(
getObjectManager());
123 ActuatorSettings::DataFields actuatorSettingsData = actuatorSettings->getData();
126 if (systemAlarms->getAlarm_ManualControl() != SystemAlarms::ALARM_OK) {
131 if (flightStatus->getFlightMode() != FlightStatus::FLIGHTMODE_MANUAL
132 || stabilizationDesired->getStabilizationMode_Roll()
133 != StabilizationDesired::STABILIZATIONMODE_MANUAL
134 || stabilizationDesired->getStabilizationMode_Pitch()
135 != StabilizationDesired::STABILIZATIONMODE_MANUAL
136 || stabilizationDesired->getStabilizationMode_Yaw()
137 != StabilizationDesired::STABILIZATIONMODE_MANUAL) {
143 for (
int i = 0;
i < channelDescriptions.length();
i++) {
144 if (channelDescriptions[
i] ==
"FixedWingRoll1"
145 || channelDescriptions[
i] ==
"FixedWingRoll2") {
146 int neutral = actuatorCommandData.Channel[
i];
147 actuatorSettingsData.ChannelNeutral[
i] = neutral;
148 }
else if (channelDescriptions[
i] ==
"FixedWingPitch1"
149 || channelDescriptions[
i] ==
"FixedWingPitch2") {
150 int neutral = actuatorCommandData.Channel[
i];
151 actuatorSettingsData.ChannelNeutral[
i] = neutral;
152 }
else if (channelDescriptions[
i] ==
"FixedWingYaw1"
153 || channelDescriptions[
i] ==
"FixedWingYaw2") {
154 int neutral = actuatorCommandData.Channel[
i];
155 actuatorSettingsData.ChannelNeutral[
i] = neutral;
160 actuatorSettings->setData(actuatorSettingsData);
161 actuatorSettings->updated();
Gui-less support class for vehicle trimming.
autopilotLevelBiasMessages
Core plugin system that manages the plugins, their life cycle and their registered objects...
autopilotLevelBiasMessages setAutopilotBias()
VehicleTrim::setFixedWingTrimAutopilotBias Takes the desired roll and pitch, and sets that as the aut...
void trimCompleted()
Indicate that a trim process has successfully completed and the results saved to UAVO.
UAVObjectManager * getObjectManager()
Get the object manager.
actuatorTrimMessages setTrimActuators()
VehicleTrim::setFixedWingTrimActuators Reads the servo inputs from the transmitter, and sets these values as the neutral points.
static QStringList getChannelDescriptions()