其他分享
首页 > 其他分享> > qdebug dump struct 转载

qdebug dump struct 转载

作者:互联网

链接处代码段,实测有效
https://blog.51cto.com/u_15246509/2844770

#include <QDebug>
typedef  struct KalmanInfo_t{
        qreal filterValue;  //k-1时刻的滤波值,即是k-1时刻的值
        qreal kalmanGain;   //   Kalamn增益
        qreal A;   // x(n)=A*x(n-1)+u(n),u(n)~N(0,Q)
        qreal H;   // z(n)=H*x(n)+w(n),w(n)~N(0,R)
        qreal Q;   //预测过程噪声偏差的方差
        qreal R;   //测量噪声偏差,(系统搭建好以后,通过测量统计实验获得)
        qreal P;   //估计误差协方差

        friend QDebug operator <<(QDebug out,  KalmanInfo_t *info)
        {
            out << "struct KalmanInfo ["
                << "kalmanGain" <<info->kalmanGain
                << "filterValue" <<info->filterValue
                << "A" << info->A
                << "H" << info->H
                << "Q" << info->Q
                << "R" << info->R
                << "P" << info->P
                << "]";
            return out;
        }
    }  KalmanInfo;

//----------------------------------------------------------------
qDebug()<<"kalmanfilter : "<<kinfo<<endl;
qdebug resault:
kalmanfilter :  struct KalmanInfo [ kalmanGain 0.146107 filterValue -1.60787 A 1 H 1 Q 1e-07 R 4e-06 P 5.84429e-07 ]

标签:偏差,filterValue,struct,dump,噪声,qreal,qdebug,kalmanGain
来源: https://blog.csdn.net/chenmeiceng/article/details/122529667