ADD: added the whole tunction to calculate the movement with gegraphiclib
This commit is contained in:
@@ -100,8 +100,30 @@ namespace Entities
|
||||
|
||||
void Movement::updatePositionSimple(double dt)
|
||||
{
|
||||
double lat = ownPosition_.getGeodesicPos()(SimCore::LATITUDE); // in degree
|
||||
double lon = ownPosition_.getGeodesicPos()(SimCore::LONGITUDE); // in degree
|
||||
double alt = ownPosition_.getGeodesicPos()(SimCore::HEIGHT); // in meters
|
||||
|
||||
double vx = this->speed_ * cos(this->getPitch());
|
||||
double vy = this->speed_ * sin(this->getPitch());
|
||||
|
||||
LOG_S(INFO)<<"VX: " << vx << " VY: " <<vy;
|
||||
|
||||
double movedDistance = vx * dt / 1000;
|
||||
double climedHeight = vy * dt / 1000;
|
||||
|
||||
LOG_S(INFO)<<"moved distance: " <<movedDistance;
|
||||
GeographicLib::Geodesic geod(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
|
||||
|
||||
double lat2,lon2;
|
||||
|
||||
geod.Direct(lat,lon,this->course_,movedDistance,lat2,lon2);
|
||||
|
||||
LOG_S(INFO)<< "lat: "<<lat<<" lon: "<<lon;
|
||||
LOG_S(INFO)<< "lat: "<<lat2<<" lon: "<<lon2;
|
||||
ownPosition_.setGeodesicPos(lat2,lon2,climedHeight);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user