• Stars
    star
    17
  • Rank 1,217,181 (Top 25 %)
  • Language
    C++
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Satellite prediction library for crystal using the sgp4 model

predict.cr

Predict is a satellite prediction library for crystal using the sgp4 model. The model used is the updated combined sgp/sdp4 model from the celestrak website.

Predict can track the latitude, longitude and altitude of satellites, and also calculate look angles (azimuth, elevation, range) from an observer on the earth's surface.

Installation

Add this to your application's shard.yml:

dependencies:
  predict:
    github: RX14/predict.cr
    version: 0.1.3

Usage

require "predict"

# All values truncated to 4 decimal places for readability

# Parse TLE
tle = Predict::TLE.parse_three_line <<-TLE
  ISS (ZARYA)
  1 25544U 98067A   16339.72355294  .00003337  00000-0  58323-4 0  9990
  2 25544  51.6456 287.6667 0006011 291.2532 140.8410 15.53794284 31519
  TLE
  
# Inspect TLE data
tle.name # => "ISS (ZARYA)"
tle.catalog_number # => 25544
tle.mean_motion # => 15.5379

# Create satellite from TLE, this initialises the orbital model
satellite = Predict::Satellite.new(tle)

# Create a prediction from the TLE
time = Time.new(2016, 12, 5, 12, 0, 0)
satellite_position, satellite_velocity = satellite.predict(time)

satellite_position # => Predict::TEME(@x=3815.7998, @y=1932.0874, @z=5261.6006)

# Predict ground track
satellite_position.to_lat_long_alt(time) # => Predict::LatLongAlt(@latitude=0.8913, @longitude=2.3062, @altitude=415.4529)

# Predict look angles from an observer (200m altitude)
observer = Predict::LatLongAlt.from_degrees(52.9, -2.24, 200.0)
observer.look_at(satellite_position, time) # => Predict::LookAngle(@azimuth=0.50118495648349193, @elevation=-0.55812612380797122, @range=7501.0178628601843)

# Predict next pass time
start_time, end_time = satellite.next_pass(at: observer, after: time)
start_time # => 2016-12-05 16:23:55
end_time # => 2016-12-05 16:32:29

# And the one after that...
start_time, end_time = satellite.next_pass(at: observer, after: end_time)
start_time # => 2016-12-05 17:58:46
end_time # => 2016-12-05 18:09:15

Development

SGP4 is bound as a static library in src/predict/ext. Use make with the optional make variables release=true or debug=true to build the static library. Make sure you run the specs and formatter before sending PRs.

Useful reading material on sgp4 and coordinate systems is http://celestrak.com/columns/.

Contributing

  1. Fork it ( https://github.com/RX14/predict.cr/fork )
  2. Create your feature branch (git checkout -b feature/foo)
  3. Commit your changes (git commit)
  4. Push to the branch (git push origin feature/foo)
  5. Create a new Pull Request

Contributors

  • RX14 - creator, maintainer

More Repositories

1

parallel.cr

Parallelism for crystal as a shard
Crystal
62
star
2

camo.cr

A crystal version of atmos/camo, faster and with better request lifecycle tracing
Crystal
39
star
3

discord-curses

Terminal-based discord client (abandoned)
TypeScript
26
star
4

fast_irc.cr

A fast IRC parsing library for crystal.
Crystal
20
star
5

coz.cr

Crystal
17
star
6

multipart.cr

MIME multipart and multipart/form-data support for Crystal
Crystal
10
star
7

jMCLaunchLib

Launch Minecraft from the JVM. With a library.
Groovy
9
star
8

crane

WIP Crystal version manager
Crystal
5
star
9

Kitsune

Crystal
3
star
10

dotfiles

git clone --bare https://github.com/RX14/dotfiles ~/.local/share/dotfiles && git --git-dir="$HOME/.local/share/dotfiles" --work-tree="$HOME" checkout
Shell
3
star
11

RX14

Issue tracker dedicated to the chibi with the alias of RX14
2
star
12

rory

Crystal
2
star
13

rx14.co.uk

Source for rx14.co.uk
HTML
2
star
14

PS2-lib

A PS/2 library for Arduino, with Mouse and Keyboard libraries.
C++
2
star
15

pomfire

B2-backed caching (incomplete) pomf
Crystal
2
star
16

ModMaven

Gradle Scripts to upload minecraft mod libraries to a maven repository.
Shell
2
star
17

clamd.cr

Crystal
2
star
18

guix-docker

Shell
1
star
19

wifi-headphones

Jupyter Notebook
1
star
20

MangaCrawler

C#
1
star
21

docker-alpine-crystal

Shell
1
star
22

genetic-algorithm-test

Crystal
1
star
23

docker-jenkins-slave

Shell
1
star
24

clamd-continuousd

Crystal
1
star
25

L298N-lib

Arduino library for using the L298N motor driver
C++
1
star
26

satserver-api

Crystal
1
star
27

kurisu.rx14.co.uk

Shell
1
star
28

pomf-standard

1
star
29

gwt

Crystal
1
star
30

kagi-developer-assement

HTML
1
star
31

SWRChart

A VB.net Program for Charting Frequency/SWR values over COM.
Visual Basic
1
star
32

gd32vf103-devboard

1
star
33

crystal-jenkins

Shell
1
star
34

rpn.cr

Crystal
1
star
35

kepala

Crystal
1
star
36

environment-sensor

HTML
1
star