void MissionElevationDisplay::activeUASSet(UASInterface *uas) { if (m_uasInterface){ disconnect(m_uasWaypointMgr, SIGNAL(waypointEditableChanged(int,Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*))); disconnect(m_uasWaypointMgr, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16))); disconnect(m_uasWaypointMgr, SIGNAL(readGlobalWPFromUAS(bool)), this, SLOT(updateDisplay())); disconnect(m_uasWaypointMgr, SIGNAL(waypointEditableListChanged()), this, SLOT(updateDisplay())); disconnect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(updateElevationData())); disconnect(ui->setHomeAltButton, SIGNAL(clicked()), this, SLOT(setHomeAltOffset())); disconnect(ui->homeAltCheckBox, SIGNAL(clicked(bool)), this, SLOT(useHomeAltOffset(bool))); disconnect(ui->sampleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(sampleValueChanged())); } m_uasWaypointMgr = NULL; m_uasInterface = uas; if(m_uasInterface){ m_uasWaypointMgr = uas->getWaypointManager(); connect(m_uasWaypointMgr, SIGNAL(waypointEditableChanged(int,Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*))); connect(m_uasWaypointMgr, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16))); connect(m_uasWaypointMgr, SIGNAL(readGlobalWPFromUAS(bool)), this, SLOT(updateDisplay())); connect(m_uasWaypointMgr, SIGNAL(waypointEditableListChanged()), this, SLOT(updateDisplay())); connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(updateElevationData())); connect(ui->setHomeAltButton, SIGNAL(clicked()), this, SLOT(setHomeAltOffset())); connect(ui->homeAltCheckBox, SIGNAL(clicked(bool)), this, SLOT(useHomeAltOffset(bool))); connect(ui->sampleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(sampleValueChanged())); updateDisplay(); } }
void UASActionsWidget::activeUASSet(UASInterface *uas) { QLOG_INFO() << "UASActionWidget::activeUASSet"; if (uas == NULL) { QLOG_ERROR() << "uas object NULL"; return; } if (m_uas) { // disconnect previous connections disconnect(m_uas->getWaypointManager(),SIGNAL(waypointEditableListChanged()), this,SLOT(updateWaypointList())); disconnect(m_uas->getWaypointManager(),SIGNAL(currentWaypointChanged(quint16)), this,SLOT(currentWaypointChanged(quint16))); disconnect(m_uas,SIGNAL(armingChanged(bool)),this,SLOT(armingChanged(bool))); disconnect(m_uas, SIGNAL(connected()), this, SLOT(uasConnected())); disconnect(m_uas, SIGNAL(disconnected()), this, SLOT(uasDisconnected())); disconnect(m_uas,SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this,SLOT(parameterChanged(int,int,int,int,QString,QVariant))); disconnect(m_uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(heartbeatReceived(UASInterface*))); } // enable the controls ui.actionsGroupBox->setDisabled(false); ui.missionGroupBox->setDisabled(false); ui.altitudeTypeComboBox->addItem(tr("Relative (AGL)"), MAV_FRAME_GLOBAL_RELATIVE_ALT); ui.altitudeTypeComboBox->addItem(tr("Absolute (ASL)"), MAV_FRAME_GLOBAL); ui.shortcutGroupBox->setDisabled(false); ui.altitudeDoubleSpinBox->setValue(50.0f); // set a default altitude m_uas = static_cast<UAS*>(uas); connect(m_uas->getWaypointManager(),SIGNAL(waypointEditableListChanged()), this,SLOT(updateWaypointList())); connect(m_uas->getWaypointManager(),SIGNAL(currentWaypointChanged(quint16)), this,SLOT(currentWaypointChanged(quint16))); connect(m_uas,SIGNAL(armingChanged(bool)),this,SLOT(armingChanged(bool))); connect(m_uas, SIGNAL(connected()), this, SLOT(uasConnected())); connect(m_uas, SIGNAL(disconnected()), this, SLOT(uasDisconnected())); connect(m_uas,SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this,SLOT(parameterChanged(int,int,int,int,QString,QVariant))); connect(m_uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(heartbeatReceived(UASInterface*))); armingChanged(m_uas->isArmed()); updateWaypointList(); switch (uas->getAutopilotType()){ case MAV_AUTOPILOT_ARDUPILOTMEGA: { if (uas->isFixedWing()){ setupApmPlaneModes(); } else if (uas->isMultirotor()){ setupApmCopterModes(); } else if (uas->isGroundRover()){ setupApmRoverModes(); } else { QLOG_WARN() << "UASActionWidget: Unsupported System Type" << uas->getSystemType(); } // Setup Final Connections connect(ui.setModeButton, SIGNAL(clicked()),this, SLOT(setMode())); } break; case MAV_AUTOPILOT_PX4: { // [TODO] PX4 flight controller go here } case MAV_AUTOPILOT_GENERIC: default: { // [TODO] Generic, and other flight controllers } loadApmSettings(); configureModeButtonEnableDisable(); } }