class Localize

Public Class Methods

new(validity_proc) click to toggle source
Calls superclass method RubyHighSkill.new
# File high_skills/localize.rb, line 19
def initialize validity_proc
    super()
    @validity_proc = validity_proc
    @agentInfo = Java::sk.fiit.jim.agent.AgentInfo.getInstance
    @agentModel = Java::sk.fiit.jim.agent.models.AgentModel.getInstance
    
    @leftLook = false;
    @rightLook = false;
end

Public Instance Methods

ballInRange?(range) click to toggle source
# File high_skills/localize.rb, line 70
def ballInRange? range
  range.include?(Math.toDegrees(@ball.phi))
end
checkProgress() click to toggle source
# File high_skills/localize.rb, line 74
def checkProgress
  #do nothing
end
pickLowSkill() click to toggle source
# File high_skills/localize.rb, line 29
def pickLowSkill
  @ball = WorldModel.getInstance.getBall.getRelativePosition
  case
        when (not @validity_proc.call) : 
          puts "validity"
          return nil
        when EnvironmentModel.beamablePlayMode :
          puts "beam" 
          return nil
        when @agentModel.falled? :
          puts "fall" 
          return nil
    
        when !@leftLook :
          puts "left look"
          @leftLook = true
          return get_skill("head_left_120")
        when !@rightLook :
          puts "right look"
          @rightLook = true
          return get_skill("head_right_120")
            
               
       when (ballInRange? @@left and (ballInRange? @@front1 or ballInRange? @@front2)) :
         puts "vlavo vpredu" 
         return get_skill("turn_left_cont_20")
       when (ballInRange? @@right and (ballInRange? @@front1 or ballInRange? @@front2)) :
         puts "vpravo vpredu"  
         return get_skill("turn_right_cont_20")
       
       when (ballInRange? @@left and ballInRange? @@back) :
         puts "vlavo vzadu"  
         return get_skill("turn_left_90")
       when (ballInRange? @@right and ballInRange? @@back) :
         puts "vpravo vzadu"  
         return get_skill("turn_right_90")    
     end 
    return get_skill("turn_right_90")    
end