Class: Kuby::Link

Inherits:
Object
  • Object
show all
Includes:
ApiMethods, FlightMethods, NavbalMethods, PausedMethods, VesselMethods
Defined in:
lib/kuby/link.rb,
lib/kuby/link/api_methods.rb,
lib/kuby/link/flight_methods.rb,
lib/kuby/link/navbal_methods.rb,
lib/kuby/link/paused_methods.rb,
lib/kuby/link/vessel_methods.rb

Defined Under Namespace

Modules: ApiMethods, FlightMethods, NavbalMethods, PausedMethods, VesselMethods

Constant Summary collapse

MIN_TELEMACHUS_VERSION =
Gem::Version.new('1.4.6.0')

Constants included from PausedMethods

PausedMethods::PAUSE_STATES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from VesselMethods

#altitude, #angular_velocity, #atmospheric_density, #dynamic_pressure, #height, #lat, #long, #mission_time, #name, #orbital_velocity, #surface_speed, #surface_velocity, #surface_velocity_x, #surface_velocity_y, #surface_velocity_z, #terrain_height, #vertical_speed

Methods included from PausedMethods

#pause_state, #paused?

Methods included from NavbalMethods

#heading, #pitch, #roll

Methods included from FlightMethods

#abort, #brake, #set_throttle, #stage!, #throttle, #throttle_down, #throttle_full, #throttle_up, #throttle_zero, #toggle_gear, #toggle_light, #toggle_rcs, #toggle_sas

Methods included from ApiMethods

#version

Constructor Details

#initialize(options = {}) ⇒ Link

Returns a new instance of Link.



19
20
21
22
23
# File 'lib/kuby/link.rb', line 19

def initialize(options={})
  @host = options.fetch(:host, '127.0.0.1')
  @port = options.fetch(:port, 8085).to_i
  @path = 'telemachus/datalink'
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



11
12
13
# File 'lib/kuby/link.rb', line 11

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



11
12
13
# File 'lib/kuby/link.rb', line 11

def port
  @port
end

Instance Method Details

#connect!Object



25
26
27
28
29
30
31
32
33
# File 'lib/kuby/link.rb', line 25

def connect!
  # Raise error when the telemachus version is not supported, this also automatically
  # checks if the connection can be made
  unless supported_version?
    raise Kuby::UnsupportedTelemachusVersion.new("Please install Telemachus #{MIN_TELEMACHUS_VERSION} or higher")
  end

  true
end