感谢周老师开源的PPP程序和KF-GINS开源程序,在此基础上稍稍改进区分了北二和北三系统,并加入了北斗频点选择。下面将在GAMP与KF-GINS的基础上实现PPP/INS紧组合(事后)完成本科毕业设计。
第一天:在gamp中加上捷联惯导
1、修改配置文件
以下是我目前的配置文件
由于GAMP第一件事判断有没有观测文件,因此在obsfile前面加入整体程序选择 0则为GNSS 1为INS捷联惯导 2实现GNSS/INS松组合 3GNSS/INS紧组合。
2、在main.c文件 proccfgfile函数中加入以下修改
static int proccfgfile(char cfgfile[])
{
FILE *fp=NULL;
char *p,tmp[MAXSTRPATH]={'\0'};
//initialization
PPP_Glo.prcType=-1;
//2023-04-09添加imutype
PPP_Glo.prcimuType = 0;
PPP_Glo.outFolder[0]='\0';
PPP_Glo.inputPath[0]='\0';
if ((fp=fopen(cfgfile,"r"))==NULL) {
printf("*** ERROR: open configure file failed, please check it!\n");
return 0;
}
while (!feof(fp)) {
tmp[0] = '\0';
fgets(tmp, MAXSTRPATH, fp);
if ((tmp != NULL) && (tmp[0] == '#')) continue;
//2023-04-09 加入cxymode
if (strstr(tmp, "cxymode")) {
p = strrchr(tmp, '=');
sscanf(p + 1, "%d", &PPP_Glo.cxymode);}
if (PPP_Glo.cxymode == 0)
{
if (strstr(tmp, "obs file/folder")) {
p = strrchr(tmp, '=');
sscanf(p + 1, "%d", &PPP_Glo.prcType);
tmp[0] = '\0';
if (fgets(tmp, MAXSTRPATH, fp)) {
p = strrchr(tmp, '=');
sscanf(p + 1, "%[^,]", PPP_Glo.inputPath);
trimSpace(PPP_Glo.inputPath);
cutFilePathSep(PPP_Glo.inputPath);
}
else {
printf("*** ERROR: read obs files path error!");
return 0;
}
break;
}
}
else {
if (strstr(tmp, "imu file")) {
p = strrchr(tmp, '=');
sscanf(p + 1, "%d", &PPP_Glo.prcimuType);
tmp[0] = '\0';
if (fgets(tmp, MAXSTRPATH, fp)) {
p = strrchr(tmp, '=');
sscanf(p + 1, "%[^,]", PPP_Glo.inputPath);
trimSpace(PPP_Glo.inputPath);
cutFilePathSep(PPP_Glo.inputPath);
}
else {
printf("*** ERROR: read imu file path error!");
return 0;
}
break;
}
}
}
fclose(fp);
if (PPP_Glo.cxymode == 0) {
if (PPP_Glo.prcType < 0 || PPP_Glo.prcType>2) {
printf("*** ERROR: read obs files path error!");
return 0;
}
}
//2023 -04 -09加入惯导文件判断
if (PPP_Glo.cxymode == 1) {
if (PPP_Glo.prcimuType == 0) {
printf("*** ERROR: read imu file path error!");
return 0;
}
}
if (PPP_Glo.prcType==0)
procOneFile(PPP_Glo.inputPath,cfgfile,0,1);
else if (PPP_Glo.prcType==1)
batchProc(PPP_Glo.inputPath,cfgfile);
//读取imu文件
if (PPP_Glo.prcimuType==1)
{
readimu_File();
}
return 1;
}
如果选择cxymode ==1则进入readimuFile 我们将在这里进行捷联惯导编排
3、打开惯导imu文件 文件格式与KF-GINS文件格式一样为七列
1、FILE* fpimu;
fpimu = fopen(PPP_Glo.inputPath, "r");
将配置文件中imu的路径传到这里
2、然后判断文件是否打开成功
if (fpimu == NULL) {
printf("*** ERROR: read imu file path error!");
return 0;
}
else
{
printf("Read imu file successfully");
}
4、设置惯导的初始值
可以设定惯导的初始速度、姿态、位置
# IMU原始数据频率
# IMU datarate [Hz]
imudatarate: 200
# 处理时间段,结束时间设置为-1时则处理至IMU文件结束
# processing interval[s]
# process until the imufile end if set endtime to -1
starttime: 0
endtime: 0
# 初始状态
# initial state
# 初始位置, 纬度 经度 高程
# initial position, latitude, longitude, altitude. [deg, deg, m]
initpos: [ 30.5, 114, 20 ]
# 初始速度, 北向速度, 东向速度, 垂向速度
# initial velocity, speed in the directions of north, east and down. [m/s, m/s, m/s]
initvel: [ 0.0, 0.0, 0.0 ]
# 初始姿态, 欧拉角(ZYX旋转顺序), 横滚, 俯仰, 航向
# initial attitude, euler angle(ZYX rotation), roll, pitch, yaw [deg, deg, deg]
initatt: [ 0.0, 0.0, 0.0 ]
5、进行捷联惯导编排
6、输出结果