/** Helper function: setup motors. Takes a list of channel names in input. */ void ConfigMultiRotorWidget::setupMotors(QList<QString> motorList) { QList<QComboBox*> mmList; mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2 << m_aircraft->multiMotorChannelBox3 << m_aircraft->multiMotorChannelBox4 << m_aircraft->multiMotorChannelBox5 << m_aircraft->multiMotorChannelBox6 << m_aircraft->multiMotorChannelBox7 << m_aircraft->multiMotorChannelBox8; GUIConfigDataUnion configData = GetConfigData(); ResetActuators(&configData); int index; foreach (QString motor, motorList) { index = mmList.takeFirst()->currentIndex(); if (motor == QString("VTOLMotorN")) configData.multi.VTOLMotorN = index; else if (motor == QString("VTOLMotorNE")) configData.multi.VTOLMotorNE = index; else if (motor == QString("VTOLMotorE")) configData.multi.VTOLMotorE = index; else if (motor == QString("VTOLMotorSE")) configData.multi.VTOLMotorSE = index; else if (motor == QString( "VTOLMotorS")) configData.multi.VTOLMotorS = index; else if (motor == QString( "VTOLMotorSW")) configData.multi.VTOLMotorSW = index; else if (motor == QString( "VTOLMotorW")) configData.multi.VTOLMotorW = index; else if (motor == QString( "VTOLMotorNW")) configData.multi.VTOLMotorNW = index; }
/** Setup steerable ground vehicle. Returns False if impossible to create the mixer. */ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(SystemSettings::AirframeTypeOptions airframeType) { // Check coherence: //Show any config errors in GUI if (throwConfigError(airframeType)) { return false; } // Now setup the channels: GUIConfigDataUnion config = GetConfigData(); ResetActuators(&config); config.ground.GroundVehicleThrottle1 = m_aircraft->gvMotor1ChannelBox->currentIndex(); config.ground.GroundVehicleThrottle2 = m_aircraft->gvMotor2ChannelBox->currentIndex(); config.ground.GroundVehicleSteering1 = m_aircraft->gvSteering1ChannelBox->currentIndex(); config.ground.GroundVehicleSteering2 = m_aircraft->gvSteering2ChannelBox->currentIndex(); SetConfigData(config); MixerSettings *mixerSettings = MixerSettings::GetInstance(getObjectManager()); Q_ASSERT(mixerSettings); resetMixers(mixerSettings); int channel = m_aircraft->gvSteering1ChannelBox->currentIndex()-1; setMixerType(mixerSettings,channel, MixerSettings::MIXER1TYPE_SERVO); setMixerVectorValue(mixerSettings, channel, MixerSettings::MIXER1VECTOR_YAW, 127); channel = m_aircraft->gvSteering2ChannelBox->currentIndex()-1; setMixerType(mixerSettings,channel, MixerSettings::MIXER1TYPE_SERVO); setMixerVectorValue(mixerSettings, channel, MixerSettings::MIXER1VECTOR_YAW, -127); channel = m_aircraft->gvMotor1ChannelBox->currentIndex()-1; setMixerType(mixerSettings,channel, MixerSettings::MIXER1TYPE_MOTOR); setMixerVectorValue(mixerSettings, channel, MixerSettings::MIXER1VECTOR_THROTTLECURVE1, 127); channel = m_aircraft->gvMotor2ChannelBox->currentIndex()-1; setMixerType(mixerSettings,channel, MixerSettings::MIXER1TYPE_MOTOR); setMixerVectorValue(mixerSettings, channel, MixerSettings::MIXER1VECTOR_THROTTLECURVE2, 127); //Output success message m_aircraft->gvStatusLabel->setText("Mixer generated"); return true; }