public IEnumerator <ITask> DriveAllStopHandler(drive.AllStop allstop) { this.state.DriveState.TimeStamp = DateTime.Now; serialcomservice.SendAndGetRequest sg = new serialcomservice.SendAndGetRequest(); sg.Timeout = this.state.DefaultResponsePause; sg.Data = new serialcomservice.Packet(board.CreatePacket <sbyte>(board.SetFullStopString)); var resultPort = this.serialCOMServicePort.SendAndGet(sg); yield return(resultPort.Choice()); soap.Fault f = (soap.Fault)resultPort; if (f != null) { LogError(string.Format("Failed to send command: {0}", Encoding.ASCII.GetString(sg.Data.Message))); allstop.ResponsePort.Post(f); yield break; } if (this.HasFWError((serialcomservice.Packet)resultPort)) { f = soap.Fault.FromCodeSubcodeReason(soap.FaultCodes.Receiver, DsspFaultCodes.OperationFailed, "Error received from FW!"); allstop.ResponsePort.Post(f); yield break; } // Reflect into our state this.state.DriveState.LeftWheel.MotorState.CurrentPower = GDDriveFullStop; this.state.DriveState.RightWheel.MotorState.CurrentPower = GDDriveFullStop; this.state.DriveState.LeftWheel.WheelSpeed = 0; this.state.DriveState.RightWheel.WheelSpeed = 0; this.state.DriveState.IsEnabled = false; allstop.ResponsePort.Post(DefaultUpdateResponseType.Instance); }
public void DriveAllStopHandler(drive.AllStop allstop) { this.controllerDrivePort.Post( new drive.AllStop() { Body = allstop.Body, ResponsePort = allstop.ResponsePort }); }
public IEnumerator <ITask> AllStopHandler(drive.AllStop allStop) { drive.SetDrivePower zeroPower = new drive.SetDrivePower(); zeroPower.Body = new drive.SetDrivePowerRequest(0.0, 0.0); zeroPower.ResponsePort = allStop.ResponsePort; _mainPort.Post(zeroPower); yield break; }
public void DriveAllStopHandler(diffdrive.AllStop estop) { if (this.driveEntity == null) { throw new InvalidOperationException("Simulation entity not registered with service"); } this.driveEntity.SetMotorTorque(0, 0); this.driveEntity.SetVelocity(0); // AllStop disables the drive this.driveEntity.IsEnabled = false; this.UpdateStateFromSimulation(); estop.ResponsePort.Post(DefaultUpdateResponseType.Instance); // send update for entire state this.subMgrPort.Post(new submgr.Submit(this.state.DriveState, DsspActions.UpdateRequest)); }