class Goto

Public Class Methods

angle_range(from, to) click to toggle source
# File high_skills/GoTo.rb, line 7
def Goto.angle_range from, to
(from/180.0*Math::PI)..(to/180.0*Math::PI)
end
new() click to toggle source
Calls superclass method RubyHighSkill.new
# File high_skills/GoTo.rb, line 35
def initialize
  super()
  @tacticalInfo = Java::sk.fiit.jim.agent.models.TacticalInfo.getInstance
  @agentInfo = Java::sk.fiit.jim.agent.AgentInfo.getInstance
  
  @target_position = @tacticalInfo.getFormPosition()

end

Public Instance Methods

abs(number) click to toggle source
# File high_skills/GoTo.rb, line 128
def abs number
  Math.abs number
end
back?(target_position) click to toggle source
# File high_skills/GoTo.rb, line 113
def back? target_position
  Angles.angle_diff(target_phi, Math::PI) < Math::PI / 6.0
end
back_and_close?() click to toggle source
# File high_skills/GoTo.rb, line 93
def back_and_close?
  @@back_range.include?(@target_position_phi) and (@target_position.getR <= @@strafe_distance)
end
checkProgress() click to toggle source
# File high_skills/GoTo.rb, line 124
  def checkProgress
#    raise "Fallen!" if me.on_ground?
  end
close_enough?() click to toggle source
# File high_skills/GoTo.rb, line 85
def close_enough?
  @target_position.getR < 0.5
end
is_current_skill?(possibilities) click to toggle source
# File high_skills/GoTo.rb, line 80
def is_current_skill? possibilities
  current_skill_name = currentSkill.nil? ? "null" : currentSkill.name
  possibilities.member?(current_skill_name)
end
left_and_close?() click to toggle source
# File high_skills/GoTo.rb, line 97
def left_and_close?
  (@target_position.r <= @@strafe_distance) and @@left_strafe_range.include?(Angles.normalize(@target_position_phi))
end
left_and_distant?() click to toggle source
# File high_skills/GoTo.rb, line 105
def left_and_distant?
  @@left_range.include? Angles.normalize(@target_position_phi)
end
pickLowSkill() click to toggle source
# File high_skills/GoTo.rb, line 44
def pickLowSkill
  
   @tacticalInfo = Java::sk.fiit.jim.agent.models.TacticalInfo.getInstance
   @target_position = @tacticalInfo.getFormPosition()
   @target_position_phi = @target_position.getPhi()
   
   if @target_position_phi != nil
      @target_position_phi2 = @target_position_phi
   elsif @target_position_phi == nil and plan.see_ball?
      @target_position_phi = @target_position_phi2
   end

  case
              when me.on_ground?
              return  
      when @tacticalInfo.isOnPosition
              @agentInfo.loguj("close ")
                      return nil
      when left_and_close?:
              return get_skill("step_left")
      when right_and_close?:
              return get_skill("step_right")
      when straight?:
              return get_skill("walk_forward")
      when back_and_close?:
              return get_skill("walk_back")
      when left_and_distant?:
              return get_skill("turn_left_cont_20")
      when right_and_distant?:
              return get_skill("turn_right_cont_20")
      else
              return nil
      
  end   
end
right_and_close?() click to toggle source
# File high_skills/GoTo.rb, line 101
def right_and_close?
  (@target_position.r <= @@strafe_distance) and @@right_strafe_range.include?(Angles.normalize(@target_position_phi))
end
right_and_distant?() click to toggle source
# File high_skills/GoTo.rb, line 109
def right_and_distant?
  @@right_range.include? Angles.normalize(@target_position.getPhi())
end
straight?() click to toggle source
# File high_skills/GoTo.rb, line 89
def straight?
  @@straight_range1.include?(@target_position_phi) or @@straight_range2.include?(@target_position_phi)
end