IEnumerator <ITask> OnEStopHandler(OnEStop onEStop) { if (onEStop.DriveControl == _driveControl && _drivePort != null) { LogInfo("Requesting EStop"); drive.AllStopRequest request = new drive.AllStopRequest(); _drivePort.AllStop(request); } yield break; }
/// <summary> /// Handle Motion Commands /// </summary> /// <param name="onCommand">The motion command</param> /// <returns>An Iterator</returns> private IEnumerator <ITask> OnMotionCommandHandler(OnMotionCommand onCommand) { if (onCommand.DashboardForm == this.dashboardForm && this.drivePort != null) { switch (onCommand.Command) { case MOTIONCOMMANDS.Rotate: var rotRequest = new drive.RotateDegreesRequest { Degrees = onCommand.Parameter, Power = onCommand.Power * MotorPowerSaleFactor }; yield return(Arbiter.Choice(this.drivePort.RotateDegrees(rotRequest), EmptyHandler, LogError)); break; case MOTIONCOMMANDS.Translate: var transRequest = new drive.DriveDistanceRequest { Distance = onCommand.Parameter, Power = onCommand.Power * MotorPowerSaleFactor }; yield return(Arbiter.Choice(this.drivePort.DriveDistance(transRequest), EmptyHandler, LogError)); break; case MOTIONCOMMANDS.Enable: var request = new drive.EnableDriveRequest { Enable = true }; yield return(Arbiter.Choice(this.drivePort.EnableDrive(request), EmptyHandler, LogError)); break; default: LogInfo("Requesting EStop"); var stopRequest = new drive.AllStopRequest(); yield return(Arbiter.Choice(this.drivePort.AllStop(stopRequest), EmptyHandler, LogError)); break; } } yield break; }
public override void Stop() { drive.AllStopRequest allStopReq = new drive.AllStopRequest(); drive.AllStop allStop = new drive.AllStop(allStopReq); drivePort.Post(allStop); bool done = false; Arbiter.Activate(DssEnvironment.TaskQueue, Arbiter.Receive <DefaultUpdateResponseType>(false, allStop.ResponsePort, delegate(DefaultUpdateResponseType state) { done = true; } )); while (!done) { ; } }
IEnumerator<ITask> OnEStopHandler(OnEStop onEStop) { if (onEStop.DriveControl == _driveControl && _drivePort != null) { LogInfo("Requesting EStop"); drive.AllStopRequest request = new drive.AllStopRequest(); yield return Arbiter.Choice( _drivePort.AllStop(request), delegate(DefaultUpdateResponseType response) { }, delegate(Fault f) { LogError(f); } ); } }
/// <summary> /// DoStop /// </summary> /// <param name="done">Port to post success message to</param> /// <returns>True/False depending on whether the AllStop worked</returns> IEnumerator<ITask> DoStop(Port<bool> done) { drive.AllStopRequest stopReq = new drive.AllStopRequest(); string msg; msg = "Stop"; LogInfo(LogGroups.Console, msg); yield return Arbiter.Choice( _drivePort.AllStop(stopReq), delegate(DefaultUpdateResponseType success) { _state.DrivePowerLeft = 0; _state.DrivePowerRight = 0; _state.MoveState = MoveStates.Stop; done.Post(true); }, delegate(W3C.Soap.Fault failure) { // report error but report done anyway. we will attempt // to do the next step in wander behavior even if turn failed LogError("Failed to Stop!"); done.Post(false); }); }
// StopNow() is a quick stop that is called as soon as a // bumper press is detected. Unfortunately, inertia makes // the robot keep bumping up against the wall. This results // in a flood of messages. If there are to many to process, // there might still be some in the queue after the behavior // has finished, and the robot will stop even though it is // no longer in contact with the wall ... This leaves it // stranded and you have to start it again :-( void StopNow() { drive.AllStopRequest stopReq = new drive.AllStopRequest(); string msg; msg = "Stop"; LogInfo(LogGroups.Console, msg); // TT Jul-2007 - Oops! This Arbiter.Choice was not activated Arbiter.Activate(TaskQueue, Arbiter.Choice( _drivePort.AllStop(stopReq), delegate(DefaultUpdateResponseType success) { _state.DrivePowerLeft = 0; _state.DrivePowerRight = 0; _state.MoveState = MoveStates.Stop; }, delegate(W3C.Soap.Fault failure) { LogError("Failed to Stop!"); } ) ); }
IEnumerator<ITask> OnEStopHandler(OnEStop onEStop) { if (onEStop.DriveControl == _driveControl && _drivePort != null) { LogInfo("Requesting EStop"); drive.AllStopRequest request = new drive.AllStopRequest(); _drivePort.AllStop(request); } yield break; }