Sha256: a015d01a86db63ee11a05dd4f0a90cd6e1ec0f5be41c9128198a33171594397c
Contents?: true
Size: 630 Bytes
Versions: 5
Compression:
Stored size: 630 Bytes
Contents
module Roby module Test class Goto2D < Roby::Task terminates argument :x, :y def speed; State.goto_speed end def x; arguments[:x] end def y; arguments[:y] end poll do dx = x - State.pos.x dy = y - State.pos.y d = Math.sqrt(dx * dx + dy * dy) if d > speed State.pos.x += speed * dx / d State.pos.y += speed * dy / d else State.pos.x = x State.pos.y = y emit :success end STDERR.puts "#{x} #{y} #{speed} #{State.pos}" end module Planning planning_library method(:go_to) do Goto2D.new(arguments) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems