Newer
Older
Ruby / demo.rb
@SAITO Ichitaka SAITO Ichitaka on 22 Sep 2024 720 bytes 2024-09-22 01:28:48
#!/usr/bin/env ruby
require_relative 'tello.rb'

t = Tello.new

Signal.trap(:INT){
  STDERR.puts "緊急着陸します。"
  t.send_command("land")
  sleep 3
  exit 1
}

t.send_command("command")
print "Enterで離陸:"; gets
t.send_command("takeoff")

print "Enterで50cm上昇:"; gets
t.send_command("up 50")

print "Enterで前へ50cm:"; gets
t.send_command("forward 50")

print "Enterで左へ50cm:"; gets
t.send_command("left 50cm")

print "Enterで後ろへ50cmのあと右向け右:"; gets
t.send_command("back 50cm")
sleep 2
t.send_command("cw 90")

print "Enterで前へ50cm:"; gets
t.send_command("forward 50cm")

print "Enterで着陸:"; gets
t.send_command("ccw 90")
sleep 2
t.send_command("land")

t.close