Added semi-working simulator for estimating robot travel distances

This commit is contained in:
2020-06-10 00:01:59 -05:00
parent 270f3b381f
commit 8d2a9fb1eb
6 changed files with 247 additions and 2 deletions

23
lib/simulator/robot.rb Normal file
View File

@@ -0,0 +1,23 @@
module TAC
class Simulator
class Robot
attr_accessor :position, :angle
def initialize(width:, depth:)
@width, @depth = width, depth
@position = CyberarmEngine::Vector.new
@angle = 0
end
def draw
Gosu.rotate(@angle, @position.x, @position.y) do
Gosu.draw_rect(@position.x - @width / 2, @position.y - @depth / 2, @width, @depth, Gosu::Color::GREEN)
end
end
def update
@angle %= 360.0
end
end
end
end