public IEnumerator <ITask> AllStopHandler(drive.AllStop allStop)
 {
     drive.SetDrivePower zeroPower = new drive.SetDrivePower();
     zeroPower.Body         = new drive.SetDrivePowerRequest(0.0d, 0.0d);
     zeroPower.ResponsePort = allStop.ResponsePort;
     _mainPort.Post(zeroPower);
     yield break;
 }
Esempio n. 2
0
 public virtual IEnumerator <ITask> AllStopHandler(drive.AllStop update)
 {
     // Create a Drive request with both wheels stopped.
     // Call the SetDrivePowerHandler, but redirect the responses
     // to our response port.
     drive.SetDrivePower setDrivePower = new drive.SetDrivePower(new drive.SetDrivePowerRequest(), update.ResponsePort);
     SpawnIterator <drive.SetDrivePower>(setDrivePower, SetDrivePowerHandler);
     yield break;
 }
        public IEnumerator <ITask> AllStopHandler(diffdrive.AllStop estop)
        {
            if (_entity == null)
            {
                throw new InvalidOperationException("Simulation entity not registered with service");
            }

            _entity.SetMotorTorque(0, 0);
            _entity.SetVelocity(0);

            // AllStop disables the drive
            _entity.IsEnabled = false;

            UpdateStateFromSimulation();
            estop.ResponsePort.Post(DefaultUpdateResponseType.Instance);

            // send update for entire state
            _subMgrPort.Post(new submgr.Submit(_state, DsspActions.UpdateRequest));
            yield break;
        }
Esempio n. 4
0
        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)
            {
                ;
            }
        }