Method: TelemetryProcessor.add_flyto

Defined in:
lib/kamelopard/helpers.rb

.add_flyto(p) ⇒ Object

This is the only function in the module that users are expected to call, and even then users should probably use the tour_from_points function. The p argument contains an ordered array of points, where each point is represented as an array consisting of longitude, latitude, and altitude, in that order. This will add a series of gx:FlyTo objects following the path determined by those points. – XXX Have some way to adjust FlyTo duration based on the distance between points, or based on user input. ++



332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/kamelopard/helpers.rb', line 332

def TelemetryProcessor.add_flyto(p)
    p2 = TelemetryProcessor::normalize_points p
    p = p2
    heading = get_heading p
    tilt = get_tilt p
    # roll = get_roll(last_last_lon, last_last_lat, last_lon, last_lat, lon, lat)
    roll = get_roll p
    #p = Kamelopard::Point.new last_lon, last_lat, last_alt, { :altitudeMode => :absolute }
    point = Kamelopard::Point.new p[1][0], p[1][1], p[1][2], { :altitudeMode => :absolute }
    c = Kamelopard::Camera.new point, { :heading => heading, :tilt => tilt, :roll => roll, :altitudeMode => :absolute }
    f = Kamelopard::FlyTo.new c, { :duration => @@options[:pause], :mode => :smooth }
    f.comment = "#{p[1][0]} #{p[1][1]} #{p[1][2]} to #{p[2][0]} #{p[2][1]} #{p[2][2]}"
end