class KickTournament

Public Class Methods

new(kick_target) click to toggle source
Calls superclass method RubyHighSkill.new
# File high_skills/kickTournament.rb, line 8
def initialize (kick_target)
        super()
        @agentInfo = Java::sk.fiit.jim.agent.AgentInfo.getInstance
@agentModel = Java::sk.fiit.jim.agent.models.AgentModel.getInstance
@mathModel = Java::sk.fiit.robocup.library.geometry.Vector3D.clone 
@worldModel = Java::sk.fiit.jim.agent.models.WorldModel.getInstance   
        
        @kick_target = kick_target
end

Public Instance Methods

checkProgress() click to toggle source
# File high_skills/kickTournament.rb, line 116
def checkProgress
#  raise "Fallen" if me.on_ground?
end
kick_dist(leg, ball_pos) click to toggle source
# File high_skills/kickTournament.rb, line 75
def kick_dist leg, ball_pos
      
      
       @kick_target
        ball_pos = @worldModel.getBall().getPosition
  puts "vzdialenost"
      puts @kick_target_dist = @agentInfo.calculateDistance(ball_pos,@kick_target)
      
      
      if(@kick_target_dist > 4 and leg == "right")
              puts "faster"
              get_skill("kick_step_strong_right")
              #get_skill("kick_right_faster")
      elsif (@kick_target_dist > 4 and leg=="left")
              puts "faster"
              get_skill("kick_step_strong_left")
              #get_skill("kick_left_faster")
      
      elsif(@kick_target_dist <= 4 and @kick_target_dist > 1.5  and leg=="right")
              puts "fast"
              get_skill("kick_right_faster")
              #get_skill("kick_right_normal")
      elsif(@kick_target_dist <= 4 and @kick_target_dist > 1.5  and leg=="left")
              puts "fast"
              get_skill("kick_left_faster")
              #get_skill("kick_left_normal")
      elsif(@kick_target_dist <= 1.5 and @kick_target_dist > 0.5 and leg=="right")
              puts "normal"
              get_skill("kick_right_normal")
              #get_skill("kick_right_slow")
      elsif (@kick_target_dist <= 1.5 and @kick_target_dist > 0.5 and leg=="left")
              puts "normal"
              get_skill("kick_left_normal")
              #get_skill("kick_left_slow")
      else
              return nil
      end

end
pickLowSkill() click to toggle source
# File high_skills/kickTournament.rb, line 18
def pickLowSkill
      
      
  
  ball_pos = @agentInfo.ballControlPosition()
 
  
      
  puts ball_pos.getY()
  puts ball_pos.getX()
  
  case
    when (EnvironmentModel.beamablePlayMode and not EnvironmentModel.isKickOffPlayMode) :
      puts "beam" 
      return nil
    when @agentModel.falled? :
      puts "fall"
      return nil
    when ball_unseen > 3 :
      puts "ball unseen"
      return nil

    when ball_pos.getY().abs > 0.7 
      puts "very big Y"
      return nil    
      when ball_pos.getX().abs > 0.7
            puts "very big X"
            return nil
                
        when (ball_pos.getY() < 0.7 and ball_pos.getY() > 0.35) 
      puts "go a bit"
      return get_skill("walk_slow2")
  
 
    when (ball_pos.getX() > 0.1 and ball_pos.getX() < 0.7)
      puts "big X"
      return get_skill("step_right")
    when (ball_pos.getX() < -0.1 and ball_pos.getX() > -0.7)
      puts "small X"
      return get_skill("step_left")
  
    when (ball_pos.getX() > 0.0) 
      puts "kick right"
      @ballR=ball_pos.getR()        
      kick_dist "right", ball_pos
    when (ball_pos.getX() < 0.0) 
      puts "kick left"        
      @ballR=ball_pos.getR()
      kick_dist "left", ball_pos
   
    else
      puts "wtf????"
      return nil
    end

end