挚感采集 main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | static void Main( string [] args) { m_total_MeasureResultV_t.Clear(); //在List内移除所有元素 strLidarIp1 = new StringBuilder( "192.168.1.2" ); // new StringBuilder(ReadString("Basic", "IPV4_1", "192.168.1.111", strConfigIniAddr)); myc = new OSP_Lidar.MeasureModeCallback(myMeasureModeCallback); Console.Write( "IP1:" + strLidarIp1.ToString() + "\n" ); //第一个正式的步骤:SDK的初始化 int nBackId_device_init = 0; //SDK初始化函数,该函数必须优先调用。 nBackId_device_init = OSP_Lidar.device_init(); Console.Write( "device_init结果:" + nBackId_device_init.ToString() + "\n" ); if (nBackId_device_init < 0) { Console.Write( "device init error \n" ); return ; } //第二个正式的步骤:添加硬件 int nBackId_device_add = 0; //参数1:设备输出句柄 //参数2:设备的IP地址 //参数3:设备数据信息回调函数 //ref:该关键字用于按引用传递参数,这意味着方法内部对参数的修改会影响到方法外部的原始变量 nBackId_device_add = OSP_Lidar.device_add( ref dHandler1, strLidarIp1, myc); if ( 0== nBackId_device_add) { //uint cc = 0; //设备初始化 OSP_Lidar.device_general_init(dHandler1); // OSP_Lidar.device_write_fpga_reg(dHandler1, OSP_Fpga_Reg.B_transfer_down,31); // uint transferdown = OSP_Lidar.device_read_fpga_reg(dHandler1, OSP_Fpga_Reg.B_transfer_down);//这些值读取了 dll会自己使用 不需要上层操作 //cc = OSP_Lidar.device_read_fpga_reg(dHandler1, OSP_Fpga_Reg.B_dist_pow2); //cc = OSP_Lidar.device_read_fpga_reg(dHandler1, OSP_Fpga_Reg.B_rem_pow2); //cc = OSP_Lidar.device_read_fpga_reg(dHandler1, OSP_Fpga_Reg.B_out_amp_range_o); //cc = OSP_Lidar.device_read_fpga_reg(dHandler1, OSP_Fpga_Reg.B_output_phase_range); //设备信息结构体,可在设备连接之后通过device_get_info函数获取。 OSP_Lidar.device_get_info(dHandler1, ref p_device_inf); //必须要加否则数据结构不对 //读寄存器。 ////判断是否收敛 1为收敛 uint nC = OSP_Lidar.device_read_fpga_reg(dHandler1, OSP_Fpga_Reg.B_path_sel); int a = System.Environment.TickCount; //一个 32 位带符号整数,它包含自上次启动计算机以来所经过的时间(以毫秒为单位) for ( int i = 0; i < 1024; i++) { uint naddr = ( uint )(0xc0000000 + 4 * i); //Console.WriteLine(naddr.ToString("X") + " " + OSP_Lidar.device_read_fpga_reg(dHandler1, naddr)); } Console.WriteLine( "耗时:" + (System.Environment.TickCount - a) + "ms" ); //进入测量模式,进入该模式后,数据将由用户注册的回调函数返回给用户。在测量期间,用户无法调用除停止测量之外的其他接口。 OSP_Lidar.device_measure_mode_entry(dHandler1); } else { Console.Write( "device1_add failure!\n" ); } int nSecWait2Stop = ReadInt( "Basic" , "preserve_time" , 5, strConfigIniAddr); while (nSecWait2Stop > 0) { Thread.Sleep(1000); nSecWait2Stop--; } //退出测量模式。 OSP_Lidar.device_measure_mode_exit(dHandler1); //SDK逆初始化函数,该函数必须优先调用。 if (OSP_Lidar.device_deinit() != 0) { Console.Write( "device deinit error \n" ); return ; } else { Console.Write( "device deinit success ! \n" ); } WritePrivateProfileString( "Basic" , "IPV4" , ReadString( "Basic" , "IPV4" , strLidarIp1.ToString(), strConfigIniAddr), strConfigIniAddr); WritePrivateProfileString( "Basic" , "preserve_time" , ReadString( "Basic" , "preserve_time" , "5" , strConfigIniAddr), strConfigIniAddr); Console.Write( "Press any key to exit……\n" ); Console.Read(); } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了