我正在开发一个项目,简而言之,该项目由一台配有加速计和 USB GPS 单元(Tel0138 GPS 接收器)的盒式电脑(具有 4G 升级功能的 Dell Edge Gateway 5200)组成。 PC运行Windows 10 IoT,其中运行Debian11的VM。我有一个程序可以运行(并在 PC 重新启动时自动重新启动),该程序激活传感器进行数据收集并使用 gpsd 从 GPS 设备传输数据。值得注意的是,整个系统位于移动的车辆上,GPS 装置安装在车辆的顶部(外部)。 PC 4G 单元的 GNSS 端口还连接有 TE 贴片天线。
GPS 装置的功能似乎很差,它通常不会开始传输数据,而当它开始传输数据时,它似乎不正确,经常在有移动时显示一个位置数小时。它似乎无法找到信号,因为当我手动运行 gpsd 和 cgps 时,我只是得到一个空白屏幕,很长一段时间都没有修复。我想改进这一点。
GPS 装置已移至车辆顶部,因此我认为定位方面没有任何改进。对于激活该单元的代码非常简单,调用 cgps 并启动流,这在测试区域静止时确实有效,所以我认为原则上我无法在这里做出任何改进。
我不确定如何查询连接到PC芯片的贴片天线,我编写了一个使用Windows定位API的Powershell脚本,这已经取得了一些间歇性的成功,但我不确定是否有更简单的方法查询这个数据? USB 设备很容易通过 virtualbox 设置和运行,但是如上所述,它非常不可靠,是否有此类设备的高端供应商,特别是 USB GPS 设备?对于这个项目来说,钱不是问题,但是我只能找到与我目前拥有的相同类型的非常便宜的设备(低功率?)。
编辑: 我的 powershell 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Device.Location;
using System.Timers;
namespace Location
{
class Program
{
static (double, double, string) Location()
{
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));
GeoCoordinate coord = watcher.Position.Location;
DateTime currentDateTime = DateTime.Now;
string formattedDateTime = currentDateTime.ToString("dddd, dd MMMM yyyy HH:mm:ss");
double lat = coord.Latitude;
double lon = coord.Longitude;
Console.WriteLine("Lat: " + lat + ", Lon: " + lon);
Console.WriteLine(formattedDateTime);
(double, double, string) t1 = (lat, lon, formattedDateTime);
return t1;
}
static void Location_Write()
{
using (StreamWriter writer = new StreamWriter("C:\\Documents\\test.txt", true))
{
writer.WriteLine(Location());
}
}
public static void Main()
{
SetTimer();
Console.WriteLine("\nPress the Enter key to exit the application...\n");
Console.WriteLine("The application started at {0:HH:mm:ss.fff}", DateTime.Now);
Console.ReadLine();
//aTimer.Stop();
//aTimer.Dispose();
}
private static void SetTimer()
{ Timer aTimer = new System.Timers.Timer(1000);
aTimer.Elapsed += OnTimedEvent;
aTimer.AutoReset = true;
aTimer.Enabled = true;
}
private static void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
{ Location_Write();
}
}
}
我的 cgps 电话:
gpspipe -w | grep TPV > /output