/// <summary>
        /// Handles the <typeparamref name="BumperUpdate"/> request.
        /// </summary>
        /// <param name="update">request</param>
        void BumperUpdateHandler(BumperUpdate update)
        {
            LogInfo("DriveBehaviorServiceBase: BumperUpdateHandler() HardwareIdentifier=" + update.Body.HardwareIdentifier);

            if (update.Body.HardwareIdentifier == 101)
            {
                _state.MostRecentWhiskerLeft = update.Body.Pressed;
            }

            if (update.Body.HardwareIdentifier == 201)
            {
                _state.MostRecentWhiskerRight = update.Body.Pressed;
            }

            if ((_testBumpMode || _state.IsMoving) && update.Body.Pressed)  // allow event to propagate while stationary, in test bump mode
            {
                //Talker.Say("sensor " + update.Body.HardwareIdentifier);

                Bumped(_state.MostRecentWhiskerLeft, _state.MostRecentWhiskerRight, null);
            }
            update.ResponsePort.Post(DefaultUpdateResponseType.Instance);
        }
Exemple #2
0
 /// <summary>
 /// Handles the <typeparamref name="BumperUpdate"/> request.
 /// </summary>
 /// <param name="update">request</param>
 void BumperUpdateHandler(BumperUpdate update)
 {
     LogInfo("Explorer: BumperUpdateHandler()");
     if (_state.IsMoving && update.Body.Pressed)
     {
         Bumped();
     }
     update.ResponsePort.Post(DefaultUpdateResponseType.Instance);
 }