Class: Orbit::Satellite

Inherits:
Object
  • Object
show all
Defined in:
lib/orbit/satellite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tle_string) ⇒ Satellite

Returns a new instance of Satellite.



7
8
9
10
# File 'lib/orbit/satellite.rb', line 7

def initialize( tle_string )
  @tle = Tle.new(tle_string)
  @orbit = Orbit.new(@tle)
end

Instance Attribute Details

#orbitObject

Returns the value of attribute orbit.



5
6
7
# File 'lib/orbit/satellite.rb', line 5

def orbit
  @orbit
end

#tleObject

Returns the value of attribute tle.



4
5
6
# File 'lib/orbit/satellite.rb', line 4

def tle
  @tle
end

Instance Method Details

#current_positionObject



33
34
35
36
37
# File 'lib/orbit/satellite.rb', line 33

def current_position
  since_epoch = ( Time.new.utc.to_f - @tle.epoch.to_f )

  position_at_seconds_since_epoch( since_epoch )
end

#eci_position_at_seconds_since_epoch(time_since_epoch) ⇒ Object



18
19
20
21
22
# File 'lib/orbit/satellite.rb', line 18

def eci_position_at_seconds_since_epoch( time_since_epoch )
  t = time_since_epoch / 60.0

  p = @orbit.get_position( t ) #For whatever reason this is decimal minutes
end

#eci_position_at_time(time) ⇒ Object



12
13
14
15
16
# File 'lib/orbit/satellite.rb', line 12

def eci_position_at_time( time )
  since_epoch = ( time.utc.to_f - @tle.epoch.to_f )

  eci_position_at_seconds_since_epoch( since_epoch )
end

#position_at_seconds_since_epoch(time_since_epoch) ⇒ Object



29
30
31
# File 'lib/orbit/satellite.rb', line 29

def position_at_seconds_since_epoch( time_since_epoch )
  eci_position_at_seconds_since_epoch( time_since_epoch ).to_geo
end

#position_at_time(time) ⇒ Object



24
25
26
27
# File 'lib/orbit/satellite.rb', line 24

def position_at_time( time )
  seconds_since_epoch = ( time.utc.to_f - @tle.epoch.to_f )
  position_at_seconds_since_epoch( seconds_since_epoch )
end