航点存储之前先排序
This commit is contained in:
Binary file not shown.
+2
-2
@@ -4484,7 +4484,7 @@
|
||||
<message>
|
||||
<location filename="ToolsUI/tools_Index2/tools_Index2.ui" line="155"/>
|
||||
<source>setPercent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>设置百分比</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="ToolsUI/tools_Index2/tools_Index2.ui" line="162"/>
|
||||
@@ -4504,7 +4504,7 @@
|
||||
<message>
|
||||
<location filename="ToolsUI/tools_Index2/tools_Index2.ui" line="183"/>
|
||||
<source>Create CSV</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>生成CSV记录</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="ToolsUI/tools_Index2/tools_Index2.ui" line="109"/>
|
||||
|
||||
@@ -197,6 +197,31 @@ void ParameterInspector::appendParameter(mavlink_message_t msg)
|
||||
|
||||
//如果收到特定的参数,就发出去。比如版本,HIL
|
||||
|
||||
if(param_id(param_value.param_id) == "ap_ver")
|
||||
{
|
||||
emit APversion(param_Value(param_value).toString());
|
||||
}
|
||||
else if(param_id(param_value.param_id) == "HIL_enabled")
|
||||
{
|
||||
emit HILMode(param_Value(param_value).toString());
|
||||
}
|
||||
|
||||
|
||||
//找到所有舵机参数,并发送出去
|
||||
{
|
||||
/*
|
||||
* del0 der0 dr0 dal0 dar0
|
||||
* k_dal k_dar k_del k_der k_dr
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
isReflush = true;
|
||||
@@ -232,7 +257,7 @@ void ParameterInspector::refreshView()//来一个参数更新一次
|
||||
//这个设备已经存在
|
||||
paramFound = true;
|
||||
//更新该参数
|
||||
Item->setData(1,Qt::DisplayRole,param_value(param));
|
||||
Item->setData(1,Qt::DisplayRole,param_Value(param));
|
||||
widgetitems.insert(param.param_index,Item);
|
||||
}
|
||||
}
|
||||
@@ -242,7 +267,7 @@ void ParameterInspector::refreshView()//来一个参数更新一次
|
||||
//没有找到,新建一个组
|
||||
QTreeWidgetItem* paraItem = new QTreeWidgetItem();
|
||||
paraItem->setData(0,Qt::DisplayRole,param_id(param.param_id));
|
||||
paraItem->setData(1,Qt::DisplayRole,param_value(param));
|
||||
paraItem->setData(1,Qt::DisplayRole,param_Value(param));
|
||||
paraItem->setData(2,Qt::DisplayRole,param_type(param));
|
||||
widgetitems.insert(param.param_index,paraItem);
|
||||
}
|
||||
@@ -329,7 +354,7 @@ void ParameterInspector::clearview(void)
|
||||
}
|
||||
|
||||
|
||||
QVariant ParameterInspector::param_value(mavlink_param_value_t param)
|
||||
QVariant ParameterInspector::param_Value(mavlink_param_value_t param)
|
||||
{
|
||||
QVariant value;
|
||||
|
||||
|
||||
@@ -124,6 +124,14 @@ signals:
|
||||
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
|
||||
void APversion(QString);
|
||||
void HILMode(QString);
|
||||
|
||||
void ServoParameter(int type,int index, QVariant data);//
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void addVehicles(int sysid, int compid);
|
||||
@@ -154,7 +162,7 @@ private slots:
|
||||
void on_clearButton_clicked();
|
||||
|
||||
|
||||
QVariant param_value(mavlink_param_value_t param);
|
||||
QVariant param_Value(mavlink_param_value_t param);
|
||||
|
||||
float param_getvalue(QVariant param,uint8_t type);
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ Senser::Senser(QWidget *parent) :
|
||||
|
||||
this->setWindowTitle(tr("sensor"));
|
||||
|
||||
ui->frame_Attitude->resize(490,235);
|
||||
ui->frame_Gyro->resize(490,235);
|
||||
ui->frame_Accelerate->resize(490,235);
|
||||
ui->frame_Servo->resize(490,235);
|
||||
ui->frame_Altitude->resize(490,235);
|
||||
ui->frame_Speed->resize(490,235);
|
||||
ui->frame_Attitude->resize(384,234);
|
||||
ui->frame_Gyro->resize(384,234);
|
||||
ui->frame_Accelerate->resize(384,234);
|
||||
ui->frame_Servo->resize(384,234);
|
||||
ui->frame_Altitude->resize(384,234);
|
||||
ui->frame_Speed->resize(384,234);
|
||||
|
||||
|
||||
|
||||
@@ -106,6 +106,23 @@ Senser::Senser(QWidget *parent) :
|
||||
this,&Senser::chartSelect);
|
||||
|
||||
|
||||
//StringModel = new QStringListModel(ui->listView_Data);
|
||||
|
||||
ItemModel = new QStandardItemModel(ui->listView_Data);
|
||||
|
||||
ui->listView_Data->setModel(ItemModel);
|
||||
|
||||
ui->listView_Data->scrollToBottom();
|
||||
|
||||
|
||||
QStandardItem *item = new QStandardItem("item1");
|
||||
ItemModel->appendRow(item);
|
||||
item = new QStandardItem("item2");
|
||||
ItemModel->appendRow(item);
|
||||
ui->listView_Data->setModel(ItemModel);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Senser::~Senser()
|
||||
@@ -273,10 +290,6 @@ void Senser::setValue(QLabel *w,QString s)
|
||||
|
||||
void Senser::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
qDebug() << "sensor resize";
|
||||
|
||||
qDebug() << ui->frame_Altitude->size();
|
||||
|
||||
attChart->setGeometry(0,0,ui->frame_Attitude->width(),ui->frame_Attitude->height());
|
||||
gyroChart->setGeometry(0,0,ui->frame_Gyro->width(),ui->frame_Gyro->height());
|
||||
accChart->setGeometry(0,0,ui->frame_Accelerate->width(),ui->frame_Accelerate->height());
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
#include "QScreen"
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QStringListModel>
|
||||
|
||||
#include "Chart.h"
|
||||
#include "QCheckBox"
|
||||
@@ -77,6 +79,10 @@ protected:
|
||||
private:
|
||||
Ui::Senser *ui;
|
||||
QWidget *m_parent;
|
||||
|
||||
|
||||
QStringListModel *StringModel;
|
||||
QStandardItemModel *ItemModel;
|
||||
};
|
||||
|
||||
#endif // SENSER_H
|
||||
|
||||
@@ -26,10 +26,13 @@
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="2">
|
||||
<widget class="QFrame" name="frame_5">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -68,7 +71,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="2">
|
||||
<widget class="QFrame" name="frame_Servo">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -78,17 +81,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame_Gyro">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="1" column="2">
|
||||
<widget class="QFrame" name="frame_Altitude">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -98,7 +91,18 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QFrame" name="frame_Attitude">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QFrame" name="frame_Accelerate">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -114,7 +118,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="2" column="2">
|
||||
<widget class="QFrame" name="frame_Speed">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -124,18 +128,39 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame_Attitude">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(0, 255, 0);</string>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QFrame" name="frame_Gyro">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="QListView" name="listView_Data">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="defaultDropAction">
|
||||
<enum>Qt::IgnoreAction</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -338,6 +338,19 @@ void ServoSystem::setServoState(mavlink_servo_output_raw_t *t)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ServoSystem::setAPversion(QString ver)
|
||||
{
|
||||
ui->label_APVer->setText(ver);
|
||||
}
|
||||
|
||||
void ServoSystem::setHILMode(QString mode)
|
||||
{
|
||||
ui->label_HILMode->setText(mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
float ServoSystem::param_getvalue(QVariant param,uint8_t type)
|
||||
{
|
||||
float value;
|
||||
|
||||
@@ -153,6 +153,8 @@ public slots:
|
||||
|
||||
void addVehicles(int sysid, int compid);
|
||||
|
||||
void setAPversion(QString ver);
|
||||
void setHILMode(QString mode);
|
||||
|
||||
private:
|
||||
QWidget *m_parent;
|
||||
|
||||
@@ -762,7 +762,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<widget class="QLabel" name="label_APVer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@@ -797,7 +797,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_32">
|
||||
<widget class="QLabel" name="label_HILMode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
|
||||
@@ -417,6 +417,12 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
toolsui->diagram,SLOT(setTargetPoint(int)));
|
||||
*/
|
||||
|
||||
|
||||
//=======setting=====tools====
|
||||
connect(setting->index1->paramInspect,SIGNAL(APversion(QString)),
|
||||
toolsui->servosystem,SLOT(setAPversion(QString)));
|
||||
|
||||
|
||||
//==== showmessage=====
|
||||
connect(toolsui->servosystem,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||||
connect(commandUI,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||||
|
||||
@@ -1492,6 +1492,70 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数
|
||||
|
||||
QJsonArray plannedHomePosition;
|
||||
|
||||
QMap<int,WayPointItem *> wlist;
|
||||
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {//逐渐往下增加
|
||||
wlist.insert(w->Number(),w);
|
||||
}
|
||||
}
|
||||
|
||||
for (QMap<int,WayPointItem *>::iterator i = wlist.begin(); i != wlist.end(); ++i) {
|
||||
|
||||
WayPointItem *w = i.value();
|
||||
|
||||
qDebug() << w->Number();
|
||||
|
||||
|
||||
if (w) {//逐渐往下增加
|
||||
if(w->Number()>0)
|
||||
{
|
||||
|
||||
//存到items
|
||||
QJsonArray params;
|
||||
params.append(w->Param1());
|
||||
params.append(w->Param2());
|
||||
params.append(w->Param3());
|
||||
params.append(w->Param4());
|
||||
params.append(w->Coord().Lat());
|
||||
params.append(w->Coord().Lng());
|
||||
params.append(w->Alt());
|
||||
|
||||
//可能有点问题
|
||||
QJsonObject item;
|
||||
|
||||
//如果这个点是指令,那么不会有高度信息
|
||||
|
||||
if(w->Command() < MAV_CMD::MAV_CMD_NAV_LAST) {
|
||||
|
||||
item.insert("AMSLAltAboveTerrain",w->Alt());
|
||||
item.insert("Altitude",w->Alt());
|
||||
item.insert("AltitudeMode",2);
|
||||
}
|
||||
|
||||
item.insert("autoContinue",w->AutoContinue()?true:false);
|
||||
item.insert("command",w->Command());
|
||||
item.insert("doJumpId",w->Number());
|
||||
item.insert("frame",w->Frame());
|
||||
item.insert("params",params);
|
||||
item.insert("type","SimpleItem");
|
||||
|
||||
//这里有问题
|
||||
items.append(item);
|
||||
}
|
||||
|
||||
if(w->Number() == 1)
|
||||
{
|
||||
plannedHomePosition.append(w->Coord().Lat());
|
||||
plannedHomePosition.append(w->Coord().Lng());
|
||||
plannedHomePosition.append(w->Alt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {//逐渐往下增加
|
||||
@@ -1511,9 +1575,16 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数
|
||||
|
||||
//可能有点问题
|
||||
QJsonObject item;
|
||||
item.insert("AMSLAltAboveTerrain",0);
|
||||
item.insert("Altitude",w->Alt());
|
||||
item.insert("AltitudeMode",1);
|
||||
|
||||
//如果这个点是指令,那么不会有高度信息
|
||||
|
||||
if(w->Command() < MAV_CMD::MAV_CMD_NAV_LAST) {
|
||||
|
||||
item.insert("AMSLAltAboveTerrain",w->Alt());
|
||||
item.insert("Altitude",w->Alt());
|
||||
item.insert("AltitudeMode",2);
|
||||
}
|
||||
|
||||
item.insert("autoContinue",w->AutoContinue()?true:false);
|
||||
item.insert("command",w->Command());
|
||||
item.insert("doJumpId",w->Number());
|
||||
@@ -1534,17 +1605,17 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
mission.insert("cruiseSpeed",2);
|
||||
mission.insert("firmwareType",2);
|
||||
mission.insert("firmwareType",0);
|
||||
mission.insert("hoverSpeed",2);
|
||||
mission.insert("items",items);
|
||||
mission.insert("plannedHomePosition",plannedHomePosition);
|
||||
mission.insert("vehicleType",20);
|
||||
mission.insert("vehicleType",1);
|
||||
mission.insert("version",2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user