2013-04-01 10:33:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Daniel Warner <contact@danrw.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-10-25 19:40:47 +00:00
|
|
|
#include <CoordTopocentric.h>
|
2012-10-11 18:52:51 +00:00
|
|
|
#include <CoordGeodetic.h>
|
2011-12-31 16:42:18 +00:00
|
|
|
#include <Observer.h>
|
|
|
|
#include <SGP4.h>
|
2011-05-27 00:49:59 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
2011-12-15 22:46:42 +00:00
|
|
|
int main()
|
|
|
|
{
|
2022-11-13 11:09:27 +00:00
|
|
|
libsgp4::Observer obs(51.507406923983446, -0.12773752212524414, 0.05);
|
|
|
|
libsgp4::Tle tle = libsgp4::Tle("UK-DMC 2 ",
|
2012-10-24 17:01:17 +00:00
|
|
|
"1 35683U 09041C 12289.23158813 .00000484 00000-0 89219-4 0 5863",
|
|
|
|
"2 35683 98.0221 185.3682 0001499 100.5295 259.6088 14.69819587172294");
|
2022-11-13 11:09:27 +00:00
|
|
|
libsgp4::SGP4 sgp4(tle);
|
2011-05-27 00:49:59 +00:00
|
|
|
|
2012-10-24 17:01:17 +00:00
|
|
|
std::cout << tle << std::endl;
|
|
|
|
|
2017-01-08 14:17:03 +00:00
|
|
|
for (int i = 0; i < 10; ++i)
|
2012-10-11 18:52:51 +00:00
|
|
|
{
|
2022-11-13 11:09:27 +00:00
|
|
|
libsgp4::DateTime dt = tle.Epoch().AddMinutes(i * 10);
|
2012-10-11 18:52:51 +00:00
|
|
|
/*
|
|
|
|
* calculate satellite position
|
|
|
|
*/
|
2022-11-13 11:09:27 +00:00
|
|
|
libsgp4::Eci eci = sgp4.FindPosition(dt);
|
2012-10-11 18:52:51 +00:00
|
|
|
/*
|
|
|
|
* get look angle for observer to satellite
|
|
|
|
*/
|
2022-11-13 11:09:27 +00:00
|
|
|
libsgp4::CoordTopocentric topo = obs.GetLookAngle(eci);
|
2012-10-11 18:52:51 +00:00
|
|
|
/*
|
|
|
|
* convert satellite position to geodetic coordinates
|
|
|
|
*/
|
2022-11-13 11:09:27 +00:00
|
|
|
libsgp4::CoordGeodetic geo = eci.ToGeodetic();
|
2011-05-27 00:49:59 +00:00
|
|
|
|
2018-08-31 14:02:30 +00:00
|
|
|
std::cout << dt << " " << topo << " " << geo << std::endl;
|
2012-10-11 18:52:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return 0;
|
2011-05-27 00:49:59 +00:00
|
|
|
}
|