增加变体舵机信息
This commit is contained in:
@@ -184,6 +184,16 @@ StatusUI::StatusUI(QWidget *parent) :
|
|||||||
{2,StateWidget::state::red},
|
{2,StateWidget::state::red},
|
||||||
{5,StateWidget::state::orange},
|
{5,StateWidget::state::orange},
|
||||||
{15,StateWidget::state::green}});
|
{15,StateWidget::state::green}});
|
||||||
|
install(battery, 0, "左变体电流[A]", 0, QMap<QVariant, StateWidget::state>{{0,StateWidget::state::green},
|
||||||
|
{5,StateWidget::state::orange},
|
||||||
|
{10,StateWidget::state::red}});
|
||||||
|
|
||||||
|
install(battery, 0, "右变体电流[A]", 0, QMap<QVariant, StateWidget::state>{{0,StateWidget::state::green},
|
||||||
|
{5,StateWidget::state::orange},
|
||||||
|
{10,StateWidget::state::red}});
|
||||||
|
install(battery, 0, "左变体转动方向", 0);
|
||||||
|
install(battery, 0, "右变体转动方向", 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
install(battery,0,"左轮速[RPM]",0,
|
install(battery,0,"左轮速[RPM]",0,
|
||||||
QMap<QVariant, StateWidget::state>{{1,StateWidget::state::red},
|
QMap<QVariant, StateWidget::state>{{1,StateWidget::state::red},
|
||||||
|
|||||||
@@ -915,8 +915,34 @@ void Parse::run()
|
|||||||
group.left_brake = data[data_count++];
|
group.left_brake = data[data_count++];
|
||||||
group.right_brake = data[data_count++];
|
group.right_brake = data[data_count++];
|
||||||
|
|
||||||
|
//变体舵机电流、方向
|
||||||
|
Variant var;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
char ch1;
|
||||||
|
char ch2;
|
||||||
|
int t;
|
||||||
|
} test;
|
||||||
|
|
||||||
|
data = raw.mid(247);
|
||||||
|
test.ch1 = data[0];
|
||||||
|
test.ch2 = data[1];
|
||||||
|
|
||||||
|
var.l_var_current = test.t * 0.1;
|
||||||
|
|
||||||
|
test.ch1 = data[2];
|
||||||
|
test.ch2 = data[3];
|
||||||
|
|
||||||
|
var.r_var_current = test.t * 0.1;
|
||||||
|
|
||||||
|
var.l_var_dir = data[4];
|
||||||
|
var.r_var_dir = data[5];
|
||||||
|
|
||||||
|
|
||||||
saveActuatorDataToFile(group);
|
saveActuatorDataToFile(group);
|
||||||
emit actuator_info_brake(group);
|
emit actuator_info_brake(group);
|
||||||
|
emit variantInfo(var);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,14 @@
|
|||||||
#include "QDateTime"
|
#include "QDateTime"
|
||||||
#include "QDataStream"
|
#include "QDataStream"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float l_var_current; //左变体电流
|
||||||
|
float r_var_current; //右变体电流
|
||||||
|
quint8 l_var_dir; //左变体方向
|
||||||
|
quint8 r_var_dir; //右变体方向
|
||||||
|
} Variant;
|
||||||
|
|
||||||
class Parse : public QObject, public QRunnable
|
class Parse : public QObject, public QRunnable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -533,6 +541,11 @@ signals:
|
|||||||
void pos_info(Parse::_pos info);
|
void pos_info(Parse::_pos info);
|
||||||
|
|
||||||
void SSPC_Info_state(Parse::_sspc info);
|
void SSPC_Info_state(Parse::_sspc info);
|
||||||
|
/**
|
||||||
|
* @brief 变体舵机信息
|
||||||
|
* @param info
|
||||||
|
*/
|
||||||
|
void variantInfo(Variant const &info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -227,6 +227,8 @@ void ToolsUI::recieveDataSlot(const int &id, const QByteArray &data)
|
|||||||
|
|
||||||
if(id == 0)
|
if(id == 0)
|
||||||
{
|
{
|
||||||
|
connect(parse, SIGNAL(variantInfo(Variant) ) , this, SIGNAL(variantInfo(Variant) ) );
|
||||||
|
|
||||||
connect(parse,&Parse::INS_Info,
|
connect(parse,&Parse::INS_Info,
|
||||||
ins,&INS::INS_Info);
|
ins,&INS::INS_Info);
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,12 @@ private slots:
|
|||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief 变体舵机信息
|
||||||
|
* @param info
|
||||||
|
*/
|
||||||
|
void variantInfo(Variant const &info);
|
||||||
|
|
||||||
void IndexChanged(const int &index);
|
void IndexChanged(const int &index);
|
||||||
|
|
||||||
void recieveData(const int &id,const QByteArray &data);
|
void recieveData(const int &id,const QByteArray &data);
|
||||||
|
|||||||
@@ -214,11 +214,14 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
toolsui = new ToolsUI(this);
|
toolsui = new ToolsUI(this);
|
||||||
toolsui->hide();
|
toolsui->hide();
|
||||||
|
|
||||||
|
connect(toolsui, &ToolsUI::variantInfo, this, &MainWindow::showVariantInfo);
|
||||||
|
|
||||||
//状态
|
//状态
|
||||||
|
|
||||||
statusui = new StatusUI(this);
|
statusui = new StatusUI(this);
|
||||||
statusui->hide();
|
statusui->hide();
|
||||||
|
|
||||||
|
|
||||||
healthui = new HealthUI(this);
|
healthui = new HealthUI(this);
|
||||||
healthui->hide();
|
healthui->hide();
|
||||||
|
|
||||||
@@ -869,6 +872,14 @@ MainWindow::~MainWindow()
|
|||||||
QCoreApplication::quit();//退出所有窗口
|
QCoreApplication::quit();//退出所有窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showVariantInfo(const Variant &var)
|
||||||
|
{
|
||||||
|
statusui->setValue(1, 0, 12, QString::number(var.l_var_current, 'f', 1));
|
||||||
|
statusui->setValue(1, 0, 13, QString::number(var.r_var_current, 'f', 1));
|
||||||
|
statusui->setValue(1, 0, 14, var.l_var_dir ? "反转" : "正转");
|
||||||
|
statusui->setValue(1, 0, 15, var.r_var_dir ? "反转" : "正转");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::setBeep(QVariant state)
|
void MainWindow::setBeep(QVariant state)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
/**
|
||||||
|
* @brief 显示变体舵机信息
|
||||||
|
* @param var
|
||||||
|
*/
|
||||||
|
void showVariantInfo(Variant const &var);
|
||||||
void showMessage(const QString &message,int TimeOut = 0);
|
void showMessage(const QString &message,int TimeOut = 0);
|
||||||
|
|
||||||
void setCommunicationLostState(bool flag);
|
void setCommunicationLostState(bool flag);
|
||||||
|
|||||||
Reference in New Issue
Block a user