コード例 #1
0
ファイル: NaoState.cs プロジェクト: rurdea/NaoCoopApp
        public static string GetText(NaoCommand command)
        {
            var type       = typeof(NaoCommand);
            var memInfo    = type.GetMember(command.ToString());
            var attributes = memInfo[0].GetCustomAttributes(typeof(NaoCommandAttribute), false);
            var text       = attributes != null && attributes.Length > 0 ? ((NaoCommandAttribute)attributes[0]).Text : command.ToString();

            return(text);
        }
コード例 #2
0
        public NaoState GetNext(NaoCommand command)
        {
            NaoStateTransition transition = new NaoStateTransition(CurrentState, command);
            NaoState           nextState;

            if (!this._transitions.TryGetValue(transition, out nextState))
            {
                throw new Exception("Invalid transition: " + this.CurrentState + " -> " + command);
            }
            return(nextState);
        }
コード例 #3
0
        /// <summary>
        /// Pauses the specified command
        /// </summary>
        /// <param name="command"></param>
        public void Pause(NaoCommand command)
        {
            switch (command)
            {
            case NaoCommand.GoToGrabLocation:
                if (this._walkToNaoMark != null)
                {
                    this._walkToNaoMark.StopWalking();
                }
                break;

            case NaoCommand.WalkWithObject:
                _objectHandlingExecuter.StopWalking();
                break;

            case NaoCommand.SynchRobot:
                this._robotSynch.CancelSynchronization();
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// Executes the specified command
        /// </summary>
        /// <param name="command"></param>
        /// <param name="commandParameters"></param>
        public void Execute(NaoCommand command, Dictionary <string, string> commandParameters)
        {
            switch (command)
            {
            case NaoCommand.GoToGrabLocation:
                GoToGrabLocation();
                break;

            case NaoCommand.GoToLiftPosition:
                break;

            case NaoCommand.SynchRobot:
                break;

            case NaoCommand.WalkToCheckpoint:
                break;

            case NaoCommand.WalkWithObject:
                break;
            }
            System.Threading.Thread.Sleep(1000);
        }
コード例 #5
0
 public NaoStateTransition(NaoState currentState, NaoCommand command)
 {
     this._currentState = currentState;
     this._command      = command;
 }
コード例 #6
0
 public static string GetText(this NaoCommand value)
 {
     return(NaoCommandAttribute.GetText(value));
 }
コード例 #7
0
 protected void ExecuteCommand(NaoCommand command)
 {
 }
コード例 #8
0
 public NaoState MoveNext(NaoCommand command)
 {
     this.CurrentState = GetNext(command);
     return(CurrentState);
 }