sgp4/sattrack/sattrack.cc

56 lines
1.7 KiB
C++
Raw Permalink Normal View History

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.
*/
#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()
{
libsgp4::Observer obs(51.507406923983446, -0.12773752212524414, 0.05);
libsgp4::Tle tle = libsgp4::Tle("UK-DMC 2 ",
"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");
libsgp4::SGP4 sgp4(tle);
2011-05-27 00:49:59 +00:00
std::cout << tle << std::endl;
for (int i = 0; i < 10; ++i)
2012-10-11 18:52:51 +00:00
{
libsgp4::DateTime dt = tle.Epoch().AddMinutes(i * 10);
2012-10-11 18:52:51 +00:00
/*
* calculate satellite position
*/
libsgp4::Eci eci = sgp4.FindPosition(dt);
2012-10-11 18:52:51 +00:00
/*
* get look angle for observer to satellite
*/
libsgp4::CoordTopocentric topo = obs.GetLookAngle(eci);
2012-10-11 18:52:51 +00:00
/*
* convert satellite position to geodetic coordinates
*/
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
}