Ejemplo n.º 1
0
        private static void processPlanning(string msg)
        {
            string[] tokens = null;

            if (MessageHandler.StartsWith(msg, "[plan_begin]", ref tokens))
            {
                //[plan_begin]CleaningRobot::RobotController#Controller CleanRooms.xml->Task[0]
                if (tokens.Length == 3)
                {
                    FrameStatePool.PlanBegin(tokens[0], tokens[1], tokens[2]);
                    _ms_planning = true;
                }
            }
            else if (FrameStatePool.PlanningProcess._planning != null)
            {
                if (MessageHandler.StartsWith(msg, "[plan_end]", ref tokens))
                {
                    //[plan_end]CleaningRobot::RobotController#Controller CleanRooms.xml->Task[0]
                    if (tokens.Length == 2)
                    {
                        FrameStatePool.PlanEnd(tokens[0], tokens[1]);
                        _ms_planning = false;
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_method_begin]", ref tokens))
                {
                    //[plan_method_begin]CleanRooms.xml->Method[13]
                    if (tokens.Length == 1)
                    {
                        FrameStatePool.PlanningMethodBegin(tokens[0]);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_method_end]", ref tokens))
                {
                    //[plan_method_end]CleanRooms.xml->Method[13] success
                    if (tokens.Length == 2)
                    {
                        FrameStatePool.PlanningMethodEnd(tokens[0], tokens[1]);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_node_begin]", ref tokens))
                {
                    //[plan_node_begin]CleanRooms.xml->Method[8]
                    if (tokens.Length == 1)
                    {
                        FrameStatePool.PlanningNodeBegin(tokens[0]);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_node_pre_failed]", ref tokens))
                {
                    //[plan_node_pre_failed]CleanRooms.xml->Method[1]
                    if (tokens.Length == 1)
                    {
                        FrameStatePool.PlanningNodePreFailed(tokens[0]);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_node_end]", ref tokens))
                {
                    //[plan_node_end]CleanRooms.xml->Method[1] failure
                    if (tokens.Length == 2)
                    {
                        FrameStatePool.PlanningNodeEnd(tokens[0], tokens[1]);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_referencetree_enter]", ref tokens))
                {
                    //[plan_referencetree_enter]CleanRooms.xml->ReferencedBehavior[10] MoveToRoom.xml
                    if (tokens.Length == 2)
                    {
                        string fullId           = tokens[0];
                        string behaviorFilename = tokens[1];

                        FrameStatePool.PlanningReferencedEnter(fullId, behaviorFilename);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_referencetree_exit]", ref tokens))
                {
                    //[plan_referencetree_exit]CleanRooms.xml->ReferencedBehavior[10] MoveToRoom.xml
                    if (tokens.Length == 2)
                    {
                        string fullId           = tokens[0];
                        string behaviorFilename = tokens[1];

                        FrameStatePool.PlanningReferencedExit(fullId, behaviorFilename);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_foreach_begin]", ref tokens))
                {
                    //[plan_foreach_begin]MoveToRoom.xml->DecoratorIterator[5] 0 2
                    if (tokens.Length == 3)
                    {
                        string indexStr = tokens[1];
                        string countStr = tokens[2];

                        FrameStatePool.PlanningForEachBegin(tokens[0], indexStr, countStr);
                    }
                }
                else if (MessageHandler.StartsWith(msg, "[plan_foreach_end]", ref tokens))
                {
                    //[plan_foreach_end]MoveToRoom.xml->DecoratorIterator[5] 0 2 success
                    if (tokens.Length == 4)
                    {
                        string indexStr = tokens[1];
                        string countStr = tokens[2];
                        string result   = tokens[3];

                        FrameStatePool.PlanningForEachEnd(tokens[0], indexStr, countStr, result);
                    }
                }
                else
                {
                    Debug.Check(false);
                }
            }
        }