操作系统 | Project_I/O subsystem

本文档详细介绍了在MINIX3操作系统中创建和使用RAM盘的过程,以及编写测试代码对比RAM盘与磁盘在顺序和随机读写性能上的差异。实验结果显示,RAM盘在读写速度上普遍快于磁盘,尤其在随机读写方面,但由于内存寻址无需物理寻道,故速度优势明显。此外,分析了磁盘的寻道时间对性能的影响。

一、目的

  1、熟悉类UNIX系统的I/O设备管理
  2、熟悉MINIX块设备驱动
  3、熟悉MINIX RAM盘

二、内容与设计思想

   · 在Minix3中安装一块x MB大小的RAM盘,可以挂载并且存取文件操作。
   · 编写测试文件,测试不同块大小下、不同块扫描方式(顺序/随机)RAM盘和Disk盘的文件读写速度并分析其读写速度差异原因。

三、使用环境

  物理机:Windows10
  虚拟机:Minix3
  虚拟机软件:Vmware
  终端控制软件:MobaXterm
  物理机与虚拟机文件传输:FileZilla

四、实验过程

(1)在Minix3中安装一块RAM盘

   · 修改/usr/src/minix/drivers/storage/memory/memory.c,增加默认的用户RAM盘数。重新编译内核,重启虚拟机。

/* ramdisks (/dev/ram*) */
#define RAMDISKS     7

   · 创建设备mknod /dev/myram b 1 13,并输入ls /dev/ | grep ram查看设备是否创建成功。
在这里插入图片描述
   · 参考/usr/src/minix/commands/ramdisk/ramdisk.c,实现buildmyram.c容量初始化工具,将单位从KB修改为MB。同时,在同一目录下的Makefile文件中添加相应条目。重新编译内核,重启虚拟机。

#define KFACTOR 1048576
PROG=   ramdisk
PROG=   buildmyram

   · 执行命令 buildmyram /dev/myram,创建一个RAM盘。
在这里插入图片描述
   · 在RAM盘上创建内存文件系统,mkfs.mfs /dev/myram。
   · 将RAM盘挂载到用户目录下,mount /dev/myram /root/myram,输入df查看是否挂载成功。
在这里插入图片描述
  注意:重启后用户自定义的RAM盘内容会丢失,因此每次重启后都需要重新设置大小,创建文件系统并挂载。

(2)编写测试代码

   · 主函数实现思路:
  分别调用相应函数测试在顺序和随机两种块扫描方式下,RAM盘和Disk盘多个进程并发读写不同大小块的时间,并计算平均读写速度。
   - 为每个进程分配独立的文件
   - wait(NULL)函数等待所有子进程读写结束再记录结束时间
   - 经测试,进程并发度在7~10之间吞吐量达到最大,基于此在实验中可以修改并发度大小来获得良好的实验数据

for(int blocksize=64;blocksize<=1024*32;blocksize=blocksize*2){
            int Concurrency=7;
            gettimeofday(&starttime, NULL);
            for(int i=0;i<Concurrency;i++){
                if(fork()==0){
                //随机写
                //write_file(blocksize,true,filepathDisk[i]);
                //write_file(blocksize,true,filepathRam[i]);
                
                //顺序写
                //write_file(blocksize,false,filepathDisk[i]);
                //rite_file(blocksize,false,filepathRam[i]);
                
                //随机读
                read_file(blocksize,true,filepathDisk[i]);
                //read_file(blocksize,true,filepathRam[i]);
                
                //顺序读
                //read_file(blocksize,false,filepathDisk[i]);
                //read_file(blocksize,false,filepathRam[i]);
                exit(0);
                }
            }
            //等待所有子进程结束
            //wait失败返回-1
            while(wait(NULL)!=-1);
            gettimeofday(&endtime, NULL);
            spendtime=get_time_left(starttime,endtime)/1000.0;//换算成秒
            int block=blocksize*Concurrency*times;
            printf("blocksize_KB=%.4fKB,speed=%fMB/s\n",(double)blocksize/1024.0,(double)block/spendtime/1024.0/1024.0);
    }

   · write_file & read_file函数实现思路:
  通过多次重复的读写操作来计算RAM盘/Disk的读写速度。
   - 若为随机读写,则每次读写结束后利用lseek(fp,rand()%(filesize-blocksize),SEEK_SET)函数定位到文件任意位置。
   - 为了减小主机操作系统的缓存机制造成的误差,将文件大小filesize设置为300MB
  注意:对(filesize-blocksize)取余,防止写出文件

//blocksize表示写的块大小
//isrand=true表示随机写,否则为顺序写
//filepath为文件写的路径
void write_file(int blocksize, bool isrand, char *filepath){
    int fp=open(filepath,O_RDWR|O_CREAT|O_SYNC,0755);
    if(fp==-1) printf("open file error!\n");
    int res;
    //多次重复写入计算时间
    for(int i=0;i<times;i++){
        if((res=write(fp,buff,blocksize))!=blocksize){
            printf("%d\n",res);
            printf("write file error!\n");
        }
        if(isrand){
            //随机生成一个整数 取余定位到文件中任意位置
            //对(filesize-blocksize)取余,防止写出文件
            lseek(fp,rand()%(filesize-blocksize),SEEK_SET);
        }
    }
    lseek(fp,0,SEEK_SET);
}

void read_file(int blocksize,bool isrand,char *filepath){
    int fp=open(filepath,O_RDWR|O_CREAT|O_SYNC,0755);
    if(fp==-1) printf("open file error!\n");
    int res;
    for(int i=0;i<times;i++){
        if((res=read(fp,readbuff,blocksize))!=blocksize){
            printf("%d\n",res);
            printf("read file error!\n");
        }
        if(isrand){
            lseek(fp,rand()%(filesize-blocksize),SEEK_SET);
        }
    }
    lseek(fp,0,SEEK_SET);
}

   · get_time_left函数实现思路:
  利用测试得到的starttime和endtime计算读写所耗费的时间。

long get_time_left(struct timeval starttime,struct timeval endtime){
    long spendtime;
         //换算成毫秒
    spendtime=(long)(endtime.tv_sec-starttime.tv_sec)*1000+(endtime.tv_usec-starttime.tv_usec)/1000;
    return spendtime;
}

五、实验结果

(1)实验数据表

随机写64B128B256B512B1KB2KB4KB8KB16KB32KB
磁盘0.2443.2555.0866.1048.13810.65212.07914.42215.45226.042
RAM盘2.6316.1049.76621.04742.09373.42697.656167.650233.907260.417
顺序写64B128B256B512B1KB2KB4KB8KB16KB32KB
磁盘2.5895.02610.35820.71532.94441.430131.777164.474170.898201.613
RAM盘3.5907.39812.20729.59339.06378.125156.25188.253234.962454.546
随机读64B128B256B512B1KB2KB4KB8KB16KB32KB
磁盘1.70893.4186.835910.357516.472123.572132.944343.7545.289856.9661
RAM盘1.83844.0697.353632.55258.829183.4669180.8449267.5514312.5374.7002
顺序读64B128B256B512B1KB2KB4KB8KB16KB32KB
磁盘2.0596.835919.531339.062559.1856156.25165.7197260.4167312.5437.5
RAM盘5.026510.357520.71542.744682.8598165.7197218.75331.4394437.5527.1084

  注:读写速率的单位:MB/s

(2)实验数据图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

(3)实验结果分析

  总体来看,写的速率比读的速率慢,随机读写的速率比顺序读写的速率慢,尤其是磁盘两种快扫描方式的速率差异更加明显。究其原因在于磁盘读写时,机械寻道是影响磁盘读写速率的主要因素,随机读写每次都需要重新寻道,而顺序读写只需要在第一次进行寻道,因此两种方式的读写速率差别很大。
  对比Disk盘和RAM盘,RAM盘的读写速率普遍快于Disk盘,特别是随机读写性能。由于RAM盘为内存分配的一块区域,因此没有寻道和旋转延迟,所以RAM的读写速率优于Disk。但对Disk进行一次读后,其内容会被缓存,之后再次读Disk上的数据,其效率有所提高。

完整代码与测试文件: https://github.com/RachelllYe/OSProject
欢迎探讨与指正,谢谢!

D:/QT/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug clean D:/QT/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Release clean mingw32-make[1]: Entering directory 'D:/qt-progarm/TEXT/MVC/build/Desktop_Qt_6_5_3_MinGW_64_bit-Debug' del debug\moc_predefs.h mingw32-make[1]: Entering directory 'D:/qt-progarm/TEXT/MVC/build/Desktop_Qt_6_5_3_MinGW_64_bit-Debug' del release\moc_predefs.h del debug\moc_uimain.cpp del release\moc_uimain.cpp del ui_uimain.h del ui_uimain.h 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\debug\moc_predefs.h 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\release\moc_predefs.h 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\debug\moc_uimain.cpp 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\release\moc_uimain.cpp 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\ui_uimain.h del debug\main.o debug\dao.o debug\mydata.o debug\uimain.o debug\filehelper.o debug\moc_uimain.o 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\ui_uimain.h del release\main.o release\dao.o release\mydata.o release\uimain.o release\filehelper.o release\moc_uimain.o 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\debug\main.o mingw32-make[1]: Leaving directory 'D:/qt-progarm/TEXT/MVC/build/Desktop_Qt_6_5_3_MinGW_64_bit-Debug' 找不到 D:\qt-progarm\TEXT\MVC\build\Desktop_Qt_6_5_3_MinGW_64_bit-Debug\release\main.o mingw32-make[1]: Leaving directory 'D:/qt-progarm/TEXT/MVC/build/Desktop_Qt_6_5_3_MinGW_64_bit-Debug' 20:48:19: The command "D:\QT\Tools\mingw1120_64\bin\mingw32-make.exe clean -j24" finished successfully. 20:48:19: 正在启动 "D:\QT\Tools\mingw1120_64\bin\mingw32-make.exe" -j24 D:/QT/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/qt-progarm/TEXT/MVC/build/Desktop_Qt_6_5_3_MinGW_64_bit-Debug' D:\QT\6.5.3\mingw_64\bin\uic.exe D:\qt-progarm\TEXT\MVC\src\fend\uimain\uimain.ui -o ui_uimain.h g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -ID:/qt-progarm/TEXT/MVC -I. -ID:/QT/6.5.3/mingw_64/include -ID:/QT/6.5.3/mingw_64/include/QtWidgets -ID:/QT/6.5.3/mingw_64/include/QtGui -ID:/QT/6.5.3/mingw_64/include/QtCore -Idebug -I. -I/include -ID:/QT/6.5.3/mingw_64/mkspecs/win32-g++ -o debug\main.o D:\qt-progarm\TEXT\MVC\main.cpp g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -ID:/qt-progarm/TEXT/MVC -I. -ID:/QT/6.5.3/mingw_64/include -ID:/QT/6.5.3/mingw_64/include/QtWidgets -ID:/QT/6.5.3/mingw_64/include/QtGui -ID:/QT/6.5.3/mingw_64/include/QtCore -Idebug -I. -I/include -ID:/QT/6.5.3/mingw_64/mkspecs/win32-g++ -o debug\dao.o D:\qt-progarm\TEXT\MVC\src\bend\dao\dao.cpp g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -ID:/qt-progarm/TEXT/MVC -I. -ID:/QT/6.5.3/mingw_64/include -ID:/QT/6.5.3/mingw_64/include/QtWidgets -ID:/QT/6.5.3/mingw_64/include/QtGui -ID:/QT/6.5.3/mingw_64/include/QtCore -Idebug -I. -I/include -ID:/QT/6.5.3/mingw_64/mkspecs/win32-g++ -o debug\mydata.o D:\qt-progarm\TEXT\MVC\src\bend\model\mydata.cpp g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -ID:/qt-progarm/TEXT/MVC -I. -ID:/QT/6.5.3/mingw_64/include -ID:/QT/6.5.3/mingw_64/include/QtWidgets -ID:/QT/6.5.3/mingw_64/include/QtGui -ID:/QT/6.5.3/mingw_64/include/QtCore -Idebug -I. -I/include -ID:/QT/6.5.3/mingw_64/mkspecs/win32-g++ -o debug\filehelper.o D:\qt-progarm\TEXT\MVC\src\helper\filehelper.cpp g++ -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -dM -E -o debug\moc_predefs.h D:\QT\6.5.3\mingw_64\mkspecs\features\data\dummy.cpp g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -ID:/qt-progarm/TEXT/MVC -I. -ID:/QT/6.5.3/mingw_64/include -ID:/QT/6.5.3/mingw_64/include/QtWidgets -ID:/QT/6.5.3/mingw_64/include/QtGui -ID:/QT/6.5.3/mingw_64/include/QtCore -Idebug -I. -I/include -ID:/QT/6.5.3/mingw_64/mkspecs/win32-g++ -o debug\uimain.o D:\qt-progarm\TEXT\MVC\src\fend\uimain\uimain.cpp D:\QT\6.5.3\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include D:/qt-progarm/TEXT/MVC/build/Desktop_Qt_6_5_3_MinGW_64_bit-Debug/debug/moc_predefs.h -ID:/QT/6.5.3/mingw_64/mkspecs/win32-g++ -ID:/qt-progarm/TEXT/MVC -ID:/QT/6.5.3/mingw_64/include -ID:/QT/6.5.3/mingw_64/include/QtWidgets -ID:/QT/6.5.3/mingw_64/include/QtGui -ID:/QT/6.5.3/mingw_64/include/QtCore -I. -ID:/QT/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -ID:/QT/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -ID:/QT/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -ID:/QT/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -ID:/QT/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -ID:/QT/Tools/mingw1120_64/x86_64-w64-mingw32/include D:\qt-progarm\TEXT\MVC\src\fend\uimain\uimain.h -o debug\moc_uimain.cpp g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -ID:/qt-progarm/TEXT/MVC -I. -ID:/QT/6.5.3/mingw_64/include -ID:/QT/6.5.3/mingw_64/include/QtWidgets -ID:/QT/6.5.3/mingw_64/include/QtGui -ID:/QT/6.5.3/mingw_64/include/QtCore -Idebug -I. -I/include -ID:/QT/6.5.3/mingw_64/mkspecs/win32-g++ -o debug\moc_uimain.o debug\moc_uimain.cpp g++ -Wl,-subsystem,windows -mthreads -o debug\MVC.exe debug/main.o debug/dao.o debug/mydata.o debug/uimain.o debug/filehelper.o debug/moc_uimain.o -LD:\QT\Tools\mingw1120_64\x86_64-w64-mingw32\lib -lkernel32 D:\QT\Tools\mingw1120_64\x86_64-w64-mingw32\lib\libmingwex.a D:\QT\6.5.3\mingw_64\lib\libQt6Widgets.a D:\QT\6.5.3\mingw_64\lib\libQt6Gui.a D:\QT\6.5.3\mingw_64\lib\libQt6Core.a -lmingw32 D:\QT\6.5.3\mingw_64\lib\libQt6EntryPoint.a -lshell32 D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `C:/MinGW/lib/../lib/crt2.o' is incompatible with i386:x86-64 output D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x34): undefined reference to `_signal' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x89): undefined reference to `_signal' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0xc0): undefined reference to `_signal' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0xd9): undefined reference to `_signal' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x10b): undefined reference to `_signal' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x153): more undefined references to `_signal' follow D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x15f): undefined reference to `_fesetenv' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x17d): undefined reference to `_signal' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x199): undefined reference to `_signal' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1b8): undefined reference to `___dyn_tls_init_callback' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1e4): undefined reference to `_SetUnhandledExceptionFilter@4' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1ec): undefined reference to `___cpu_features_init' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1f1): undefined reference to `__CRT_fenv' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1f9): undefined reference to `_fesetenv' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x203): undefined reference to `__CRT_fmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x20d): undefined reference to `__imp___iob' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x212): undefined reference to `__fmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x221): undefined reference to `__setmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x226): undefined reference to `__CRT_fmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x235): undefined reference to `__setmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x23a): undefined reference to `__CRT_fmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x249): undefined reference to `__setmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x24e): undefined reference to `___p__fmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x254): undefined reference to `__fmode' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x25b): undefined reference to `__pei386_runtime_relocator' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x263): undefined reference to `___main' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x268): undefined reference to `___p__environ' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x284): undefined reference to `_main' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x28b): undefined reference to `__cexit' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x293): undefined reference to `_ExitProcess@4' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x2c3): undefined reference to `__CRT_glob' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x2d7): undefined reference to `___getmainargs' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x2ec): undefined reference to `__imp____set_app_type' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x30c): undefined reference to `__imp____set_app_type' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x322): undefined reference to `__imp__atexit' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x332): undefined reference to `__imp___onexit' D:/QT/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ertr000001.o:(.rdata+0x0): undefined reference to `_pei386_runtime_relocator' collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [Makefile.Debug:84: debug/MVC.exe] Error 1 mingw32-make[1]: Leaving directory 'D:/qt-progarm/TEXT/MVC/build/Desktop_Qt_6_5_3_MinGW_64_bit-Debug' mingw32-make: *** [Makefile:45: debug] Error 2 20:48:21: The command "D:\QT\Tools\mingw1120_64\bin\mingw32-make.exe -j24" terminated with exit code 2. 20:48:21: Error while building/deploying project MVC (kit: Desktop Qt 6.5.3 MinGW 64-bit) 20:48:21: When executing step "Make" 20:48:21: Elapsed time: 00:01.怎么解决这个问题
10-07
将这个CMakeLists.txt文件: cmake_minimum_required(VERSION 3.20) if(MSVC) # 设置工具集为v141(VS2017) set(CMAKE_GENERATOR_TOOLSET "v141" CACHE STRING "Platform Toolset" FORCE) set(CMAKE_GENERATOR_PLATFORM "x64") # 设置Windows SDK版本(根据实际安装版本修改) set(CMAKE_SYSTEM_VERSION "10.0.17763.0") endif() project(MCUSim LANGUAGES C) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() # 设置项目版本(可选) set(MCUSim_VERSION 1.0.0) # 设置C标准 set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) # 根据配置类型设置不同的编译选项 set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a postfix, usually for debug builds") # 设置可执行文件输出目录 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) # 定义源文件和头文件 set(APP_SOURCES "source/APP/Control/src/Control_can_api.c" "source/APP/Control/src/Control_config_api.c" "source/APP/Control/src/Control_emergencybraking_api.c" "source/APP/Control/src/Control_main_task.c" "source/APP/Control/src/Control_soc_api.c" "source/COM/com_log.c" "source/COM/seqqueue.c" "source/HAL/CAN/hal_can.c" "source/HAL/CAN/hal_can_api.c" "source/HAL/CAN/hal_can_ring_queue.c" "source/MID/CAN/mid_can_ctrl_api.c" "source/MID/CAN/mid_can_ctrl_drv.c" "source/MID/CAN/mid_can_ctrl_gen_acu_il.c" "source/MID/CAN/mid_can_ctrl_gen_asc_il.c" "source/MID/CAN/mid_can_ctrl_gen_eps_il.c" "source/MID/CAN/mid_can_ctrl_gen_esc_il.c" "source/MID/CAN/mid_can_ctrl_gen_gw_il.c" "source/MID/CAN/mid_can_ctrl_gen_ibooster_il.c" "source/MID/CAN/mid_can_ctrl_gen_il.c" "source/MID/CAN/mid_can_ctrl_gen_uss_il.c" "source/MID/CAN/mid_can_ctrl_gen_vcu_il.c" "source/MID/CAN/mid_can_ctrl_il.c" "source/MID/CAN/mid_can_ctrl_nm.c" "source/MID/CAN/mid_can_ctrl_task.c" "source/MID/CAN/mid_can_parser.c" "source/MID/Serial/DataLinkCtrl/mid_dl_ctrl_api.c" "source/MID/Serial/DataLinkCtrl/mid_dl_ctrl_callback.c" "source/MID/Serial/DataLinkCtrl/mid_dl_ctrl_main.c" "source/MID/ShareOBJ/mid_share_common_api.c" "source/MID/ShareOBJ/mid_share_control.c" "source/MID/ShareOBJ/mid_share_gen_acu_api.c" "source/MID/ShareOBJ/mid_share_gen_asc_api.c" "source/MID/ShareOBJ/mid_share_gen_eps_api.c" "source/MID/ShareOBJ/mid_share_gen_esc_api.c" "source/MID/ShareOBJ/mid_share_gen_gw_api.c" "source/MID/ShareOBJ/mid_share_gen_ibooster_api.c" "source/MID/ShareOBJ/mid_share_gen_uss_api.c" "source/MID/ShareOBJ/mid_share_gen_vcu_api.c" "source/OSM/osm.c" "source/OSM/osm_timer.c" "source/main.c" ) # 头文件路径(用于IDE显示,不是必须的,但为了清晰可以列出) file(GLOB_RECURSE HEADERS "source/APP/Control/include/*.h" "source/MID/Serial/DataLinkCtrl/*.h" "source/FreeRTOSv202012.00/FreeRTOS/Source/include/FreeRTOS.h" "source/FreeRTOSv202012.00/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h" "source/FreeRTOSv202012.00/FreeRTOS/Source/include/*.h" ) # include_directories( # AFTER # SYSTEM "D:/mingw64/x86_64-w64-mingw32/include" # 标记为系统目录 # ) # add_compile_options(-isystem "D:/mingw64/x86_64-w64-mingw32/include") # 隔离系统头文件[^4] if(MSVC) add_compile_options(/w) # MSVC编译器 add_compile_options(/Zi) add_link_options(/DEBUG) else() add_compile_options(-w) # GCC/Clang编译器 endif() set(CMAKE_BUILD_TYPE Debug) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") # -ggdb3 生成GDB专用调试信息,-O0 禁用优化 add_compile_options(-ggdb3 -O0 -fno-inline) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g") endif() # 创建可执行目标 add_executable(${PROJECT_NAME} ${APP_SOURCES} ${HEADERS}) # 包含目录 target_include_directories(${PROJECT_NAME} PRIVATE "source/ALL_INCLUDE" "source/COM" "source/ALL_INCLUDE/OSM" "source/MID/ShareOBJ" "source/APP/Control/include" "source/APP/Control/lib/include" "source/HAL/CAN" "source/MID/Serial/DataLinkCtrl" "source/FreeRTOSv202012.00/FreeRTOS/Source/include" "source/FreeRTOSv202012.00/FreeRTOS/Demo/WIN32-MingW" "source/FreeRTOSv202012.00/FreeRTOS/Source/portable/MSVC-MingW" "source/CanOSS" # "source/FreeRTOSv202012.00/FreeRTOS/Source/portable/MSVC-MingW" # "C:/Program Files (x86)/Kvaser/Canlib/INC" ) # 预处理器定义 target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<CONFIG:Debug>:WIN32;_DEBUG;_CONSOLE;WIN32_SIM;_CRT_SECURE_NO_WARNINGS> $<$<CONFIG:Release>:WIN32;NDEBUG;_CONSOLE> ) # 链接库目录 target_link_directories(${PROJECT_NAME} PRIVATE source/APP/Control/lib/X86 source/CanOSS # "C:/Program Files (x86)/Kvaser/Canlib/Lib/x64" ) # 链接库 target_link_libraries(${PROJECT_NAME} PRIVATE canlib32 ControlModelCal ) # 设置编译器警告级别等 if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /W3 /sdl /permissive- ) else() # 对于GCC或Clang,设置相应的选项 target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra # 以下安全选项可根据需要添加,注意不是所有平台都支持 # -D_FORTIFY_SOURCE=2 # -fstack-protector # 严格标准模式 -pedantic-errors ) endif() # 链接器选项 target_link_options(${PROJECT_NAME} PRIVATE /DEBUG # 生成调试信息(在Debug配置中) $<$<CONFIG:Debug>:/INCREMENTAL> # 增量链接(Debug) $<$<CONFIG:Release>:/INCREMENTAL:NO> # 非增量链接(Release) ) # 对于Release配置,开启全程序优化和优化引用 if(CMAKE_BUILD_TYPE STREQUAL "Release") target_compile_options(${PROJECT_NAME} PRIVATE /O2 # 优化级别(通常Release用/O2) /GL # 全程序优化 ) target_link_options(${PROJECT_NAME} PRIVATE /LTCG # 链接时代码生成(全程序优化) /OPT:REF # 优化引用 ) endif() # 设置字符集为Unicode(在Windows上) if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /D_UNICODE /DUNICODE # 定义Unicode宏 ) # 或者使用add_definitions,但更推荐target_compile_definitions # target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE) endif() 改写进下面makefile文件中: # ========================================================================= # Unity - A Test Framework for C # ThrowTheSwitch.org # Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams # SPDX-License-Identifier: MIT # ========================================================================= #We try to detect the OS we are running on, and adjust commands as needed ifeq ($(OS),Windows_NT) ifeq ($(shell uname -s),) # not in a bash-like shell CLEANUP = del /F /Q MKDIR = mkdir else # in a bash-like shell, like msys CLEANUP = rm -f MKDIR = mkdir -p endif TARGET_EXTENSION=.exe else CLEANUP = rm -f MKDIR = mkdir -p TARGET_EXTENSION=.out endif C_COMPILER=gcc ifeq ($(shell uname -s), Darwin) C_COMPILER=clang endif UNITY_ROOT=../.. CFLAGS=-std=c89 CFLAGS += -Wall CFLAGS += -Wextra CFLAGS += -Wpointer-arith CFLAGS += -Wcast-align CFLAGS += -Wwrite-strings CFLAGS += -Wswitch-default CFLAGS += -Wunreachable-code CFLAGS += -Winit-self CFLAGS += -Wmissing-field-initializers CFLAGS += -Wno-unknown-pragmas CFLAGS += -Wstrict-prototypes CFLAGS += -Wundef CFLAGS += -Wold-style-definition #CFLAGS += -Wno-misleading-indentation TARGET_BASE1=test1 TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION) SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/test_main.c test/TestControlCode.c test/test_runners/TestControlCode_Runner.c INC_DIRS=-Isrc -I$(UNITY_ROOT)/src SYMBOLS= all: clean default default: $(SRC_FILES1) $(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1) - ./$(TARGET1) # test/test_runners/TestProductionCode_Runner.c: test/TestProductionCode.c # ruby $(UNITY_ROOT)/auto/generate_test_runner.rb test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c # test/test_runners/TestProductionCode2_Runner.c: test/TestProductionCode2.c # ruby $(UNITY_ROOT)/auto/generate_test_runner.rb test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c clean: $(CLEANUP) $(TARGET1) $(TARGET2) ci: CFLAGS += -Werror ci: default
10-23
wjs@wjs-desktop:~/Drone_Slam$ ros2 launch fishbot_grapher test_grapher_3.launch.py [INFO] [launch]: All log files can be found below /home/wjs/.ros/log/2025-07-27-21-44-14-611581-wjs-desktop-3511 [INFO] [launch]: Default logging verbosity is set to INFO pkg_share =/home/wjs/Drone_Slam/install/fishbot_grapher/share/fishbot_grapher<== model_path =/home/wjs/Drone_Slam/install/fishbot_grapher/share/fishbot_grapher/urdf/fishbot_base.urdf<== [INFO] [sllidar_node-1]: process started with pid [3512] [INFO] [wit_ros2_imu-2]: process started with pid [3514] [INFO] [test01-3]: process started with pid [3516] [INFO] [robot_state_publisher-4]: process started with pid [3518] [INFO] [cartographer_node-5]: process started with pid [3520] [INFO] [cartographer_occupancy_grid_node-6]: process started with pid [3528] [sllidar_node-1] [INFO] [1753623855.053473670] [sllidar_node]: SLLidar running on ROS2 package SLLidar.ROS2 SDK Version:1.0.1, SLLIDAR SDK Version:2.0.0 [robot_state_publisher-4] [WARN] [1753623855.060580496] [robot_state_publisher]: No robot_description parameter, but command-line argument available. Assuming argument is name of URDF file. This backwards compatibility fallback will be removed in the future. [robot_state_publisher-4] [INFO] [1753623855.094832372] [robot_state_publisher]: got segment base_link [robot_state_publisher-4] [INFO] [1753623855.095034876] [robot_state_publisher]: got segment imu_link [robot_state_publisher-4] [INFO] [1753623855.095085164] [robot_state_publisher]: got segment laser_link [sllidar_node-1] [INFO] [1753623855.109755054] [sllidar_node]: SLLidar S/N: 7885EC95C1EA9ED1B2E49CF4FB594571 [sllidar_node-1] [INFO] [1753623855.109953948] [sllidar_node]: Firmware Ver: 1.01 [sllidar_node-1] [INFO] [1753623855.110013734] [sllidar_node]: Hardware Rev: 18 [sllidar_node-1] [INFO] [1753623855.161457399] [sllidar_node]: SLLidar health status : 0 [sllidar_node-1] [INFO] [1753623855.161700711] [sllidar_node]: SLLidar health status : OK. [cartographer_node-5] [INFO] [1753623855.329700319] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/home/wjs/Drone_Slam/install/fishbot_grapher/share/fishbot_grapher/config/test02.lua' for 'test02.lua'. [cartographer_node-5] [INFO] [1753623855.331169076] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/map_builder.lua' for 'map_builder.lua'. [cartographer_node-5] [INFO] [1753623855.331564029] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/map_builder.lua' for 'map_builder.lua'. [cartographer_node-5] [INFO] [1753623855.334823472] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/pose_graph.lua' for 'pose_graph.lua'. [cartographer_node-5] [INFO] [1753623855.335258474] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/pose_graph.lua' for 'pose_graph.lua'. [cartographer_node-5] [INFO] [1753623855.336206744] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/trajectory_builder.lua' for 'trajectory_builder.lua'. [cartographer_node-5] [INFO] [1753623855.336478199] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/trajectory_builder.lua' for 'trajectory_builder.lua'. [cartographer_node-5] [INFO] [1753623855.336887520] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/trajectory_builder_2d.lua' for 'trajectory_builder_2d.lua'. [cartographer_node-5] [INFO] [1753623855.337144200] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/trajectory_builder_2d.lua' for 'trajectory_builder_2d.lua'. [cartographer_node-5] [INFO] [1753623855.338000725] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/trajectory_builder_3d.lua' for 'trajectory_builder_3d.lua'. [cartographer_node-5] [INFO] [1753623855.338301971] [cartographer logger]: I0727 21:44:15.000000 3520 configuration_file_resolver.cc:41] Found '/opt/ros/humble/share/cartographer/configuration_files/trajectory_builder_3d.lua' for 'trajectory_builder_3d.lua'. [cartographer_node-5] F0727 21:44:15.343778 3520 lua_parameter_dictionary.cc:399] Check failed: HasKey(key) Key 'collate_landmarks' not in dictionary: [cartographer_node-5] { [cartographer_node-5] collate_fixed_frame = true, [cartographer_node-5] trajectory_builder_2d = { [cartographer_node-5] adaptive_voxel_filter = { [cartographer_node-5] max_length = 0.500000, [cartographer_node-5] max_range = 50.000000, [cartographer_node-5] min_num_points = 200.000000, [cartographer_node-5] }, [cartographer_node-5] ceres_scan_matcher = { [cartographer_node-5] ceres_solver_options = { [cartographer_node-5] max_num_iterations = 20.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] occupied_space_weight = 1.000000, [cartographer_node-5] rotation_weight = 40.000000, [cartographer_node-5] translation_weight = 10.000000, [cartographer_node-5] }, [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] loop_closure_adaptive_voxel_filter = { [cartographer_node-5] max_length = 0.900000, [cartographer_node-5] max_range = 50.000000, [cartographer_node-5] min_num_points = 100.000000, [cartographer_node-5] }, [cartographer_node-5] max_range = 8.000000, [cartographer_node-5] max_z = 2.000000, [cartographer_node-5] min_range = 0.300000, [cartographer_node-5] min_z = -0.800000, [cartographer_node-5] missing_data_ray_length = 1.000000, [cartographer_node-5] motion_filter = { [cartographer_node-5] max_angle_radians = 0.017453, [cartographer_node-5] max_distance_meters = 0.200000, [cartographer_node-5] max_time_seconds = 5.000000, [cartographer_node-5] }, [cartographer_node-5] num_accumulated_range_data = 1.000000, [cartographer_node-5] pose_extrapolator = { [cartographer_node-5] constant_velocity = { [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] pose_queue_duration = 0.001000, [cartographer_node-5] }, [cartographer_node-5] imu_based = { [cartographer_node-5] gravity_constant = 9.806000, [cartographer_node-5] imu_acceleration_weight = 1.000000, [cartographer_node-5] imu_rotation_weight = 1.000000, [cartographer_node-5] odometry_rotation_weight = 1.000000, [cartographer_node-5] odometry_translation_weight = 1.000000, [cartographer_node-5] pose_queue_duration = 5.000000, [cartographer_node-5] pose_rotation_weight = 1.000000, [cartographer_node-5] pose_translation_weight = 1.000000, [cartographer_node-5] solver_options = { [cartographer_node-5] max_num_iterations = 10.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_imu_based = false, [cartographer_node-5] }, [cartographer_node-5] real_time_correlative_scan_matcher = { [cartographer_node-5] angular_search_window = 0.349066, [cartographer_node-5] linear_search_window = 0.100000, [cartographer_node-5] rotation_delta_cost_weight = 0.100000, [cartographer_node-5] translation_delta_cost_weight = 10.000000, [cartographer_node-5] }, [cartographer_node-5] submaps = { [cartographer_node-5] grid_options_2d = { [cartographer_node-5] grid_type = "PROBABILITY_GRID", [cartographer_node-5] resolution = 0.050000, [cartographer_node-5] }, [cartographer_node-5] num_range_data = 35.000000, [cartographer_node-5] range_data_inserter = { [cartographer_node-5] probability_grid_range_data_inserter = { [cartographer_node-5] hit_probability = 0.550000, [cartographer_node-5] insert_free_space = true, [cartographer_node-5] miss_probability = 0.490000, [cartographer_node-5] }, [cartographer_node-5] range_data_inserter_type = "PROBABILITY_GRID_INSERTER_2D", [cartographer_node-5] tsdf_range_data_inserter = { [cartographer_node-5] maximum_weight = 10.000000, [cartographer_node-5] normal_estimation_options = { [cartographer_node-5] num_normal_samples = 4.000000, [cartographer_node-5] sample_radius = 0.500000, [cartographer_node-5] }, [cartographer_node-5] project_sdf_distance_to_scan_normal = true, [cartographer_node-5] truncation_distance = 0.300000, [cartographer_node-5] update_free_space = false, [cartographer_node-5] update_weight_angle_scan_normal_to_ray_kernel_bandwidth = 0.500000, [cartographer_node-5] update_weight_distance_cell_to_hit_kernel_bandwidth = 0.500000, [cartographer_node-5] update_weight_range_exponent = 0.000000, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_imu_data = true, [cartographer_node-5] use_online_correlative_scan_matching = true, [cartographer_node-5] voxel_filter_size = 0.025000, [cartographer_node-5] }, [cartographer_node-5] trajectory_builder_3d = { [cartographer_node-5] ceres_scan_matcher = { [cartographer_node-5] ceres_solver_options = { [cartographer_node-5] max_num_iterations = 12.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] intensity_cost_function_options_0 = { [cartographer_node-5] huber_scale = 0.300000, [cartographer_node-5] intensity_threshold = 40.000000, [cartographer_node-5] weight = 0.500000, [cartographer_node-5] }, [cartographer_node-5] occupied_space_weight_0 = 1.000000, [cartographer_node-5] occupied_space_weight_1 = 6.000000, [cartographer_node-5] only_optimize_yaw = false, [cartographer_node-5] rotation_weight = 400.000000, [cartographer_node-5] translation_weight = 5.000000, [cartographer_node-5] }, [cartographer_node-5] high_resolution_adaptive_voxel_filter = { [cartographer_node-5] max_length = 2.000000, [cartographer_node-5] max_range = 15.000000, [cartographer_node-5] min_num_points = 150.000000, [cartographer_node-5] }, [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] low_resolution_adaptive_voxel_filter = { [cartographer_node-5] max_length = 4.000000, [cartographer_node-5] max_range = 60.000000, [cartographer_node-5] min_num_points = 200.000000, [cartographer_node-5] }, [cartographer_node-5] max_range = 60.000000, [cartographer_node-5] min_range = 1.000000, [cartographer_node-5] motion_filter = { [cartographer_node-5] max_angle_radians = 0.004000, [cartographer_node-5] max_distance_meters = 0.100000, [cartographer_node-5] max_time_seconds = 0.500000, [cartographer_node-5] }, [cartographer_node-5] num_accumulated_range_data = 1.000000, [cartographer_node-5] pose_extrapolator = { [cartographer_node-5] constant_velocity = { [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] pose_queue_duration = 0.001000, [cartographer_node-5] }, [cartographer_node-5] imu_based = { [cartographer_node-5] gravity_constant = 9.806000, [cartographer_node-5] imu_acceleration_weight = 1.000000, [cartographer_node-5] imu_rotation_weight = 1.000000, [cartographer_node-5] odometry_rotation_weight = 1.000000, [cartographer_node-5] odometry_translation_weight = 1.000000, [cartographer_node-5] pose_queue_duration = 5.000000, [cartographer_node-5] pose_rotation_weight = 1.000000, [cartographer_node-5] pose_translation_weight = 1.000000, [cartographer_node-5] solver_options = { [cartographer_node-5] max_num_iterations = 10.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_imu_based = false, [cartographer_node-5] }, [cartographer_node-5] real_time_correlative_scan_matcher = { [cartographer_node-5] angular_search_window = 0.017453, [cartographer_node-5] linear_search_window = 0.150000, [cartographer_node-5] rotation_delta_cost_weight = 0.100000, [cartographer_node-5] translation_delta_cost_weight = 0.100000, [cartographer_node-5] }, [cartographer_node-5] rotational_histogram_size = 120.000000, [cartographer_node-5] submaps = { [cartographer_node-5] high_resolution = 0.100000, [cartographer_node-5] high_resolution_max_range = 20.000000, [cartographer_node-5] low_resolution = 0.450000, [cartographer_node-5] num_range_data = 160.000000, [cartographer_node-5] range_data_inserter = { [cartographer_node-5] hit_probability = 0.550000, [cartographer_node-5] intensity_threshold = 40.000000, [cartographer_node-5] miss_probability = 0.490000, [cartographer_node-5] num_free_space_voxels = 2.000000, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_intensities = false, [cartographer_node-5] use_online_correlative_scan_matching = false, [cartographer_node-5] voxel_filter_size = 0.150000, [cartographer_node-5] }, [cartographer_node-5] } [cartographer_node-5] [FATAL] [1753623855.349454665] [cartographer logger]: F0727 21:44:15.000000 3520 lua_parameter_dictionary.cc:399] Check failed: HasKey(key) Key 'collate_landmarks' not in dictionary: [cartographer_node-5] { [cartographer_node-5] collate_fixed_frame = true, [cartographer_node-5] trajectory_builder_2d = { [cartographer_node-5] adaptive_voxel_filter = { [cartographer_node-5] max_length = 0.500000, [cartographer_node-5] max_range = 50.000000, [cartographer_node-5] min_num_points = 200.000000, [cartographer_node-5] }, [cartographer_node-5] ceres_scan_matcher = { [cartographer_node-5] ceres_solver_options = { [cartographer_node-5] max_num_iterations = 20.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] occupied_space_weight = 1.000000, [cartographer_node-5] rotation_weight = 40.000000, [cartographer_node-5] translation_weight = 10.000000, [cartographer_node-5] }, [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] loop_closure_adaptive_voxel_filter = { [cartographer_node-5] max_length = 0.900000, [cartographer_node-5] max_range = 50.000000, [cartographer_node-5] min_num_points = 100.000000, [cartographer_node-5] }, [cartographer_node-5] max_range = 8.000000, [cartographer_node-5] max_z = 2.000000, [cartographer_node-5] min_range = 0.300000, [cartographer_node-5] min_z = -0.800000, [cartographer_node-5] missing_data_ray_length = 1.000000, [cartographer_node-5] motion_filter = { [cartographer_node-5] max_angle_radians = 0.017453, [cartographer_node-5] max_distance_meters = 0.200000, [cartographer_node-5] max_time_seconds = 5.000000, [cartographer_node-5] }, [cartographer_node-5] num_accumulated_range_data = 1.000000, [cartographer_node-5] pose_extrapolator = { [cartographer_node-5] constant_velocity = { [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] pose_queue_duration = 0.001000, [cartographer_node-5] }, [cartographer_node-5] imu_based = { [cartographer_node-5] gravity_constant = 9.806000, [cartographer_node-5] imu_acceleration_weight = 1.000000, [cartographer_node-5] imu_rotation_weight = 1.000000, [cartographer_node-5] odometry_rotation_weight = 1.000000, [cartographer_node-5] odometry_translation_weight = 1.000000, [cartographer_node-5] pose_queue_duration = 5.000000, [cartographer_node-5] pose_rotation_weight = 1.000000, [cartographer_node-5] pose_translation_weight = 1.000000, [cartographer_node-5] solver_options = { [cartographer_node-5] max_num_iterations = 10.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_imu_based = false, [cartographer_node-5] }, [cartographer_node-5] real_time_correlative_scan_matcher = { [cartographer_node-5] angular_search_window = 0.349066, [cartographer_node-5] linear_search_window = 0.100000, [cartographer_node-5] rotation_delta_cost_weight = 0.100000, [cartographer_node-5] translation_delta_cost_weight = 10.000000, [cartographer_node-5] }, [cartographer_node-5] submaps = { [cartographer_node-5] grid_options_2d = { [cartographer_node-5] grid_type = "PROBABILITY_GRID", [cartographer_node-5] resolution = 0.050000, [cartographer_node-5] }, [cartographer_node-5] num_range_data = 35.000000, [cartographer_node-5] range_data_inserter = { [cartographer_node-5] probability_grid_range_data_inserter = { [cartographer_node-5] hit_probability = 0.550000, [cartographer_node-5] insert_free_space = true, [cartographer_node-5] miss_probability = 0.490000, [cartographer_node-5] }, [cartographer_node-5] range_data_inserter_type = "PROBABILITY_GRID_INSERTER_2D", [cartographer_node-5] tsdf_range_data_inserter = { [cartographer_node-5] maximum_weight = 10.000000, [cartographer_node-5] normal_estimation_options = { [cartographer_node-5] num_normal_samples = 4.000000, [cartographer_node-5] sample_radius = 0.500000, [cartographer_node-5] }, [cartographer_node-5] project_sdf_distance_to_scan_normal = true, [cartographer_node-5] truncation_distance = 0.300000, [cartographer_node-5] update_free_space = false, [cartographer_node-5] update_weight_angle_scan_normal_to_ray_kernel_bandwidth = 0.500000, [cartographer_node-5] update_weight_distance_cell_to_hit_kernel_bandwidth = 0.500000, [cartographer_node-5] update_weight_range_exponent = 0.000000, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_imu_data = true, [cartographer_node-5] use_online_correlative_scan_matching = true, [cartographer_node-5] voxel_filter_size = 0.025000, [cartographer_node-5] }, [cartographer_node-5] trajectory_builder_3d = { [cartographer_node-5] ceres_scan_matcher = { [cartographer_node-5] ceres_solver_options = { [cartographer_node-5] max_num_iterations = 12.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] intensity_cost_function_options_0 = { [cartographer_node-5] huber_scale = 0.300000, [cartographer_node-5] intensity_threshold = 40.000000, [cartographer_node-5] weight = 0.500000, [cartographer_node-5] }, [cartographer_node-5] occupied_space_weight_0 = 1.000000, [cartographer_node-5] occupied_space_weight_1 = 6.000000, [cartographer_node-5] only_optimize_yaw = false, [cartographer_node-5] rotation_weight = 400.000000, [cartographer_node-5] translation_weight = 5.000000, [cartographer_node-5] }, [cartographer_node-5] high_resolution_adaptive_voxel_filter = { [cartographer_node-5] max_length = 2.000000, [cartographer_node-5] max_range = 15.000000, [cartographer_node-5] min_num_points = 150.000000, [cartographer_node-5] }, [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] low_resolution_adaptive_voxel_filter = { [cartographer_node-5] max_length = 4.000000, [cartographer_node-5] max_range = 60.000000, [cartographer_node-5] min_num_points = 200.000000, [cartographer_node-5] }, [cartographer_node-5] max_range = 60.000000, [cartographer_node-5] min_range = 1.000000, [cartographer_node-5] motion_filter = { [cartographer_node-5] max_angle_radians = 0.004000, [cartographer_node-5] max_distance_meters = 0.100000, [cartographer_node-5] max_time_seconds = 0.500000, [cartographer_node-5] }, [cartographer_node-5] num_accumulated_range_data = 1.000000, [cartographer_node-5] pose_extrapolator = { [cartographer_node-5] constant_velocity = { [cartographer_node-5] imu_gravity_time_constant = 10.000000, [cartographer_node-5] pose_queue_duration = 0.001000, [cartographer_node-5] }, [cartographer_node-5] imu_based = { [cartographer_node-5] gravity_constant = 9.806000, [cartographer_node-5] imu_acceleration_weight = 1.000000, [cartographer_node-5] imu_rotation_weight = 1.000000, [cartographer_node-5] odometry_rotation_weight = 1.000000, [cartographer_node-5] odometry_translation_weight = 1.000000, [cartographer_node-5] pose_queue_duration = 5.000000, [cartographer_node-5] pose_rotation_weight = 1.000000, [cartographer_node-5] pose_translation_weight = 1.000000, [cartographer_node-5] solver_options = { [cartographer_node-5] max_num_iterations = 10.000000, [cartographer_node-5] num_threads = 1.000000, [cartographer_node-5] use_nonmonotonic_steps = false, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_imu_based = false, [cartographer_node-5] }, [cartographer_node-5] real_time_correlative_scan_matcher = { [cartographer_node-5] angular_search_window = 0.017453, [cartographer_node-5] linear_search_window = 0.150000, [cartographer_node-5] rotation_delta_cost_weight = 0.100000, [cartographer_node-5] translation_delta_cost_weight = 0.100000, [cartographer_node-5] }, [cartographer_node-5] rotational_histogram_size = 120.000000, [cartographer_node-5] submaps = { [cartographer_node-5] high_resolution = 0.100000, [cartographer_node-5] high_resolution_max_range = 20.000000, [cartographer_node-5] low_resolution = 0.450000, [cartographer_node-5] num_range_data = 160.000000, [cartographer_node-5] range_data_inserter = { [cartographer_node-5] hit_probability = 0.550000, [cartographer_node-5] intensity_threshold = 40.000000, [cartographer_node-5] miss_probability = 0.490000, [cartographer_node-5] num_free_space_voxels = 2.000000, [cartographer_node-5] }, [cartographer_node-5] }, [cartographer_node-5] use_intensities = false, [cartographer_node-5] use_online_correlative_scan_matching = false, [cartographer_node-5] voxel_filter_size = 0.150000, [cartographer_node-5] }, [cartographer_node-5] } [sllidar_node-1] [INFO] [1753623855.378131908] [sllidar_node]: current scan mode: DenseBoost, sample rate: 32 Khz, max_distance: 18.0 m, scan frequency:10.0 Hz, [cartographer_node-5] *** Check failure stack trace: *** [cartographer_node-5] @ 0xffff8223d41c google::LogMessage::Fail() [cartographer_node-5] @ 0xffff822446d0 google::LogMessage::SendToLog() [cartographer_node-5] @ 0xffff8223d0f4 google::LogMessage::Flush() [cartographer_node-5] @ 0xffff8223eebc google::LogMessageFatal::~LogMessageFatal() [cartographer_node-5] @ 0xaaaad44c392c (unknown) [cartographer_node-5] @ 0xaaaad44c398c (unknown) [cartographer_node-5] @ 0xaaaad44c3dc8 (unknown) [cartographer_node-5] @ 0xaaaad44e10a8 (unknown) [cartographer_node-5] @ 0xaaaad44aaeec (unknown) [cartographer_node-5] @ 0xaaaad440743c (unknown) [cartographer_node-5] @ 0xffff818273fc (unknown) [cartographer_node-5] @ 0xffff818274cc __libc_start_main [cartographer_node-5] @ 0xaaaad440abf0 (unknown) [test01-3] Traceback (most recent call last): [test01-3] File "/home/wjs/.local/lib/python3.10/site-packages/serial/serialposix.py", line 322, in open [test01-3] self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK) [test01-3] FileNotFoundError: [Errno 2] No such file or directory: '/dev/mcu_usb' [test01-3] [test01-3] During handling of the above exception, another exception occurred: [test01-3] [test01-3] Traceback (most recent call last): [test01-3] File "/home/wjs/Drone_Slam/install/fishbot_grapher/lib/fishbot_grapher/test01", line 33, in <module> [test01-3] sys.exit(load_entry_point('fishbot-grapher==0.0.0', 'console_scripts', 'test01')()) [test01-3] File "/home/wjs/Drone_Slam/build/fishbot_grapher/fishbot_grapher/test01.py", line 101, in main [test01-3] tf_subscriber = TFSubscriber() [test01-3] File "/home/wjs/Drone_Slam/build/fishbot_grapher/fishbot_grapher/test01.py", line 20, in __init__ [test01-3] self.ser = serial.Serial("/dev/mcu_usb", 115200) [test01-3] File "/home/wjs/.local/lib/python3.10/site-packages/serial/serialutil.py", line 244, in __init__ [test01-3] self.open() [test01-3] File "/home/wjs/.local/lib/python3.10/site-packages/serial/serialposix.py", line 325, in open [test01-3] raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg)) [test01-3] serial.serialutil.SerialException: [Errno 2] could not open port /dev/mcu_usb: [Errno 2] No such file or directory: '/dev/mcu_usb' [wit_ros2_imu-2] [INFO] [1753623857.378557163] [imu]: Serial port opening failure [ERROR] [test01-3]: process has died [pid 3516, exit code 1, cmd '/home/wjs/Drone_Slam/install/fishbot_grapher/lib/fishbot_grapher/test01 --ros-args']. [ERROR] [cartographer_node-5]: process has died [pid 3520, exit code -6, cmd '/opt/ros/humble/lib/cartographer_ros/cartographer_node -configuration_directory /home/wjs/Drone_Slam/install/fishbot_grapher/share/fishbot_grapher/config -configuration_basename test02.lua --ros-args -r __node:=cartographer_node --params-file /tmp/launch_params_i_dk6w5r'].
07-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值