1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

GCS-PathPlanner

Fixes and enhancements.
This commit is contained in:
PT_Dreamer 2012-10-28 16:55:08 +00:00
parent 994b9d209a
commit c31f08d350
4 changed files with 60 additions and 30 deletions

View File

@ -100,7 +100,7 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const
return true;
break;
case ISRELATIVE:
row->isRelative=value.toDouble();
row->isRelative=value.toBool();
return true;
break;
case ALTITUDE:
@ -116,19 +116,19 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const
return true;
break;
case MODE_PARAMS0:
row->mode_params[0]=value.toInt();
row->mode_params[0]=value.toFloat();
return true;
break;
case MODE_PARAMS1:
row->mode_params[1]=value.toInt();
row->mode_params[1]=value.toFloat();
return true;
break;
case MODE_PARAMS2:
row->mode_params[2]=value.toInt();
row->mode_params[2]=value.toFloat();
return true;
break;
case MODE_PARAMS3:
row->mode_params[3]=value.toInt();
row->mode_params[3]=value.toFloat();
return true;
break;
case CONDITION:
@ -136,19 +136,19 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const
return true;
break;
case CONDITION_PARAMS0:
row->condition_params[0]=value.toInt();
row->condition_params[0]=value.toFloat();
return true;
break;
case CONDITION_PARAMS1:
row->condition_params[1]=value.toInt();
row->condition_params[1]=value.toFloat();
return true;
break;
case CONDITION_PARAMS2:
row->condition_params[2]=value.toInt();
row->condition_params[2]=value.toFloat();
return true;
break;
case CONDITION_PARAMS3:
row->condition_params[3]=value.toInt();
row->condition_params[3]=value.toFloat();
return true;
break;
case COMMAND:
@ -366,15 +366,15 @@ bool flightDataModel::insertRows(int row, int count, const QModelIndex &/*parent
data->disRelative=0;
data->beaRelative=0;
data->altitudeRelative=0;
data->isRelative=0;
data->isRelative=true;
data->altitude=0;
data->velocity=0;
data->mode=0;
data->mode=1;
data->mode_params[0]=0;
data->mode_params[1]=0;
data->mode_params[2]=0;
data->mode_params[3]=0;
data->condition=0;
data->condition=3;
data->condition_params[0]=0;
data->condition_params[1]=0;
data->condition_params[2]=0;
@ -383,6 +383,25 @@ bool flightDataModel::insertRows(int row, int count, const QModelIndex &/*parent
data->jumpdestination=0;
data->errordestination=0;
data->locked=false;
if(rowCount()>0)
{
data->altitude=this->data(this->index(rowCount()-1,ALTITUDE)).toDouble();
data->altitudeRelative=this->data(this->index(rowCount()-1,ALTITUDERELATIVE)).toDouble();
data->isRelative=this->data(this->index(rowCount()-1,ISRELATIVE)).toBool();
data->velocity=this->data(this->index(rowCount()-1,VELOCITY)).toFloat();
data->mode=this->data(this->index(rowCount()-1,MODE)).toInt();
data->mode_params[0]=this->data(this->index(rowCount()-1,MODE_PARAMS0)).toFloat();
data->mode_params[1]=this->data(this->index(rowCount()-1,MODE_PARAMS1)).toFloat();
data->mode_params[2]=this->data(this->index(rowCount()-1,MODE_PARAMS2)).toFloat();
data->mode_params[3]=this->data(this->index(rowCount()-1,MODE_PARAMS3)).toFloat();
data->condition=this->data(this->index(rowCount()-1,CONDITION)).toInt();
data->condition_params[0]=this->data(this->index(rowCount()-1,CONDITION_PARAMS0)).toFloat();
data->condition_params[1]=this->data(this->index(rowCount()-1,CONDITION_PARAMS1)).toFloat();
data->condition_params[2]=this->data(this->index(rowCount()-1,CONDITION_PARAMS2)).toFloat();
data->condition_params[3]=this->data(this->index(rowCount()-1,CONDITION_PARAMS3)).toFloat();
data->command=this->data(this->index(rowCount()-1,COMMAND)).toInt();
data->errordestination=this->data(this->index(rowCount()-1,ERRORDESTINATION)).toInt();
}
dataStorage.insert(row,data);
}
endInsertRows();
@ -601,13 +620,13 @@ void flightDataModel::readFromFile(QString fileName)
else if(field.attribute("name")=="mode")
data->mode=field.attribute("value").toInt();
else if(field.attribute("name")=="mode_param0")
data->mode_params[0]=field.attribute("value").toDouble();
data->mode_params[0]=field.attribute("value").toFloat();
else if(field.attribute("name")=="mode_param1")
data->mode_params[1]=field.attribute("value").toDouble();
data->mode_params[1]=field.attribute("value").toFloat();
else if(field.attribute("name")=="mode_param2")
data->mode_params[2]=field.attribute("value").toDouble();
data->mode_params[2]=field.attribute("value").toFloat();
else if(field.attribute("name")=="mode_param3")
data->mode_params[3]=field.attribute("value").toDouble();
data->mode_params[3]=field.attribute("value").toFloat();
else if(field.attribute("name")=="condition")
data->condition=field.attribute("value").toDouble();
else if(field.attribute("name")=="condition_param0")

View File

@ -40,7 +40,6 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent,QAbstract
connect(ui->checkBoxLocked,SIGNAL(toggled(bool)),this,SLOT(enableEditWidgets(bool)));
connect(ui->cbMode,SIGNAL(currentIndexChanged(int)),this,SLOT(setupModeWidgets()));
connect(ui->cbCondition,SIGNAL(currentIndexChanged(int)),this,SLOT(setupConditionWidgets()));
connect(ui->pushButtonApply,SIGNAL(clicked()),this,SLOT(pushButtonApply_clicked()));
connect(ui->pushButtonCancel,SIGNAL(clicked()),this,SLOT(pushButtonCancel_clicked()));
MapDataDelegate::loadComboBox(ui->cbMode,flightDataModel::MODE);
MapDataDelegate::loadComboBox(ui->cbCondition,flightDataModel::CONDITION);
@ -50,7 +49,7 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent,QAbstract
mapper->setItemDelegate(new MapDataDelegate(this));
connect(mapper,SIGNAL(currentIndexChanged(int)),this,SLOT(currentIndexChanged(int)));
mapper->setModel(model);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
mapper->addMapping(ui->checkBoxLocked,flightDataModel::LOCKED);
mapper->addMapping(ui->doubleSpinBoxLatitude,flightDataModel::LATPOSITION);
mapper->addMapping(ui->doubleSpinBoxLongitude,flightDataModel::LNGPOSITION);
@ -234,10 +233,6 @@ void opmap_edit_waypoint_dialog::pushButtonCancel_clicked()
mapper->revert();
close();
}
void opmap_edit_waypoint_dialog::pushButtonApply_clicked()
{
mapper->submit();
}
void opmap_edit_waypoint_dialog::editWaypoint(mapcontrol::WayPointItem *waypoint_item)
{
if (!waypoint_item) return;

View File

@ -64,7 +64,6 @@ private slots:
void setupConditionWidgets();
void pushButtonCancel_clicked();
void on_pushButtonOK_clicked();
void pushButtonApply_clicked();
void on_pushButton_clicked();
void on_pushButton_2_clicked();
void enableEditWidgets(bool);

View File

@ -386,6 +386,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
@ -469,6 +472,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="3" column="1">
@ -476,6 +482,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="4" column="1">
@ -483,6 +492,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2">
@ -545,6 +557,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
@ -628,6 +643,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="3" column="1">
@ -635,6 +653,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="4" column="1">
@ -642,6 +663,9 @@
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2">
@ -798,13 +822,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCancel">
<property name="text">