当前位置:网站首页>A bug in rtklib2.4.3 B34 single point positioning
A bug in rtklib2.4.3 B34 single point positioning
2022-06-23 05:16:00 【Running Orange 】
List of articles
A problem in the single point positioning part
This is a new problem introduced in this update , There was no such thing before , Here's the picture :
- If you don't recompile the code, you won't encounter the problems mentioned in this article , because release There will be no problem with this version of the program
- If the code is debug, Then we won't encounter this problem
- If you try to run directly debug Version of the program , Then the probability of this problem

A platitude root cause
This issue It is caused by local variables not being initialized , So I want to fix This issue It's also very simple. , Just put these four variables dion,dtrp,vmeas,vion,vtrp Initialization . From an algorithmic point of view , These four variables will not be initialized only in the first iteration , So we initialize it to 0.
static int rescode(int iter, const obsd_t *obs, int n, const double *rs,
...
{
gtime_t time;
double r,freq,dion,dtrp,vmeas,vion,vtrp,rr[3],pos[3],dtr,e[3],P;
...
if (iter>0) {
// The ionosphere is calculated here Process delay and variance
}
/* pseudorange residual */
v[nv]=P-(r+dtr-CLIGHT*dts[i*2]+dion+dtrp); // this is line 306
...
}
From a code perspective , There are two aspects of this code that are not very good for ordinary developers ( The code was written by the great God , The great God can write at will ). These two places are very old-fashioned , Just pay attention to one place , It wouldn't have happened issue.
- Local variables are not initialized , More than local variables , All variables are initialized , This is really a very good habit
ifNo,else. There are two possible caseselseIt doesn't make any sense .
–if(true),ture It can also be an expression, etc , Whatever the consideration, this situation arises , He showed up anyway
–elseYou don't need to do anything .
In both cases , Write not writeelseThere is no difference in program execution . But there is a big difference between avoiding mistakes and reading code . Because as long as you writeelseIt proves that the author of the code consideredelseThis situation , This is a deliberate act . So at this timeelseIt is suggested to write in the following form ,
if(...) {
//...
} else {
NULL; // REMINDER!:do nothing on purpose
}
Or the following form is acceptable ,
if(...) {
//...
} else {
} // REMINDER!:do nothing on purpose
Why is it so modified
So why did the author make the following changes ? It's simple , Let's take a look at the code , This if I did the following four things , These are all quantities related to the position of the receiver . Although this position does not need to be very accurate , Rough coordinates are enough . But we know it's pvt When solving , The initial position is unknown , There is no point in calculating these quantities here , And the result of calculation is wrong , It has side effects , It might as well not be . This change not only saves CPU, My guess is that it will also improve iteration efficiency .
- Elevation mask
- SNR mask
- Ionospheric delay calculation
- Tropospheric delay calculation
if (iter>0) {
/* test elevation mask */
if (satazel(pos,e,azel+i*2)<opt->elmin) continue;
/* test SNR mask */
if (!snrmask(obs+i,azel+i*2,opt)) continue;
/* ionospheric correction */
if (!ionocorr(time,nav,sat,pos,azel+i*2,opt->ionoopt,&dion,&vion)) {
continue;
}
if ((freq=sat2freq(sat,obs[i].code[0],nav))==0.0) continue;
dion*=SQR(FREQ1/freq);
vion*=SQR(FREQ1/freq);
/* tropospheric correction */
if (!tropcorr(time,nav,pos,azel+i*2,opt->tropopt,&dtrp,&vtrp)) {
continue;
}
}
So change
therefore ,fix The method will be natural , Maybe it's changed like this ,
dion = 0; dtrp = 0; vion = 0; vtrp = 0;
for (i=*ns=0;i<n&&i<MAXOBS;i++) {
Or so ,
if (iter>0) {
// The ionosphere is calculated here Process delay and variance
} else {
dion = 0; dtrp = 0; vion = 0; vtrp = 0;
}
边栏推荐
- 如何进行探索性数据分析
- 微信小程序:凑单满减计算神器
- 入行软件测试5年,跳槽3次,我摸透了软件测试这一行
- UnityShader入门精要——Unity中的渲染优化技术(四)
- 超越芯片和AI,硬科技资本为什么越来越“硬核”?
- laravel8实现图片验证码
- Architecture à trois niveaux MVC
- C'est dur de trouver un emploi? Ali des trois côtés, heureusement qu'il s'est bien préparé et qu'il a pris un produit.
- 104. 简易聊天室7:使用 Socket 传递对象
- 新晋职场人的 技术进击?之旅
猜你喜欢

Course design C for freshmen -- clothing management system

Web 应用程序安全测试指南

李宏毅《机器学习》丨5. Tips for neural network design(神经网络设计技巧)

功能测试人员如何做到花一个月的时间进阶自动化软件测试工程师

大环境不好难找工作?三面阿里,幸好做足了准备,已拿offer

Raspberry pie network remote access

【毕业季_进击的技术er】送别过去两年迷茫的自己。重整旗鼓,大三我来啦

Missing essential plugin

Do280openshift command and troubleshooting -- common troubleshooting and chapter experiments

PRCS-1016 : Failed to resolve Single Client Access Name
随机推荐
104. 简易聊天室7:使用 Socket 传递对象
【Mac】安全性与隐私中没有任何来源选项
8 years' experience: monthly salary of 3000 to 30000, the change of Test Engineer
直接插入排序——【常见排序法(1/8)】
精密星历介绍与使用
Difficult to find a job in a bad environment? Ali on three sides. Fortunately, he has made full preparations and has offered
Unity中,如何在【编辑器】和【运行时】状态下读写一个ScriptableObject对象
TIOBE 编程语言排行榜是编程语言流行趋势的一个指标
Image noise reduction denoise AI
Web 应用程序安全测试指南
Hcip fifth operation
【Leetcode】最长递增子序列问题及应用
[OFDM communication] simulation of OFDM multi-user resource allocation based on MATLAB [including Matlab source code 1902]
Mongodb sharding principle
掌握 Shell,一篇就够了!
UI自动化定位利器-xpath实战
代码片段管理器SnippetsLab
超越芯片和AI,硬科技资本为什么越来越“硬核”?
HCIP 交换机实验
Cookie-Session讲解