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); }
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); }
/// <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; } }
/// <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); }
public NaoStateTransition(NaoState currentState, NaoCommand command) { this._currentState = currentState; this._command = command; }
public static string GetText(this NaoCommand value) { return(NaoCommandAttribute.GetText(value)); }
protected void ExecuteCommand(NaoCommand command) { }
public NaoState MoveNext(NaoCommand command) { this.CurrentState = GetNext(command); return(CurrentState); }