예제 #1
0
        /// <summary>
        /// Implements the "Recovering" state.
        /// </summary>
        private void Recover()
        {
            LogInfo("TrackRoamerBehaviorsService: Recover()");

            Kata kata = KataHelper.KataByCollisionState(_state.collisionState, "avoid to").FirstOrDefault();

            if (kata != null)
            {
                Talker.Say(5, "Kata " + kata.name);

                SpawnIterator <Kata, Handler>(
                    kata,
                    delegate()
                {
                    //Talker.Say(5, "kata success: " + kata.success + "  count: " + kata.successfulStepsCount);
                    //Talker.Say(5, "kata success");
                    Tracer.Trace("kata " + kata.name + " success");
                },
                    KataRunner);        // KataRunner sets MovingState to MovingState.InTransition
            }
            else
            {
                Talker.Say(10, "no kata!");

                LogError("DriveBehaviorServiceBase: BehaviorKata() - cannot find appropriate Kata");
            }

            LogInfo("DriveBehaviorServiceBase: BehaviorKata() finished");
        }
예제 #2
0
        protected IEnumerator <ITask> BehaviorKata()
        {
            LogInfo("DriveBehaviorServiceBase: BehaviorKata() Started");

            Talker.Say(2, "starting Behavior Kata");

            // Wait for settling time
            yield return(Timeout(15000));

            /*
             * SpawnIterator<TurnAndMoveParameters, Handler>(
             *  new TurnAndMoveParameters()
             *  {
             *      rotateAngle = 30,
             *      rotatePower = MaximumTurnPower,
             *      speed = (int)Math.Round(ModerateForwardVelocity),
             *      desiredMovingState = MovingState.FreeForwards
             *  },
             *  delegate()
             *  {
             *  },
             *  TurnAndMoveForward);
             * */

            /*
             * Kata kata = new Kata() { name="My Kata" };
             *
             * kata.Add(new KataStep()
             *          {
             *              name = "Turn 30 backup 400",
             *              rotateAngle = 30,
             *              rotatePower = MaximumTurnPower,
             *              speed = (int)Math.Round(ModerateForwardVelocity),
             *              distance = -400,
             *              desiredMovingState = MovingState.Unknown
             *          }
             *      );
             *
             * kata.Add(new KataStep()
             *          {
             *              name = "Turn -30 forward 400",
             *              rotateAngle = -30,
             *              rotatePower = MaximumTurnPower,
             *              speed = (int)Math.Round(ModerateForwardVelocity),
             *              distance = 400,
             *              desiredMovingState = MovingState.Unknown
             *          }
             *      );
             */

            Kata kata = KataHelper.KataByName("avoid.*").FirstOrDefault();

            if (kata != null)
            {
                Talker.Say(5, "kata " + kata.name);

                SpawnIterator <Kata, Handler>(
                    kata,
                    delegate()
                {
                    Talker.Say(5, "kata success: " + kata.success + "  count: " + kata.successfulStepsCount);
                },
                    KataRunner);
            }
            else
            {
                LogError("DriveBehaviorServiceBase: BehaviorKata() - cannot find appropriate Kata");
            }

            LogInfo("DriveBehaviorServiceBase: BehaviorKata() finished");
        }