-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the SGP4 library
- Loading branch information
Showing
4 changed files
with
74 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
github.com/SharkEzz/sgp4 v1.0.1 h1:Ws8mAUpvSzZ3ocbacb9FaWoqDYh5wj6xIjHARhXXVzY= | ||
github.com/SharkEzz/sgp4 v1.0.1/go.mod h1:Ij16kwC0HZob8vkFmHb5YjVyu2BmyUflL0RFpNim0dQ= | ||
github.com/joshuaferrara/go-satellite v0.0.0-20220611180459-512638c64e5b h1:JlltDRgni6FuoFwluvoZCrE6cmpojccO4WsqeYlFJLE= | ||
github.com/joshuaferrara/go-satellite v0.0.0-20220611180459-512638c64e5b/go.mod h1:msW2QeN9IsnRyvuK8OBAzBwn6DHwXpiAiqBk8dbLfrU= | ||
github.com/onsi/ginkgo v1.2.1-0.20160509182050-5437a97bf824 h1:MbMqwlWoESqhGm4Sslfdyeq7Ww8R9ppeKS5DcO3xDI0= | ||
github.com/onsi/ginkgo v1.2.1-0.20160509182050-5437a97bf824/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= | ||
github.com/onsi/gomega v0.0.0-20160516222431-c73e51675ad2 h1:38zSYUaJJkzreBjLz7tx4AUTVjnFI7EQBnlRoWt4QFA= | ||
github.com/onsi/gomega v0.0.0-20160516222431-c73e51675ad2/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= | ||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||
gopkg.in/yaml.v2 v2.0.0-20160301204022-a83829b6f129 h1:RBgb9aPUbZ9nu66ecQNIBNsA7j3mB5h8PNDIfhPjaJg= | ||
gopkg.in/yaml.v2 v2.0.0-20160301204022-a83829b6f129/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package satellite | ||
|
||
import ( | ||
goSatellite "github.com/joshuaferrara/go-satellite" | ||
"time" | ||
) | ||
|
||
func ParseTLE(line1, line2 string) (sat goSatellite.Satellite) { | ||
return goSatellite.TLEToSat(line1, line2, goSatellite.GravityWGS84) | ||
} | ||
|
||
func Propagate(sat goSatellite.Satellite, t time.Time) (position, velocity goSatellite.Vector3) { | ||
return goSatellite.Propagate(sat, t.Year(), int(t.Month()), t.Day(), t.Hour(), t.Minute(), t.Second()) | ||
} | ||
|
||
func TLEPropagate(line1, line2 string, t time.Time) (position, velocity goSatellite.Vector3) { | ||
tle := ParseTLE(line1, line2) | ||
return Propagate(tle, t) | ||
} | ||
|
||
func ECIToECEF(eciCoords goSatellite.Vector3, t time.Time) (ecfCoords goSatellite.Vector3) { | ||
return goSatellite.ECIToECEF(eciCoords, GSTimeFromDate(t)) | ||
} | ||
|
||
func ECIToLLA(eciCoords goSatellite.Vector3, t time.Time) (altitude, velocity float64, ret goSatellite.LatLong) { | ||
return goSatellite.ECIToLLA(eciCoords, GSTimeFromDate(t)) | ||
} | ||
|
||
func LatLongDeg(rat goSatellite.LatLong) (deg goSatellite.LatLong) { | ||
return goSatellite.LatLongDeg(rat) | ||
} | ||
|
||
type LLA struct { | ||
Latitude float64 | ||
Longitude float64 | ||
Altitude float64 | ||
} | ||
|
||
func LatLonAlt(line1, line2 string, t time.Time) (deg *LLA) { | ||
|
||
pos, _ := TLEPropagate(line1, line2, t) | ||
|
||
alt, _, ret := ECIToLLA(pos, t) | ||
|
||
latLong := LatLongDeg(ret) | ||
|
||
lla := &LLA{ | ||
Latitude: latLong.Latitude, | ||
Longitude: latLong.Longitude, | ||
Altitude: alt, | ||
} | ||
|
||
return lla | ||
} | ||
|
||
func GSTimeFromDate(t time.Time) float64 { | ||
return goSatellite.GSTimeFromDate(t.Year(), int(t.Month()), t.Day(), t.Hour(), t.Minute(), t.Second()) | ||
} |