public bool isStopped;                 //It is true if the walk is stopped

        //Default constructor
        public RunningZMP()
        {
            this.commandCreator = CommandCreater.getUniqueInstance();
            this.worldModel     = WorldModel.getUniqueInstance();
            this.planedCoM      = new CoM[2000];
            this.init();
        }
        // \define Initial the agent functionalities -------------------- MessageParser not implemented ...
        static bool init()
        {
            logMessage = new StreamWriter("message.txt");
            //logMessage.Close();

            // Initialize the agent's connection
            Console.WriteLine("'" + teamName + "' connecting to " + hostName + ":" + port + "...");
            serverCommunicationManager = ServerCommunicationManager.getUniqueInstance();

            if (!serverCommunicationManager.connect(hostName, port))
            {
                return(false);
            }

            Console.WriteLine("Done.\n");

            // Initialize the command's creator
            commandCreater = CommandCreater.getUniqueInstance();

            // Initialize the world model
            worldModel = WorldModel.getUniqueInstance();

            GameConfiguration.getUniqueInstance().init();

            sendMessage(GameConfiguration.getRSGPath());
            worldModel.setSelfNumber(unum);
            worldModel.setTeamName(teamName);

            // Receive the first messages from the simulator and extract the the primary information
            // to update the world model
            string strMessage = "";
            string firstChar  = strMessage;

            strMessage = readMessage();
            MessageParser parser = new MessageParser();

            parser.parseMessage(strMessage);
            //GameConfiguration.getUniqueInstance().init();

            // Send the first messages to the simulator to spawn the agent in simulator
            commandCreater.init(unum, teamName);
            sendMessage(commandCreater.getPreparedCommand());
            commandCreater.reset();
            strMessage = firstChar;
            strMessage = readMessage();
            parser.parseMessage(strMessage);
            commandCreater.beam(-8, 0, 0);
            sendMessage(commandCreater.getPreparedCommand());

            return(true);
        }
 public GameConfiguration()
 {
     worldModel = WorldModel.getUniqueInstance();
     rsgPath    = "(scene rsg/agent/nao/nao.rsg)";
 }
Esempio n. 4
0
 //Default constructor
 public MessageParser()
 {
     this.worldModel = WorldModel.getUniqueInstance();
 }
Esempio n. 5
0
 //Default constructor
 public CommandCreater()
 {
     this.commandString = "";
     this.command       = "";
     this.worldModel    = WorldModel.getUniqueInstance();
 }