从参数读取舵机参数状态
This commit is contained in:
@@ -142,6 +142,98 @@ void GlobalSetting::getServo(void)
|
||||
}
|
||||
|
||||
|
||||
void GlobalSetting::ServoParameter(QString type,QVariant data)
|
||||
{
|
||||
|
||||
Config *cfg = new Config();
|
||||
|
||||
QVariant dir_la;
|
||||
QVariant dir_ra;
|
||||
QVariant dir_le;
|
||||
QVariant dir_re;
|
||||
QVariant dir_ru;
|
||||
|
||||
QVariant max_la;
|
||||
QVariant max_ra;
|
||||
QVariant max_le;
|
||||
QVariant max_re;
|
||||
QVariant max_ru;
|
||||
|
||||
QVariant scale_la;
|
||||
QVariant scale_ra;
|
||||
QVariant scale_le;
|
||||
QVariant scale_re;
|
||||
QVariant scale_ru;
|
||||
|
||||
QVariant bias_la;
|
||||
QVariant bias_ra;
|
||||
QVariant bias_le;
|
||||
QVariant bias_re;
|
||||
QVariant bias_ru;
|
||||
|
||||
cfg->getServoOffset(&dir_la,&dir_ra,&dir_le,&dir_re,&dir_ru,
|
||||
&max_la,&max_ra,&max_le,&max_re,&max_ru,
|
||||
&scale_la,&scale_ra,&scale_le,&scale_re,&scale_ru,
|
||||
&bias_la,&bias_ra,&bias_le,&bias_re,&bias_ru);
|
||||
|
||||
dir_la = 1;
|
||||
dir_ra = 1;
|
||||
dir_le = 1;
|
||||
dir_re = 1;
|
||||
dir_ru = 1;
|
||||
|
||||
|
||||
if(type == "dal0")
|
||||
{
|
||||
bias_la = data;
|
||||
}
|
||||
else if(type == "dar0")
|
||||
{
|
||||
bias_ra = data;
|
||||
}
|
||||
else if(type == "del0")
|
||||
{
|
||||
bias_le = data;
|
||||
}
|
||||
else if(type == "der0")
|
||||
{
|
||||
bias_re = data;
|
||||
}
|
||||
else if(type == "dr0")
|
||||
{
|
||||
bias_ru = data;
|
||||
}
|
||||
else if(type == "k_dal")
|
||||
{
|
||||
scale_la = data;
|
||||
}
|
||||
else if(type == "k_dar")
|
||||
{
|
||||
scale_ra = data;
|
||||
}
|
||||
else if(type == "k_del")
|
||||
{
|
||||
scale_le = data;
|
||||
}
|
||||
else if(type == "k_der")
|
||||
{
|
||||
scale_re = data;
|
||||
}
|
||||
else if(type == "k_dr")
|
||||
{
|
||||
scale_ru = data;
|
||||
}
|
||||
|
||||
cfg->setServoOffset(dir_la,dir_ra,dir_le,dir_re,dir_ru,
|
||||
max_la,max_ra,max_le,max_re,max_ru,
|
||||
scale_la,scale_ra,scale_le,scale_re,scale_ru,
|
||||
bias_la,bias_ra,bias_le,bias_re,bias_ru);
|
||||
|
||||
on_pushButton_getServoOffset_clicked();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GlobalSetting::on_pushButton_getServoOffset_clicked()
|
||||
{
|
||||
Config *cfg = new Config();
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
public slots:
|
||||
void MapTypes(QStringList list);
|
||||
|
||||
void ServoParameter(QString type,QVariant data);
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="6" column="4">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bias_re">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -78,6 +81,9 @@
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bias_le">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -88,6 +94,9 @@
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bias_ra">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -119,6 +128,9 @@
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bias_ru">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -174,6 +186,9 @@
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_bias_la">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -253,6 +268,9 @@
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_scale_la">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -266,6 +284,9 @@
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_scale_ra">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -279,6 +300,9 @@
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_scale_le">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -292,6 +316,9 @@
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_scale_re">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
@@ -305,6 +332,9 @@
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_scale_ru">
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-9999999.000000000000000</double>
|
||||
</property>
|
||||
|
||||
@@ -205,25 +205,20 @@ void ParameterInspector::appendParameter(mavlink_message_t msg)
|
||||
{
|
||||
emit HILMode(param_Value(param_value).toString());
|
||||
}
|
||||
|
||||
|
||||
//找到所有舵机参数,并发送出去
|
||||
else if((param_id(param_value.param_id) == "dal0") ||
|
||||
(param_id(param_value.param_id) == "dar0") ||
|
||||
(param_id(param_value.param_id) == "del0") ||
|
||||
(param_id(param_value.param_id) == "der0") ||
|
||||
(param_id(param_value.param_id) == "dr0") ||
|
||||
(param_id(param_value.param_id) == "k_dal")||
|
||||
(param_id(param_value.param_id) == "k_dar")||
|
||||
(param_id(param_value.param_id) == "k_del")||
|
||||
(param_id(param_value.param_id) == "k_der")||
|
||||
(param_id(param_value.param_id) == "k_dr"))
|
||||
{
|
||||
/*
|
||||
* del0 der0 dr0 dal0 dar0
|
||||
* k_dal k_dar k_del k_der k_dr
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
emit ServoParameter(param_id(param_value.param_id),param_Value(param_value));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
isReflush = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ signals:
|
||||
void APversion(QString);
|
||||
void HILMode(QString);
|
||||
|
||||
void ServoParameter(int type,int index, QVariant data);//
|
||||
void ServoParameter(QString type,QVariant data);//
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ Setting::Setting(QWidget *parent) :
|
||||
CurrentIndex = 0;
|
||||
emit IndexChanged(CurrentIndex);
|
||||
|
||||
|
||||
connect(index1->paramInspect,&ParameterInspector::ServoParameter,
|
||||
index0->globalsetting,&GlobalSetting::ServoParameter);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Setting::~Setting()
|
||||
|
||||
@@ -28,9 +28,9 @@ StatusUI::StatusUI(QWidget *parent) :
|
||||
ui->groupBox_Warn->hide();
|
||||
*/
|
||||
|
||||
ui->label_VerticalMode->hide();
|
||||
ui->label_HorizonMode->hide();
|
||||
ui->label_navMode->hide();
|
||||
//ui->label_VerticalMode->hide();
|
||||
//ui->label_HorizonMode->hide();
|
||||
//ui->label_navMode->hide();
|
||||
|
||||
int w = 150;
|
||||
int h = 20;
|
||||
|
||||
@@ -147,6 +147,14 @@ PowerSystem::~PowerSystem()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PowerSystem::updateUI()
|
||||
{
|
||||
ScopeRPM->setGeometry(0,0,ui->frame_RPM->width(),ui->frame_RPM->height());
|
||||
ScopeTemp->setGeometry(0,0,ui->frame_Temp->width(),ui->frame_Temp->height());
|
||||
ScopeAlt->setGeometry(0,0,ui->frame_Alt->width(),ui->frame_Alt->height());
|
||||
ScopeMa->setGeometry(0,0,ui->frame_Ma->width(),ui->frame_Ma->height());
|
||||
}
|
||||
|
||||
void PowerSystem::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
qDebug() << "resize event";
|
||||
@@ -198,6 +206,7 @@ void PowerSystem::setFloat(void)
|
||||
this->move((screen->availableGeometry().width()-this->width())/2,(screen->availableGeometry().height()-this->height())/2);
|
||||
this->show();
|
||||
this->resize(m_parent->size());
|
||||
updateUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,7 +216,7 @@ void PowerSystem::setFloat(void)
|
||||
this->show();
|
||||
this->resize(m_parent->size());
|
||||
//qDebug() << m_parent->children();
|
||||
|
||||
updateUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
|
||||
void setFuel(QVariant press,QVariant value);
|
||||
|
||||
void updateUI();
|
||||
|
||||
private:
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
@@ -106,6 +106,9 @@ Senser::Senser(QWidget *parent) :
|
||||
this,&Senser::chartSelect);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//StringModel = new QStringListModel(ui->listView_Data);
|
||||
|
||||
ItemModel = new QStandardItemModel(ui->listView_Data);
|
||||
@@ -286,10 +289,21 @@ void Senser::setValue(QLabel *w,QString s)
|
||||
w->setText(s);
|
||||
}
|
||||
|
||||
void Senser::updateUI()
|
||||
{
|
||||
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());
|
||||
|
||||
servoChart->setGeometry(0,0,ui->frame_Servo->width(),ui->frame_Servo->height());
|
||||
altChart->setGeometry(0,0,ui->frame_Altitude->width(),ui->frame_Altitude->height());
|
||||
speedChart->setGeometry(0,0,ui->frame_Speed->width(),ui->frame_Speed->height());
|
||||
}
|
||||
|
||||
void Senser::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
//attChart->resizeEvent(event);
|
||||
|
||||
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());
|
||||
@@ -314,6 +328,7 @@ void Senser::setFloat(void)
|
||||
this->move((screen->availableGeometry().width()-this->width())/2,(screen->availableGeometry().height()-this->height())/2);
|
||||
this->show();
|
||||
this->resize(m_parent->size());
|
||||
updateUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -321,7 +336,7 @@ void Senser::setFloat(void)
|
||||
this->move(0,0);
|
||||
this->show();
|
||||
this->resize(m_parent->size());
|
||||
|
||||
updateUI();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -758,5 +773,41 @@ void Senser::setINSState(int source,int pos,state value)
|
||||
}
|
||||
}
|
||||
|
||||
//设置曲线
|
||||
|
||||
/*
|
||||
*
|
||||
attChart->setOperation(false);
|
||||
角度
|
||||
|
||||
gyroChart->setOperation(false);
|
||||
角速度
|
||||
|
||||
accChart->setOperation(false);
|
||||
加速度
|
||||
|
||||
servoChart->setOperation(false);
|
||||
舵机指令和反馈
|
||||
|
||||
altChart->setOperation(false);
|
||||
海拔
|
||||
|
||||
speedChart->setOperation(false);
|
||||
速度
|
||||
|
||||
|
||||
ScopeRPM->setSerieData(tr("物理"),t->RPM_mea);
|
||||
ScopeRPM->setSerieData(tr("期望"),t->RPM_des);
|
||||
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
|
||||
void setINSState(int source,int pos,state value);
|
||||
|
||||
void updateUI();
|
||||
|
||||
Chart *attChart = nullptr;
|
||||
Chart *gyroChart = nullptr;
|
||||
Chart *accChart = nullptr;
|
||||
|
||||
@@ -342,11 +342,13 @@ void ServoSystem::setServoState(mavlink_servo_output_raw_t *t)
|
||||
void ServoSystem::setAPversion(QString ver)
|
||||
{
|
||||
ui->label_APVer->setText(ver);
|
||||
emit showMessage(tr("飞控软件版本信息:%1").arg(ver));
|
||||
}
|
||||
|
||||
void ServoSystem::setHILMode(QString mode)
|
||||
{
|
||||
ui->label_HILMode->setText(mode);
|
||||
emit showMessage((mode>0)?("进入HIL仿真"):("退出HIL仿真"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -262,11 +262,13 @@ void ToolsUI::onTabIndexChanged(const int &index)//界面选择管理
|
||||
if(powersystem->parent())
|
||||
{
|
||||
powersystem->show();
|
||||
powersystem->updateUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
powersystem->showNormal();
|
||||
powersystem->activateWindow();
|
||||
powersystem->updateUI();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -333,11 +335,13 @@ void ToolsUI::onTabIndexChanged(const int &index)//界面选择管理
|
||||
if(senser->parent())
|
||||
{
|
||||
senser->show();
|
||||
senser->updateUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
senser->showNormal();
|
||||
senser->activateWindow();
|
||||
senser->updateUI();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -598,6 +602,7 @@ void ToolsUI::on_pushButton_ShowExtern_clicked()
|
||||
break;
|
||||
case 9:
|
||||
senser->setFloat();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1505,9 +1505,6 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数
|
||||
|
||||
WayPointItem *w = i.value();
|
||||
|
||||
qDebug() << w->Number();
|
||||
|
||||
|
||||
if (w) {//逐渐往下增加
|
||||
if(w->Number()>0)
|
||||
{
|
||||
@@ -1713,12 +1710,12 @@ void OPMapWidget::WPUpload(void)
|
||||
|
||||
if(list.size() <= 0)
|
||||
{
|
||||
emit showMessage(tr("please create a plan"));
|
||||
emit showMessage("请先载入任务航线");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
emit showMessage(tr("start to send mossion %1").arg(list.size()));
|
||||
emit showMessage(tr("开始上传航点,总数%1").arg(list.size()));
|
||||
|
||||
//选择当前ID号
|
||||
|
||||
@@ -1747,14 +1744,16 @@ void OPMapWidget::WPUpload(void)
|
||||
{
|
||||
QString str;
|
||||
|
||||
str.append(tr("send way point %1").arg(seq));
|
||||
//str.append(tr("send way point %1").arg(seq));
|
||||
str.append("上传航点");
|
||||
str.append(QString::number(seq));
|
||||
emit showMessage(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString str;
|
||||
|
||||
str.append(tr("fail to send %1").arg(seq));
|
||||
str.append(tr("上传失败%1").arg(seq));
|
||||
emit showMessage(str);
|
||||
}
|
||||
|
||||
@@ -1838,8 +1837,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
// << QThread::currentThreadId();
|
||||
|
||||
|
||||
emit showMessage(tr("recieve way point %1").arg(seq + 1));
|
||||
|
||||
//emit showMessage(tr("recieve way point %1").arg(seq + 1));
|
||||
emit showMessage(tr("收到航点 %1").arg(seq + 1));
|
||||
|
||||
|
||||
//qDebug() << "receivers Point" << x * 10e-8 << y * 10e-8 << 10e-8;
|
||||
|
||||
Reference in New Issue
Block a user