//This is a slot receiving signals from QCheckBox m_ui->current. The state given here is whatever the user has clicked and not the true "current" value onboard.
else// Strange case, unchecking the box which was not checked to start with
{
{
m_ui->current->setChecked(false);
m_ui->current->setCheckState(Qt::Unchecked);
m_ui->current->setCheckState(Qt::Unchecked);
wp->setCurrent(false);
qDebug()<<"Trof: WaypointViewOnlyView::changedCurrent. Unchecked false. set false "<<m_ui->current->isChecked();
}
}
}
}
else
else
{
{
/*
hightlightDesiredCurrent(true);
FIXME: The checkbox should turn gray to indicate, that set_current request has been sent to UAV. It should become blue (checked) after receiving set_current_ack from waypointplanner.
m_ui->current->setCheckState(Qt::Unchecked);
qDebug()<<"Trof: WaypointViewOnlyView::changedCurrent. Checked new. Sending set_current request to Manager "<<m_ui->current->isChecked();
m_ui->current->setStyleSheet("*::indicator { \
border: 1px solid #777777; \
border-radius: 2px; \
color: #999999; \
width: 10px; \
height: 10px; \
}");
*/
wp->setCurrent(true);
emitchangeCurrentWaypoint(wp->getId());//the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false
emitchangeCurrentWaypoint(wp->getId());//the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false
}
}
m_ui->current->blockSignals(false);
m_ui->current->blockSignals(false);
}
}
voidWaypointViewOnlyView::setCurrent(boolstate)
voidWaypointViewOnlyView::setCurrent(boolstate)
//This is a slot receiving signals from UASWaypointManager. The state given here is the true representation of what the "current" waypoint on UAV is.
m_ui->displayBar->setText(QString("Go to <b>(</b>lat <b>%1<sup>o</sup></b>, lon <b>%2<sup>o</sup></b>, alt <b>%3)</b> and loiter there indefinitely (clockwise); rad: %4").arg(wp->getX(),0,'f',7).arg(wp->getY(),0,'f',7).arg(wp->getZ(),0,'f',2).arg(wp->getParam3()));
}
else
{
m_ui->displayBar->setText(QString("Go to <b>(</b>lat <b>%1<sup>o</sup></b>, lon <b>%2<sup>o</sup></b>, alt <b>%3)</b> and loiter there indefinitely (counter-clockwise); rad: %4").arg(wp->getX(),0,'f',7).arg(wp->getY(),0,'f',7).arg(wp->getZ(),0,'f',2).arg(-wp->getParam3()));
}
break;
}
caseMAV_FRAME_LOCAL_NED:
default:
{
if(wp->getParam3()>=0)
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b> and loiter there indefinitely (clockwise); rad: %4").arg(wp->getX(),0,'f',2).arg(wp->getY(),0,'f',2).arg(wp->getZ(),0,'f',2).arg(wp->getParam3()));
}
else
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b> and loiter there indefinitely (counter-clockwise); rad: %4").arg(wp->getX(),0,'f',2).arg(wp->getY(),0,'f',2).arg(wp->getZ(),0,'f',2).arg(-wp->getParam3()));
}
break;
}
}//end Frame switch
break;
}
caseMAV_CMD_NAV_LOITER_TURNS:
{
switch(wp->getFrame())
{
caseMAV_FRAME_GLOBAL_RELATIVE_ALT:
caseMAV_FRAME_GLOBAL:
{
if(wp->getParam3()>=0)
{
m_ui->displayBar->setText(QString("Go to <b>(</b>lat <b>%1<sup>o</sup></b>, lon <b>%2<sup>o</sup></b>, alt <b>%3)</b> and loiter there for %5 turns (clockwise); rad: %4").arg(wp->getX(),0,'f',7).arg(wp->getY(),0,'f',7).arg(wp->getZ(),0,'f',2).arg(wp->getParam3()).arg(wp->getParam1()));
}
else
{
m_ui->displayBar->setText(QString("Go to <b>(</b>lat <b>%1<sup>o</sup></b>, lon <b>%2<sup>o</sup></b>, alt <b>%3)</b> and loiter there for %5 turns (counter-clockwise); rad: %4").arg(wp->getX(),0,'f',7).arg(wp->getY(),0,'f',7).arg(wp->getZ(),0,'f',2).arg(-wp->getParam3()).arg(wp->getParam1()));
}
break;
}
caseMAV_FRAME_LOCAL_NED:
default:
{
if(wp->getParam3()>=0)
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b> and loiter there for %5 turns (clockwise); rad: %4").arg(wp->getX(),0,'f',2).arg(wp->getY(),0,'f',2).arg(wp->getZ(),0,'f',2).arg(wp->getParam3()).arg(wp->getParam1()));
}
else
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b> and loiter there for %5 turns (counter-clockwise); rad: %4").arg(wp->getX(),0,'f',2).arg(wp->getY(),0,'f',2).arg(wp->getZ(),0,'f',2).arg(-wp->getParam3()).arg(wp->getParam1()));
}
break;
}
}//end Frame switch
break;
}
caseMAV_CMD_NAV_LOITER_TIME:
{
switch(wp->getFrame())
{
caseMAV_FRAME_GLOBAL_RELATIVE_ALT:
caseMAV_FRAME_GLOBAL:
{
if(wp->getParam3()>=0)
{
m_ui->displayBar->setText(QString("Go to <b>(</b>lat <b>%1<sup>o</sup></b>, lon <b>%2<sup>o</sup></b>, alt <b>%3)</b> and loiter there for %5s (clockwise); rad: %4").arg(wp->getX(),0,'f',7).arg(wp->getY(),0,'f',7).arg(wp->getZ(),0,'f',2).arg(wp->getParam3()).arg(wp->getParam1()));
}
else
{
m_ui->displayBar->setText(QString("Go to <b>(</b>lat <b>%1<sup>o</sup></b>, lon <b>%2<sup>o</sup></b>, alt <b>%3)</b> and loiter there for %5s (counter-clockwise); rad: %4").arg(wp->getX(),0,'f',7).arg(wp->getY(),0,'f',7).arg(wp->getZ(),0,'f',2).arg(-wp->getParam3()).arg(wp->getParam1()));
}
break;
}
caseMAV_FRAME_LOCAL_NED:
default:
{
if(wp->getParam3()>=0)
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b> and loiter there for %5s (clockwise); rad: %4").arg(wp->getX(),0,'f',2).arg(wp->getY(),0,'f',2).arg(wp->getZ(),0,'f',2).arg(wp->getParam3()).arg(wp->getParam1()));
}
else
{
m_ui->displayBar->setText(QString("Go to <b>(%1, %2, %3)</b> and loiter there for %5s (counter-clockwise); rad: %4").arg(wp->getX(),0,'f',2).arg(wp->getY(),0,'f',2).arg(wp->getZ(),0,'f',2).arg(-wp->getParam3()).arg(wp->getParam1()));
}
break;
}
}//end Frame switch
break;
}
caseMAV_CMD_NAV_RETURN_TO_LAUNCH:
{
m_ui->displayBar->setText(QString("Return to launch location"));