View Javadoc

1   package cz.cuni.amis.pogamut.udk.agent.navigation.martinnavigator;
2   
3   import java.util.logging.Level;
4   import java.util.logging.Logger;
5   
6   import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
7   import cz.cuni.amis.pogamut.udk.agent.module.sensor.AgentInfo;
8   import cz.cuni.amis.pogamut.udk.agent.module.sensor.Players;
9   import cz.cuni.amis.pogamut.udk.agent.module.sensor.Senses;
10  import cz.cuni.amis.pogamut.udk.agent.navigation.IUDKPathRunner;
11  import cz.cuni.amis.pogamut.udk.bot.command.AdvancedLocomotion;
12  import cz.cuni.amis.pogamut.udk.bot.impl.UDKBot;
13  import cz.cuni.amis.pogamut.udk.communication.messages.gbcommands.Move;
14  import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.NavPointNeighbourLink;
15  import cz.cuni.amis.utils.NullCheck;
16  
17  public class MartinRunner implements IUDKPathRunner {
18    
19      /*========================================================================*/
20  
21      /**
22       * Initializes direct running to the given destination.
23       */
24      public void reset()
25      {
26      }
27  
28      /*========================================================================*/
29      
30      public boolean runToLocation (Location firstLocation, Location secondLocation, Location focus, NavPointNeighbourLink navPointsLink, boolean reachable)
31      {
32  
33      	// just keep running to location
34          bot.getAct().act(new Move().setFirstLocation(firstLocation).setSecondLocation(secondLocation).setFocusLocation(focus));        
35          return true;
36      }
37  
38      /*========================================================================*/
39  
40      /** Agent's bot. */
41      protected UDKBot bot;
42      /** Loque memory. */
43      protected AgentInfo memory;
44      /** Agent's body. */
45      protected AdvancedLocomotion body;
46      /** Agent's log. */
47      protected Logger log;
48      /** Base agent's senses. */
49  	protected Senses senses;
50  
51      /*========================================================================*/
52  
53      /**
54       * Constructor.
55       * @param bot Agent's bot.
56       * @param memory Loque memory.
57       */
58      public MartinRunner (UDKBot bot, AgentInfo agentInfo, AdvancedLocomotion locomotion, Logger log) {
59          // setup reference to agent
60      	NullCheck.check(bot, "bot");
61      	this.bot = bot;
62          NullCheck.check(agentInfo, "agentInfo");
63          this.memory = agentInfo;
64          NullCheck.check(locomotion, "locomotion");
65          this.body = new AdvancedLocomotion(bot, log);
66          this.senses = new Senses(bot, memory, new Players(bot), log);
67          this.log = log;
68      }
69      
70  }