void SlaveConfig::setConfigData(const QString &protocol, const QString &host, const QString &key, const QString &value ) { MetaData config; config.insert(key, value); setConfigData(protocol, host, config); }
/** Setup steerable ground vehicle. Returns False if impossible to create the mixer. */ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString 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); UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer); resetMotorAndServoMixers(mixer); int channel = m_aircraft->gvSteering1ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127); channel = m_aircraft->gvSteering2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127); channel = m_aircraft->gvMotor1ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); channel = m_aircraft->gvMotor2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); // Output success message m_aircraft->gvStatusLabel->setText("Mixer generated"); return true; }
/** Helper function to */ QString ConfigCustomWidget::updateConfigObjectsFromWidgets() { UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings"))); Q_ASSERT(system); QPointer<UAVObjectField> field = system->getField(QString("AirframeType")); // Do not allow changes until AirframeType == Custom // If user want to save custom mixer : first set AirframeType to 'Custom' without changes and next modify. if (field->getValue().toString() == "Custom") { UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer); setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->customThrottle1Curve->getCurve()); setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve()); GUIConfigDataUnion configData = getConfigData(); resetActuators(&configData); // Update the table: for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) { QComboBox *q = (QComboBox *)m_aircraft->customMixerTable->cellWidget(0, channel); if (q->currentText() == "Disabled") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED); } else if (q->currentText() == "Motor") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR); if (configData.custom.Motor1 == 0) { configData.custom.Motor1 = channel + 1; } else if (configData.custom.Motor2 == 0) { configData.custom.Motor2 = channel + 1; } else if (configData.custom.Motor3 == 0) { configData.custom.Motor3 = channel + 1; } else if (configData.custom.Motor4 == 0) { configData.custom.Motor4 = channel + 1; } else if (configData.custom.Motor5 == 0) { configData.custom.Motor5 = channel + 1; } else if (configData.custom.Motor6 == 0) { configData.custom.Motor6 = channel + 1; } else if (configData.custom.Motor7 == 0) { configData.custom.Motor7 = channel + 1; } else if (configData.custom.Motor8 == 0) { configData.custom.Motor8 = channel + 1; } } else if (q->currentText() == "ReversableMotor") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR); if (configData.custom.RevMotor1 == 0) { configData.custom.RevMotor1 = channel + 1; } else if (configData.custom.RevMotor2 == 0) { configData.custom.RevMotor2 = channel + 1; } else if (configData.custom.RevMotor3 == 0) { configData.custom.RevMotor3 = channel + 1; } else if (configData.custom.RevMotor4 == 0) { configData.custom.RevMotor4 = channel + 1; } else if (configData.custom.RevMotor5 == 0) { configData.custom.RevMotor5 = channel + 1; } else if (configData.custom.RevMotor6 == 0) { configData.custom.RevMotor6 = channel; } else if (configData.custom.RevMotor7 == 0) { configData.custom.RevMotor7 = channel; } else if (configData.custom.RevMotor8 == 0) { configData.custom.RevMotor8 = channel; } } else if (q->currentText() == "Servo") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); if (configData.custom.Servo1 == 0) { configData.custom.Servo1 = channel + 1; } else if (configData.custom.Servo2 == 0) { configData.custom.Servo2 = channel + 1; } else if (configData.custom.Servo3 == 0) { configData.custom.Servo3 = channel + 1; } else if (configData.custom.Servo4 == 0) { configData.custom.Servo4 = channel + 1; } else if (configData.custom.Servo5 == 0) { configData.custom.Servo5 = channel + 1; } else if (configData.custom.Servo6 == 0) { configData.custom.Servo6 = channel + 1; } else if (configData.custom.Servo7 == 0) { configData.custom.Servo7 = channel + 1; } else if (configData.custom.Servo8 == 0) { configData.custom.Servo8 = channel + 1; } } else if (q->currentText() == "CameraRoll") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAROLL); } else if (q->currentText() == "CameraPitch") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAPITCH); } else if (q->currentText() == "CameraYaw") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_CAMERAYAW); } else if (q->currentText() == "Accessory0") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY0); } else if (q->currentText() == "Accessory1") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY1); } else if (q->currentText() == "Accessory2") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY2); } else if (q->currentText() == "Accessory3") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY3); } else if (q->currentText() == "Accessory4") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY4); } else if (q->currentText() == "Accessory5") { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_ACCESSORY5); } setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, m_aircraft->customMixerTable->item(1, channel)->text().toDouble()); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, m_aircraft->customMixerTable->item(2, channel)->text().toDouble()); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, m_aircraft->customMixerTable->item(3, channel)->text().toDouble()); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, m_aircraft->customMixerTable->item(4, channel)->text().toDouble()); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, m_aircraft->customMixerTable->item(5, channel)->text().toDouble()); } setConfigData(configData); } return "Custom"; }
/** Setup VTail */ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType) { // Check coherence: // Show any config errors in GUI if (throwConfigError(airframeType)) { return false; } GUIConfigDataUnion config = getConfigData(); resetActuators(&config); config.fixedwing.FixedWingPitch1 = m_aircraft->fwElevator1ChannelBox->currentIndex(); config.fixedwing.FixedWingPitch2 = m_aircraft->fwElevator2ChannelBox->currentIndex(); config.fixedwing.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex(); config.fixedwing.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex(); config.fixedwing.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex(); setConfigData(config); UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer); resetMotorAndServoMixers(mixer); // Save the curve: // ... and compute the matrix: // In order to make code a bit nicer, we assume: // - Channel dropdowns start with 'None', then 0 to 7 // 1. Assign the servo/motor/none for each channel double pitch; double roll; double yaw; // motor int channel = m_aircraft->fwEngineChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); // ailerons setMixerValue(mixer, "FirstRollServo", m_aircraft->fwAileron1ChannelBox->currentIndex()); channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1; if (channel > -1) { // Roll mixer value, currently no slider (should be added for Ailerons response ?) roll = 127; // Store Roll fixed and RollDifferential values onboard setMixerValue(mixer, "MixerValueRoll", 100); setMixerValue(mixer, "RollDifferential", m_aircraft->elevonSlider3->value()); // First Aileron (left) setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll); // Second Aileron (right) channel = m_aircraft->fwAileron2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll); } // vtail (pitch / yaw mixing) channel = m_aircraft->fwElevator1ChannelBox->currentIndex() - 1; if (channel > -1) { // Compute mixer absolute values pitch = (double)(m_aircraft->elevonSlider2->value() * 1.27); yaw = (double)(m_aircraft->elevonSlider1->value() * 1.27); // Store sliders values onboard setMixerValue(mixer, "MixerValuePitch", m_aircraft->elevonSlider2->value()); setMixerValue(mixer, "MixerValueYaw", m_aircraft->elevonSlider1->value()); // First Vtail servo setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, -pitch); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yaw); // Second Vtail servo channel = m_aircraft->fwElevator2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yaw); } m_aircraft->fwStatusLabel->setText("Mixer generated"); return true; }
/** Setup Elevator/Aileron/Rudder airframe. If both Aileron channels are set to 'None' (EasyStar), do Pitch/Rudder mixing Returns False if impossible to create the mixer. */ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType) { // Check coherence: // Show any config errors in GUI if (throwConfigError(airframeType)) { return false; } // Now setup the channels: GUIConfigDataUnion config = getConfigData(); resetActuators(&config); config.fixedwing.FixedWingPitch1 = m_aircraft->fwElevator1ChannelBox->currentIndex(); config.fixedwing.FixedWingPitch2 = m_aircraft->fwElevator2ChannelBox->currentIndex(); config.fixedwing.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex(); config.fixedwing.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex(); config.fixedwing.FixedWingYaw1 = m_aircraft->fwRudder1ChannelBox->currentIndex(); config.fixedwing.FixedWingYaw2 = m_aircraft->fwRudder2ChannelBox->currentIndex(); config.fixedwing.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex(); setConfigData(config); UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(mixer); resetMotorAndServoMixers(mixer); // ... and compute the matrix: // In order to make code a bit nicer, we assume: // - Channel dropdowns start with 'None', then 0 to 7 // 1. Assign the servo/motor/none for each channel // motor int channel = m_aircraft->fwEngineChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); // rudder channel = m_aircraft->fwRudder1ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127); // ailerons setMixerValue(mixer, "FirstRollServo", m_aircraft->fwAileron1ChannelBox->currentIndex()); channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1; if (channel > -1) { // Store differential value onboard setMixerValue(mixer, "RollDifferential", m_aircraft->elevonSlider3->value()); setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, 127); channel = m_aircraft->fwAileron2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, 127); } // elevators channel = m_aircraft->fwElevator1ChannelBox->currentIndex() - 1; if (channel > -1) { setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, 127); channel = m_aircraft->fwElevator2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, 127); } m_aircraft->fwStatusLabel->setText("Mixer generated"); return true; }
void configureFabric(void) { unsigned int items[] = { 0, // Blank---does nothing 5, 0, 4, 3, 5, 0, 4, 2, 5, 0, 4, 2, 4, 0, 1, 0, 4, 0, 0, 0, 0xfc000000, 0, 0x24000000, //l.rfe << (32-6), 0, 0, 0x00000001, 0x00000001, 0, 1, 0, 0xfc000000, 0, 0xc0000000, //l.mtspr, 0, 0, 0x00000001, 0x00000001, 0, 1, 0, 0x03e00fff, //.target, 0, 17, //SR, 0, 0, 0x00000001, 0x00000001, 0, 1, 0, 0x00000001, 0, 1, 0, 0, 0xffffffff, 0, 0, 0, 0, 0x00000001, 0, 1, 0, 0, 0xfffff0ff, 0, 0, 0, 0}; int counter; for(counter = 0; counter < sizeof(items)/sizeof(unsigned int); ++counter) { setConfigAddress(counter); setConfigData(items[counter]); strobeConfig(); } }