Greetings to everyone, I would like to ask you for help. I want to track GPS in a closed position. I get latitude and longitude information from GPS in an open area. In a closed position, I want to get location information with the accelerometer and speedometer. When the object is going straight, the data coming from the sensor is very healthy. I can't get accurate results from time to time, so I'm sending you a part of the code. Does this make sense? I also examined the documentation of the sensor, but I couldn't get much results. Thank you in advance.
kordinat_t farkLocation(offlineParam_t *param){
lastLocation_t sürer;
nowLocat_t nowLocations;
statik uint32_t saniyeTimeSquared = 0;
kordinat_t startKordinat = {40.922305,29.317727};
kordinat_t lastKordinat;
statik kordinat_t yeniKonum;
static uint32_t saniyeTime=0;
saniyeTime=zamansayacı/SECONDS_PER_MINUTE;
saniyeTimeSquared = saniyeTime *saniyeTime;
nowLocations.nowX = 0.5 * param->acceleration_mg[0] * (saniyeTimeSquared )/EARTH_RADIUS_DIVISOR; //100 e bolmetre için
nowLocations.nowY = 0.5 * param->acceleration_mg[1] * (saniyeTimeSquared )/EARTH_RADIUS_DIVISOR;
nowLocations.nowZ = 0.5 * param->acceleration_mg[2] * (saniyeTimeSquared )/EARTH_RADIUS_DIVISOR;
lasts.lastX=nowLocations.nowX;
lasts.lastY=nowLocations.nowY;
lasts.lastZ=nowLocations.nowZ;
// Radyanların açık hesabıyla
double enlemRadyan = startKordinat.enlem * M_PI / 180.0;
double boylamRadyan = startKordinat.boylam * M_PI / 180.0;
double yonAcisiRadyan = atan2(sensorParam.data_raw_angular_rate[1], sensörParam.data_raw_angular_rate[0]);
// Hedef noktanın enlemi
double yeniEnlemRadyan = asin(sin(enlemRadyan) * cos(lasts.lastX / EARTH_RADIUS) +
cos(enlemRadyan) * sin(lasts.lastX / EARTH_RADIUS) * cos(yonAcisiRadyan));
// Hedef noktanın boylamı
double yeniBoylamRadyan = boylamRadyan + atan2(sin(yonAcisiRadyan) * sin(lasts.lastY / EARTH_RADIUS) * cos(enlemRadyan),
cos(lasts.lastY / EARTH_RADIUS) - sin(enlemRadyan) * sin(yeniEnlemRadyan));
// Radyanının değerlerinin değerini çevir
lastKordinat.enlem = yeniEnlemRadyan * 180.0 / M_PI;
lastKordinat.boylam = yeniBoylamRadyan * 180.0 / M_PI;
yeniKonum = sonKordinat;
yeniKonuma dön;
}
@