我正在开发一个Android应用程序来根据传感器的数据计算位置加速度计 - >计算线性加速度磁力计+加速度计 - >运动方向初始位置将取自GPS(纬度+经度)。现在根据传感器的读数,我需要计算智能手机的新位置:我的算法遵循 - (但不计算准确位置):请帮我改进它。注意: 我的算法代码在C#中(我将传感器数据发送到服务器 - 数据存储在数据库中。我正在计算服务器上的位置)所有DateTime对象都是使用TimeStamps计算的 - 从01-01-1970 var prevLocation = ServerHandler.getLatestPosition(IMEI); var newLocation = new ReceivedDataDTO() { LocationDataDto = new LocationDataDTO(), UsersDto = new UsersDTO(), DeviceDto = new DeviceDTO(), SensorDataDto = new SensorDataDTO() }; //First Reading if (prevLocation.Latitude == null) { //Save GPS Readings newLocation.LocationDataDto.DeviceId = ServerHandler.GetDeviceIdByIMEI(IMEI); newLocation.LocationDataDto.Latitude = Latitude; newLocation.LocationDataDto.Longitude = Longitude; newLocation.LocationDataDto.Acceleration = float.Parse(currentAcceleration); newLocation.LocationDataDto.Direction = float.Parse(currentDirection); newLocation.LocationDataDto.Speed = (float) 0.0; newLocation.LocationDataDto.ReadingDateTime = date; newLocation.DeviceDto.IMEI = IMEI; // saving to database ServerHandler.SaveReceivedData(newLocation); return; } //If Previous Position not NULL --> Calculate New Position **//Algorithm Starts HERE** var oldLatitude = Double.Parse(prevLocation.Latitude); var oldLongitude = Double.Parse(prevLocation.Longitude); var direction = Double.Parse(currentDirection); Double initialVelocity = prevLocation.Speed; //Get Current Time to calculate time Travelling - In seconds var secondsTravelling = date - tripStartTime; var t = secondsTravelling.TotalSeconds;这是我得到的结果 - >电话没有移动。你可以看到速度是27.3263111114502 所以计算速度有问题,但我不知道是什么
3 回答
临摹微笑
TA贡献1982条经验 获得超2个赞
加速度传感器和陀螺仪不适合位置计算。
几秒钟后,错误变得令人难以置信。(我几乎不记得双重整合是问题)。
看看这个关于传感器融合的Google技术谈话视频,他非常详细地解释了为什么这是不可能的。
- 3 回答
- 0 关注
- 490 浏览
添加回答
举报
0/150
提交
取消