1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

Merge branch 'revo-next' of ssh://git.openpilot.org/revo into revo-next

This commit is contained in:
a*morale 2012-11-02 23:28:04 +01:00
commit 99165abaf7
3 changed files with 26 additions and 22 deletions

View File

@ -565,11 +565,14 @@ void flightDataModel::readFromFile(QString fileName)
//TODO warning message
removeRows(0,rowCount());
QFile file(fileName);
file.open(QIODevice::ReadOnly);
QDomDocument doc("PathPlan");
if (!doc.setContent(file.readAll())) {
QByteArray array=file.readAll();
QString error;
if (!doc.setContent(array,&error)) {
QMessageBox msgBox;
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.exec();
return;
@ -616,7 +619,7 @@ void flightDataModel::readFromFile(QString fileName)
else if(field.attribute("name")=="altitude")
data->altitude=field.attribute("value").toDouble();
else if(field.attribute("name")=="velocity")
data->velocity=field.attribute("value").toDouble();
data->velocity=field.attribute("value").toFloat();
else if(field.attribute("name")=="mode")
data->mode=field.attribute("value").toInt();
else if(field.attribute("name")=="mode_param0")

View File

@ -143,7 +143,8 @@ void modelUavoProxy::objectsToModel()
myModel->setData(index,wpfields.Velocity);
distance=sqrt(wpfields.Position[Waypoint::POSITION_NORTH]*wpfields.Position[Waypoint::POSITION_NORTH]+
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)
bearing=0;
index=myModel->index(x,flightDataModel::DISRELATIVE);