Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new assert out of range #9

Open
LucaFibbi opened this issue Mar 30, 2020 · 2 comments
Open

new assert out of range #9

LucaFibbi opened this issue Mar 30, 2020 · 2 comments

Comments

@LucaFibbi
Copy link
Collaborator

Again the program ends with an assert.
The code throw the assert in the function SRIFAlgorithm::changeSRIFPara to the line 207 of the file SRIFAlgorithm.cpp when the program attempts to access beyond the size of the variable tempXk_1

198 VectorXd tempXk_1 = m_Xk;
    m_Xk.resize(epochLenLB+m_const_param);
    m_Xk.setZero();
    //Xk.resize(epochLenLB+5);
    for (int i = 0;i < m_const_param;i++)
        m_Xk(i) = tempXk_1(i);
    for (int i = 0;i<epochLenLB;i++)
    {
        if (oldPrnFlag.at(i)!=-1)//Save the old satellite ambiguity
            m_Xk(m_const_param+i) = tempXk_1(oldPrnFlag.at(i)+m_const_param); // <------ the assert is throw here
        else
        {//New satellite ambiguity calculation
            SatlitData oneStalit = epochSatlitData.at(i);
            m_Xk(m_const_param+i) = (oneStalit.PP3 - oneStalit.LL3)/M_GetLamta3(oneStalit.Frq[0],oneStalit.Frq[1]);
        }
213  }

The local variable tempXk_1 is equal to SRIFAlgorithm::m_Xk variable.
I looked where the size of the variable m_Xk change.
m_Xk is resize with an incorrect size in the function SRIFAlgorithm::SRIFforStatic at line 651.

646 if(gross_LC)
    {
        // restore filter state
        m_Rp = temp_Rp; m_Zp = temp_Zp; m_Phi_Inv = temp_Phi_Inv; m_G = temp_G;
        m_Phi = temp_Phi; m_Rwk = temp_Rwk; m_Q = temp_Q;
        m_Xk = temp_Xk; // <--- Here change the size of m_Xk
        memcpy(m_SPP_Pos, temp_SPP_POS, 3*sizeof(double));
        X.setZero();
        P.setIdentity();
        P = P * 1e10;
656 }

The assert happens when in function SRIFAlgorithm::SRIFforStatic gross_LC = true and epochLenLB - del_len > 5 is false and epochLenLB=6 and del_len=1

600     if(epochLenLB - del_len > 5)
        {
            for(int i = 0; i < del_len;i++)
                currEpoch.remove(del_flag[i]);
            epochLenLB = currEpoch.length();// update epochLenLB

            // restore filter state
            m_Rp = temp_Rp; m_Zp = temp_Zp; m_Phi_Inv = temp_Phi_Inv; m_G = temp_G;
            m_Phi = temp_Phi; m_Rwk = temp_Rwk; m_Q = temp_Q;
            m_Xk = temp_Xk;
            memcpy(m_SPP_Pos, temp_SPP_POS, 3*sizeof(double));
            filter(preEpoch, currEpoch, X, P);
        }
        else
        {
            break;  // <----- when the assert is throw the program pass here
616     }

This in my opinion is the cause of the error.
I don't know how to change the code to correct the error.

I think that the line 600 in the file SRIFAlgorithm.cpp can be changed like this:
if((epochLenLB - del_len) >= 5)
Even with 5 satellites it is possible to calculate the position.

@XiaoGongWei
Copy link
Owner

XiaoGongWei commented Mar 30, 2020

Thanks, I tested a lot of data and didn't find this assert out of range. If convenient, you can send your test data to my email (xiaogongwei@asch.whigg.ac.cn). I have chenged epochLenLB - del_len > 5 to epochLenLB - del_len > =5

@LucaFibbi
Copy link
Collaborator Author

After the latest repository updates, the program end without assert.
Therefore I don't have the data for the test.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants