添加copk的连接、
This commit is contained in:
+12
-65
@@ -13,71 +13,18 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>340</y>
|
||||
<width>151</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>151</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>260</y>
|
||||
<width>151</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<width>151</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>180</y>
|
||||
<width>151</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Seft Test</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -21,6 +21,20 @@
|
||||
"param6": 6,
|
||||
"param7": 7
|
||||
},
|
||||
{
|
||||
"Text" : "vvvv",
|
||||
"row": 0,
|
||||
"column": 2,
|
||||
"command": 1,
|
||||
"confirm": 0,
|
||||
"param1": 7,
|
||||
"param2": 6,
|
||||
"param3": 5,
|
||||
"param4": 4,
|
||||
"param5": 3,
|
||||
"param6": 2,
|
||||
"param7": 1
|
||||
},
|
||||
{
|
||||
"Text" : "降落",
|
||||
"row": 0,
|
||||
|
||||
@@ -34,32 +34,6 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>80</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>200</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
+21
-11
@@ -193,7 +193,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
|
||||
//刷新ui,以保证界面不卡
|
||||
QTimer::singleShot(200,this,&MainWindow::updateUI);
|
||||
//QTimer::singleShot(200,this,&MainWindow::updateUI);
|
||||
|
||||
qDebug() << "main window start";
|
||||
|
||||
@@ -551,21 +551,31 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
dlink->mavlinknode->vehicle.attitude.roll * 57.3,
|
||||
dlink->mavlinknode->vehicle.attitude.yaw * 57.3);
|
||||
|
||||
//copk->setAltitude(dlink->mavlinknode->vehicle.gps_raw_int.alt * 10e-4 );
|
||||
//copk->setAirSpeed(dlink->mavlinknode->vehicle.airspeed_autocal.vx);
|
||||
copk->setAltitude(dlink->mavlinknode->vehicle.gps_raw_int.alt * 10e-4 );
|
||||
|
||||
copk->setAirSpeed(dlink->mavlinknode->vehicle.global_position_int.vx,2);
|
||||
|
||||
copk->setVerticalSpeed(-dlink->mavlinknode->vehicle.global_position_int.vz);
|
||||
|
||||
//copk->setAOA(dlink->mavlinknode->vehicle.);
|
||||
|
||||
|
||||
internals::PointLatLng LatLng;
|
||||
LatLng.SetLat((double)(dlink->mavlinknode->vehicle.gps_raw_int.lat * 10e-8));
|
||||
LatLng.SetLng((double)(dlink->mavlinknode->vehicle.gps_raw_int.lon * 10e-8));
|
||||
|
||||
//map->UAV->SetUAVPos(LatLng,dlink->mavlinknode->vehicle.gps_raw_int.alt * 10e-4);
|
||||
//qDebug() << LatLng.Lat()
|
||||
// << LatLng.Lng();
|
||||
copk->setAlt_err(dlink->mavlinknode->vehicle.nav_controller_output.alt_error);
|
||||
copk->setWP_dist(dlink->mavlinknode->vehicle.nav_controller_output.wp_dist);
|
||||
|
||||
|
||||
|
||||
//map->UAV->SetUAVHeading(dlink->mavlinknode->vehicle.attitude.yaw * 57.3);
|
||||
|
||||
map->setUAVPos(dlink->mavlinknode->vehicle.sysid,
|
||||
dlink->mavlinknode->vehicle.compid,
|
||||
(double)(dlink->mavlinknode->vehicle.gps_raw_int.lat * 10e-8),
|
||||
(double)(dlink->mavlinknode->vehicle.gps_raw_int.lon * 10e-8),
|
||||
(double)(dlink->mavlinknode->vehicle.gps_raw_int.alt * 10e-4));
|
||||
|
||||
map->setUAVHeading(dlink->mavlinknode->vehicle.sysid,
|
||||
dlink->mavlinknode->vehicle.compid,
|
||||
dlink->mavlinknode->vehicle.attitude.yaw * 57.3);
|
||||
|
||||
|
||||
|
||||
update();
|
||||
|
||||
+28
-6
@@ -317,6 +317,7 @@ void Cockpit::setAirSpeed(double speed,uint8_t flag)
|
||||
m_State.AirspeedFlag = flag;
|
||||
|
||||
if(speed < 0) speed = 0;
|
||||
else if(speed > 999) speed = 999;
|
||||
m_State.airspeed = speed;
|
||||
m_State.isUpdate = true;
|
||||
}
|
||||
@@ -326,10 +327,15 @@ void Cockpit::setAirSpeedTarget(double speed, uint8_t flag)
|
||||
Q_UNUSED(flag)
|
||||
|
||||
if(speed < 0) speed = 0;
|
||||
else if(speed > 999) speed = 999;
|
||||
|
||||
m_Target.airspeed = speed;
|
||||
m_Target.isUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Cockpit::setVerticalSpeed(double speed)
|
||||
{
|
||||
m_State.verticalspeed = speed;
|
||||
@@ -342,7 +348,23 @@ void Cockpit::setVerticalSpeedTarget(double speed)
|
||||
m_Target.isUpdate = true;
|
||||
}
|
||||
|
||||
void Cockpit::setWP_dist(double value)
|
||||
{
|
||||
if(value > 9999) value = 9999;
|
||||
else if(value < (-9999)) value = -9999;
|
||||
|
||||
m_State.wp_dist = value;
|
||||
m_State.isUpdate = true;
|
||||
}
|
||||
|
||||
void Cockpit::setAlt_err(double value)
|
||||
{
|
||||
if(value > 9999) value = 9999;
|
||||
else if(value < (-9999)) value = -9999;
|
||||
|
||||
m_State.alt_err = value;
|
||||
m_State.isUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
void Cockpit::setGPS(QString str)
|
||||
@@ -1627,13 +1649,13 @@ void Cockpit::drawYawScale(QPainter *painter)
|
||||
|
||||
//画竖条
|
||||
painter->save();
|
||||
if(abs(m_State.distofly) >= 10)//大于10,对数显示
|
||||
if(abs(m_State.wp_dist) >= 10)//大于10,对数显示
|
||||
{
|
||||
painter->translate(((m_State.distofly >= 0)?(1.0):(-1.0))*log10(abs(m_State.distofly)) * 100,0);
|
||||
painter->translate(((m_State.wp_dist >= 0)?(1.0):(-1.0))*log10(abs(m_State.wp_dist)) * 100,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->translate(m_State.distofly * 10.0,0);//小于10,线性 显示
|
||||
painter->translate(m_State.wp_dist * 10.0,0);//小于10,线性 显示
|
||||
}
|
||||
|
||||
ePen.setWidth(8);
|
||||
@@ -1644,13 +1666,13 @@ void Cockpit::drawYawScale(QPainter *painter)
|
||||
|
||||
|
||||
painter->save();//画横条开始
|
||||
if(abs(m_State.distofly) >= 10)//大于10,对数显示
|
||||
if(abs(m_State.alt_err) >= 10)//大于10,对数显示
|
||||
{
|
||||
painter->translate(0,((m_State.distofly >= 0)?(1.0):(-1.0))*log10(abs(m_State.distofly)) * 100);
|
||||
painter->translate(0,((m_State.alt_err >= 0)?(1.0):(-1.0))*log10(abs(m_State.alt_err)) * 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->translate(0,m_State.distofly * 10.0);//小于10,线性 显示
|
||||
painter->translate(0,m_State.alt_err * 10.0);//小于10,线性 显示
|
||||
}
|
||||
ePen.setWidth(8);
|
||||
ePen.setColor(m_Color.TargetColor);
|
||||
|
||||
+9
-1
@@ -75,7 +75,10 @@ typedef struct {
|
||||
|
||||
|
||||
|
||||
qreal distofly;
|
||||
qreal wp_dist;
|
||||
qreal alt_err;
|
||||
|
||||
|
||||
|
||||
quint8 AirspeedFlag;
|
||||
|
||||
@@ -161,6 +164,11 @@ public Q_SLOTS:
|
||||
void setMode(QString str);
|
||||
void setState(QString str);
|
||||
void setAOA(qreal Value);
|
||||
|
||||
|
||||
void setWP_dist(double value);
|
||||
void setAlt_err(double value);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,12 @@ MAVLinkInspector::MAVLinkInspector(const QString& title, QAction* action,QWidget
|
||||
header << tr("Type");
|
||||
ui->treeWidget->setHeaderLabels(header);
|
||||
|
||||
ui->treeWidget->header()->setStretchLastSection(true);
|
||||
|
||||
//ui->treeWidget->header()->resizeSection();
|
||||
|
||||
|
||||
|
||||
// Connect the UI
|
||||
connect(ui->systemComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &MAVLinkInspector::selectDropDownMenuSystem);
|
||||
|
||||
@@ -17,6 +17,7 @@ ParameterInspector::ParameterInspector(QWidget *parent) :
|
||||
QStringList header;
|
||||
header << tr("Name");
|
||||
header << tr("Value");
|
||||
header << tr("Type");
|
||||
ui->treeWidget->setHeaderLabels(header);
|
||||
|
||||
|
||||
@@ -118,9 +119,6 @@ void ParameterInspector::appendParameter(mavlink_message_t msg)
|
||||
|
||||
currentpersent = param_value.param_index;
|
||||
|
||||
|
||||
//qDebug() << QThread::currentThreadId();
|
||||
|
||||
//检查是否包含了该参数,如果没有,那么添加
|
||||
QMap<int, mavlink_param_value_t> ParameterStorage;
|
||||
ParameterStorage = vehicles.value(msg.sysid);
|
||||
@@ -132,6 +130,7 @@ void ParameterInspector::appendParameter(mavlink_message_t msg)
|
||||
|
||||
isReflush = true;
|
||||
}
|
||||
|
||||
void ParameterInspector::refreshView()//来一个参数更新一次
|
||||
{
|
||||
QMap<int,QMap<int,mavlink_param_value_t>>::iterator ite;
|
||||
@@ -151,7 +150,7 @@ void ParameterInspector::refreshView()//来一个参数更新一次
|
||||
mavlink_param_value_t param = param_ite.value();//每一个value
|
||||
QString paraName = param_id(param.param_id); //得到名称
|
||||
|
||||
qDebug() << paraName;//ok
|
||||
//qDebug() << paraName;//ok
|
||||
|
||||
//查找这个value是不是已经存,存在更新,不存在则建立
|
||||
bool paramFound = false;
|
||||
@@ -173,6 +172,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(2,Qt::DisplayRole,param.param_type);
|
||||
widgetitems.insert(param.param_index,paraItem);
|
||||
}
|
||||
}
|
||||
@@ -249,14 +249,6 @@ void ParameterInspector::clearview(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QVariant ParameterInspector::param_value(mavlink_param_value_t param)
|
||||
{
|
||||
QVariant value;
|
||||
@@ -306,7 +298,7 @@ QVariant ParameterInspector::param_value(mavlink_param_value_t param)
|
||||
default:
|
||||
{
|
||||
value = ((int32_t *)¶m.param_value)[0];
|
||||
qDebug() << "Unsupported type " << param.param_type;
|
||||
//qDebug() << "Unsupported type " << param.param_type;
|
||||
}break;
|
||||
|
||||
}
|
||||
@@ -348,13 +340,12 @@ void ParameterInspector::on_ReadButton_clicked()
|
||||
|
||||
void ParameterInspector::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
|
||||
ui->SearchlineEdit->setText(item->data(0,Qt::DisplayRole).toString());
|
||||
|
||||
//根据type 设置这个value
|
||||
|
||||
ui->ValuelineEdit->setText(item->data(1,Qt::DisplayRole).toString());
|
||||
|
||||
if(item->parent())//不是根节点才可以把数据写入框内
|
||||
{
|
||||
ui->SearchlineEdit->setText(item->data(0,Qt::DisplayRole).toString());
|
||||
parentItem = item->parent()->data(0,Qt::DisplayRole).toString();
|
||||
ui->ValuelineEdit->setText(QString::number(item->data(1,Qt::DisplayRole).toFloat()));
|
||||
}
|
||||
}
|
||||
|
||||
void ParameterInspector::on_clearButton_clicked()
|
||||
@@ -365,5 +356,63 @@ void ParameterInspector::on_clearButton_clicked()
|
||||
|
||||
void ParameterInspector::on_WriteButton_clicked()
|
||||
{
|
||||
//读取是哪设备,是哪个参数,然后发送出去
|
||||
QString parentid = parentItem.mid(8);
|
||||
uint8_t sysid = parentid.toInt();
|
||||
|
||||
char *id = ui->SearchlineEdit->text().toLatin1().data();
|
||||
|
||||
ui->treeWidget->takeTopLevelItem(0);
|
||||
|
||||
/*
|
||||
foreach (QTreeWidgetItem* Item, uasTopLevelItems.values()) {
|
||||
if(Item->data(0,Qt::DisplayRole) == parentItem)
|
||||
{
|
||||
QList<QTreeWidgetItem *> Itemlist = Item->takeChildren();
|
||||
|
||||
foreach (QTreeWidgetItem* item, Itemlist)
|
||||
{
|
||||
//if(Item->data(0,Qt::DisplayRole).toString() == ui->SearchlineEdit->text())
|
||||
{
|
||||
qDebug() << item->data(0,Qt::DisplayRole)
|
||||
<< item->data(1,Qt::DisplayRole)
|
||||
<< item->data(2,Qt::DisplayRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
//qDebug() << id << ui->SearchlineEdit->text().toLatin1();
|
||||
|
||||
uint8_t type = 9;
|
||||
float value = ui->ValuelineEdit->text().toFloat();
|
||||
|
||||
|
||||
|
||||
//emit WriteCmd(sysid,1,id,type,value);
|
||||
|
||||
//读取是哪设备,是哪个参数,然后发送出去
|
||||
}
|
||||
|
||||
void ParameterInspector::on_NextpushButton_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ParameterInspector::on_SearchButton_clicked()
|
||||
{
|
||||
QString name = ui->SearchButton->text();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ParameterInspector::on_CancelpushButton_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -113,10 +113,8 @@ public:
|
||||
signals:
|
||||
|
||||
void ReadCmd(uint8_t m_sysid, uint8_t m_compid, uint8_t type);
|
||||
void WriteCmd(uint8_t m_sysid, uint8_t m_compid ,uint32_t count);
|
||||
|
||||
|
||||
|
||||
void WriteCmd(uint8_t m_sysid, uint8_t m_compid , const char *id, uint8_t type, float value);
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -150,9 +148,22 @@ private slots:
|
||||
|
||||
void on_WriteButton_clicked();
|
||||
|
||||
void on_NextpushButton_clicked();
|
||||
|
||||
void on_SearchButton_clicked();
|
||||
|
||||
void on_CancelpushButton_clicked();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
QString parentItem;
|
||||
|
||||
|
||||
//char * S
|
||||
|
||||
|
||||
|
||||
bool TimerRunningFlag = false;
|
||||
bool isReflush = false;
|
||||
uint16_t currentpersent;
|
||||
|
||||
@@ -312,6 +312,9 @@ void MavLinkNode::MAVLinkRcv_Handler(mavlink_message_t msg)
|
||||
//qDebug() << "msg.sysid" <<msg.sysid << "msg.compid" << msg.compid;
|
||||
CheckVehicle(msg.sysid,msg.compid);
|
||||
|
||||
vehicle.sysid = msg.sysid;
|
||||
vehicle.compid = msg.compid;
|
||||
|
||||
switch (msg.msgid) {
|
||||
//状态
|
||||
case MAVLINK_MSG_ID_AUTOPILOT_VERSION:
|
||||
@@ -390,12 +393,9 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
}break;
|
||||
case MAVLINK_MSG_ID_ATTITUDE: {
|
||||
mavlink_msg_attitude_decode(&msg,&vehicle.attitude);
|
||||
emit state_updated();
|
||||
}break;
|
||||
case MAVLINK_MSG_ID_GPS_RAW_INT: {
|
||||
mavlink_msg_gps_raw_int_decode(&msg,&vehicle.gps_raw_int);
|
||||
//qDebug() << vehicle.gps_raw_int.lon
|
||||
// << vehicle.gps_raw_int.lat;
|
||||
}break;
|
||||
case MAVLINK_MSG_ID_GLOBAL_POSITION_INT: {
|
||||
mavlink_msg_global_position_int_decode(&msg,&vehicle.global_position_int);
|
||||
@@ -436,7 +436,7 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
|
||||
}
|
||||
|
||||
|
||||
emit state_updated();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +52,6 @@ class MavLinkNode : public QObject
|
||||
mavlink_vibration_t vibration;
|
||||
mavlink_enginestate_t enginestate;
|
||||
mavlink_vfr_hud_t vfr_hud;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}_vehicle;
|
||||
|
||||
|
||||
@@ -78,6 +73,7 @@ public:
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
void addVehicles(int sysid,int compid);
|
||||
|
||||
void SendMessageTo(quint8 ch, quint8 *data,quint16 len);
|
||||
@@ -89,6 +85,12 @@ signals:
|
||||
|
||||
void setCurrentID(int sysid,int compid);
|
||||
|
||||
|
||||
|
||||
void setAltitude(int sysid,int compid,double roll,double pitch,double yaw);
|
||||
void setPos(int sysid,int compid,double x,double y,double z);
|
||||
void setHeading(int sysid,int compid,double x,double y,double z);
|
||||
|
||||
public slots:
|
||||
//线程对外接口
|
||||
void setRunFrq(uint32_t frq);
|
||||
|
||||
@@ -454,7 +454,7 @@ void MissionProcess::WriteStateMachine(void)
|
||||
i = *items.find(mission_item_int.seq);
|
||||
|
||||
item_int(i.param1,i.param2,i.param3,i.param4,
|
||||
i.x,i.y,i.z,
|
||||
i.x*10,i.y*10,i.z,
|
||||
i.seq,i.command,i.frame,
|
||||
i.current,i.autocontinue,i.mission_type);//发送航点
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ ParameterProcess::ParameterProcess(QObject *parent) : QObject(parent)
|
||||
connect(paramInspect,SIGNAL(ReadCmd(uint8_t,uint8_t,uint8_t)),
|
||||
this,SLOT(ReadCmd(uint8_t,uint8_t,uint8_t)),Qt::DirectConnection);//多线程连接方式
|
||||
|
||||
connect(paramInspect,SIGNAL(WriteCmd(uint8_t,uint8_t,uint32_t)),
|
||||
this,SLOT(WriteCmd(uint8_t,uint8_t,uint32_t)),Qt::DirectConnection);
|
||||
connect(paramInspect,SIGNAL(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),
|
||||
this,SLOT(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),Qt::DirectConnection);
|
||||
|
||||
//隐藏
|
||||
paramInspect->hide();
|
||||
@@ -130,15 +130,20 @@ void ParameterProcess::ReadCmd(uint8_t m_sysid, uint8_t m_compid,uint8_t type)
|
||||
start();//开启线程
|
||||
}
|
||||
|
||||
void ParameterProcess::WriteCmd(uint8_t m_sysid, uint8_t m_compid ,uint32_t count )
|
||||
void ParameterProcess::WriteCmd(uint8_t m_sysid, uint8_t m_compid ,const char *id,uint8_t type,float value)
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
//Q_UNUSED(count);
|
||||
|
||||
sysid = m_sysid;
|
||||
compid = m_compid;
|
||||
//mission_status.transmit.count = count;
|
||||
|
||||
status.m_Mode = TransmitMode;//发送模式
|
||||
|
||||
|
||||
memcpy(param_set.param_id,id,16);
|
||||
param_set.param_type = type;
|
||||
param_set.param_value = value;
|
||||
|
||||
qDebug() << "sysid" << sysid << endl
|
||||
<< "compid" << compid << endl
|
||||
<< "Mode" << status.m_Mode << endl
|
||||
@@ -156,7 +161,7 @@ void ParameterProcess::Parse(mavlink_message_t msg)
|
||||
|
||||
switch (msg.msgid) {
|
||||
case MAVLINK_MSG_ID_PARAM_SET:{
|
||||
mavlink_msg_param_set_decode(&msg,¶m_set);
|
||||
//mavlink_msg_param_set_decode(&msg,¶m_set);
|
||||
}break;
|
||||
case MAVLINK_MSG_ID_PARAM_VALUE:{//
|
||||
mavlink_msg_param_value_decode(&msg,¶m_value);
|
||||
@@ -291,7 +296,7 @@ void ParameterProcess::WriteStateMachine(void)
|
||||
//向其他线程或者自己读取航点的数量
|
||||
status.transmit.isWaitingforValue = true;
|
||||
|
||||
set("id",0,1);//发送一个参数
|
||||
set(param_set.param_id,param_set.param_type,param_set.param_value);//发送一个参数
|
||||
time = QTime::currentTime().msecsSinceStartOfDay();
|
||||
step++;//下一个阶段
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public slots:
|
||||
|
||||
//读取和写入指令
|
||||
void ReadCmd(uint8_t m_sysid, uint8_t m_compid, uint8_t type);
|
||||
void WriteCmd(uint8_t m_sysid, uint8_t m_compid ,uint32_t count);
|
||||
void WriteCmd(uint8_t m_sysid, uint8_t m_compid , const char *id, uint8_t type, float value);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -172,6 +172,42 @@ void OPMapWidget::addUAV(int sysid,int compid)
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::setUAVPos(int sysid,int compid,double x,double y,double z)
|
||||
{
|
||||
//qDebug() << sysid << compid;
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
UAVItem *u = qgraphicsitem_cast<UAVItem *>(i);
|
||||
if (u) {
|
||||
if(u->SysID() == sysid)
|
||||
{
|
||||
internals::PointLatLng LatLng;
|
||||
LatLng.SetLat(x);
|
||||
LatLng.SetLng(y);
|
||||
u->SetUAVPos(LatLng,z);
|
||||
//qDebug() << x << y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::setUAVHeading(int sysid,int compid,float Heading)
|
||||
{
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
UAVItem *u = qgraphicsitem_cast<UAVItem *>(i);
|
||||
if (u) {
|
||||
if(u->SysID() == sysid)
|
||||
{
|
||||
u->SetUAVHeading(Heading);
|
||||
//qDebug() << Heading;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WayPointLine *OPMapWidget::WPLineCreate(WayPointItem *from, WayPointItem *to, QColor color, bool dashed, int width)
|
||||
@@ -445,11 +481,15 @@ void OPMapWidget::WPInsert(const int &position)
|
||||
if((item_old1)&&(item_old2))
|
||||
{
|
||||
WPLineDelete(item_old1,item_old2);
|
||||
WPLineDelete(item_old1,item_old2);
|
||||
WPLineDelete(item_old1,item_old2);
|
||||
}
|
||||
//删除连线
|
||||
if((item_old1)&&(item_old0))
|
||||
{
|
||||
WPLineDelete(item_old0,item_old1);
|
||||
WPLineDelete(item_old0,item_old1);
|
||||
WPLineDelete(item_old0,item_old1);
|
||||
|
||||
internals::PointLatLng latlng1 = item_old0->Coord();
|
||||
internals::PointLatLng latlng2 = item_old1->Coord();
|
||||
|
||||
@@ -419,7 +419,8 @@ public:
|
||||
void setWPCreate(bool const & value);
|
||||
|
||||
|
||||
|
||||
void setUAVPos(int sysid,int compid,double x,double y,double z);
|
||||
void setUAVHeading(int sysid,int compid,float Heading);
|
||||
|
||||
private:
|
||||
internals::Core *core;
|
||||
@@ -560,6 +561,7 @@ public slots:
|
||||
void addUAV(int sysid, int compid);
|
||||
|
||||
|
||||
|
||||
void getMapTypes(void);
|
||||
void setMapTypes(QVariant value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user