mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
Merge remote-tracking branch 'op-public/next' into revo-next
Conflicts: shared/uavobjectdefinition/groundtruth.xml
This commit is contained in:
commit
9d1825f8a8
@ -565,11 +565,14 @@ void flightDataModel::readFromFile(QString fileName)
|
|||||||
//TODO warning message
|
//TODO warning message
|
||||||
removeRows(0,rowCount());
|
removeRows(0,rowCount());
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
file.open(QIODevice::ReadOnly);
|
||||||
QDomDocument doc("PathPlan");
|
QDomDocument doc("PathPlan");
|
||||||
if (!doc.setContent(file.readAll())) {
|
QByteArray array=file.readAll();
|
||||||
|
QString error;
|
||||||
|
if (!doc.setContent(array,&error)) {
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(tr("File Parsing Failed."));
|
msgBox.setText(tr("File Parsing Failed."));
|
||||||
msgBox.setInformativeText(tr("This file is not a correct XML file"));
|
msgBox.setInformativeText(QString(tr("This file is not a correct XML file:%0")).arg(error));
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
return;
|
return;
|
||||||
@ -616,7 +619,7 @@ void flightDataModel::readFromFile(QString fileName)
|
|||||||
else if(field.attribute("name")=="altitude")
|
else if(field.attribute("name")=="altitude")
|
||||||
data->altitude=field.attribute("value").toDouble();
|
data->altitude=field.attribute("value").toDouble();
|
||||||
else if(field.attribute("name")=="velocity")
|
else if(field.attribute("name")=="velocity")
|
||||||
data->velocity=field.attribute("value").toDouble();
|
data->velocity=field.attribute("value").toFloat();
|
||||||
else if(field.attribute("name")=="mode")
|
else if(field.attribute("name")=="mode")
|
||||||
data->mode=field.attribute("value").toInt();
|
data->mode=field.attribute("value").toInt();
|
||||||
else if(field.attribute("name")=="mode_param0")
|
else if(field.attribute("name")=="mode_param0")
|
||||||
|
@ -143,7 +143,8 @@ void modelUavoProxy::objectsToModel()
|
|||||||
myModel->setData(index,wpfields.Velocity);
|
myModel->setData(index,wpfields.Velocity);
|
||||||
distance=sqrt(wpfields.Position[Waypoint::POSITION_NORTH]*wpfields.Position[Waypoint::POSITION_NORTH]+
|
distance=sqrt(wpfields.Position[Waypoint::POSITION_NORTH]*wpfields.Position[Waypoint::POSITION_NORTH]+
|
||||||
wpfields.Position[Waypoint::POSITION_EAST]*wpfields.Position[Waypoint::POSITION_EAST]);
|
wpfields.Position[Waypoint::POSITION_EAST]*wpfields.Position[Waypoint::POSITION_EAST]);
|
||||||
bearing=acos(wpfields.Position[Waypoint::POSITION_NORTH]/wpfields.Position[Waypoint::POSITION_EAST])*180/M_PI;
|
bearing=atan2(wpfields.Position[Waypoint::POSITION_EAST],wpfields.Position[Waypoint::POSITION_NORTH])*180/M_PI;
|
||||||
|
|
||||||
if(bearing!=bearing)
|
if(bearing!=bearing)
|
||||||
bearing=0;
|
bearing=0;
|
||||||
index=myModel->index(x,flightDataModel::DISRELATIVE);
|
index=myModel->index(x,flightDataModel::DISRELATIVE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user