コード例 #1
0
        private void VoiceCommandTrackHumansHandler(SpeechRecognizerDictionaryItem grammarItem, double angle)
        {
            Talker.Say(10, "Game On!");

            robotStrategyTypePrevious = RobotStrategyType.None;
            _mapperVicinity.robotState.robotStrategyType = RobotStrategyType.PersonFollowing;
        }
コード例 #2
0
 private void VoiceCommandBackUpHandler(SpeechRecognizerDictionaryItem grammarItem, double angle)
 {
     robotStrategyTypePrevious = _mapperVicinity.robotState.robotStrategyType;
     _mapperVicinity.robotState.robotStrategyType = RobotStrategyType.InTransition;
     SafePosture();
     Translate(-300, MaximumBackwardVelocityMmSec, true);  // use the shoot-and-forget version.
 }
コード例 #3
0
        private void VoiceCommandTurnRightHandler(SpeechRecognizerDictionaryItem grammarItem, double angle)
        {
            robotStrategyTypePrevious = _mapperVicinity.robotState.robotStrategyType;
            _mapperVicinity.robotState.robotStrategyType = RobotStrategyType.InTransition;
            SafePosture();
            int rotateAngle = 30;

            TurnByAngle(rotateAngle, ModerateTurnPower, true);  // use the shoot-and-forget version.
        }
コード例 #4
0
ファイル: Strategy.cs プロジェクト: yangyuanling/TrackRoamer
        /// <summary>
        /// Strategy chooses behavior for the moment and sets its parameters.
        /// Strategy would know goal and performance criteria to be able to estimate how far we are from the goal
        /// and change behavior if needed.
        ///
        /// Strategy is commanded by Interaction, which sets the objectives and chooses what game (strategy) to play.
        /// </summary>
        private void Strategy()
        {
            bool isNewStrategy = _mapperVicinity.robotState.robotStrategyType != strategyPrev;

            if (isNewStrategy)
            {
                strategyPrev = _mapperVicinity.robotState.robotStrategyType;
                HeadlightsOff();
                lastSafePosture = DateTime.Now;
                SafePosture();
                Talker.Say(10, "New strategy " + strategyPrev);
            }

            // as a minimum, a strategy should set a goal and a RobotTacticsType. Then rely on the tactics to avoid obstacles.
            // More sophisticated behavior will evaluate obstacles, and offer tactics a number of plans.

            switch (_mapperVicinity.robotState.robotStrategyType)
            {
            case RobotStrategyType.None:
                _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.None;         // active Stop
                if ((DateTime.Now - lastSafePosture).TotalSeconds > 5.0d)
                {
                    lastSafePosture = DateTime.Now;
                    SafePosture();
                }
                break;

            case RobotStrategyType.InTransition:
                _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.InTransition;         // do not command the Power Brick; leave it for Strategy.
                break;

            case RobotStrategyType.LayInWait:
                _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.LayInWait;
                break;

            case RobotStrategyType.GoalAndBack:
                // choose robotTacticsType - current tactics:
                _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.GoStraightToDirection;
                break;

            case RobotStrategyType.RouteFollowing:
                // follow GPS waypoints ("Mission"):
                StrategyRouteFollowing();
                break;

            case RobotStrategyType.PersonFollowing:
                if (isNewStrategy)
                {
                    StrategyPersonFollowingInit();
                }

                // follow a Kinect skeleton or a red shirt:
                StrategyPersonFollowing();
                break;

            case RobotStrategyType.PersonHunt:
                // choose robotTacticsType - current tactics:
                _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.None;
                break;

            case RobotStrategyType.RandomScan:
#if OBSOLETE_PLANANDAVOID_LOGIC
                // choose robotTacticsType - current tactics:
                _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.PlanAndAvoid;
#else // OBSOLETE_PLANANDAVOID_LOGIC
                _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.None;         // active Stop
#endif // OBSOLETE_PLANANDAVOID_LOGIC
                break;
            }

            // set parameters so that the tactics can perform:
        }
コード例 #5
0
ファイル: Strategy.cs プロジェクト: slgrobotics/TrackRoamer
        /// <summary>
        /// Strategy chooses behavior for the moment and sets its parameters.
        /// Strategy would know goal and performance criteria to be able to estimate how far we are from the goal
        /// and change behavior if needed.
        /// 
        /// Strategy is commanded by Interaction, which sets the objectives and chooses what game (strategy) to play.
        /// </summary>
        private void Strategy()
        {
            bool isNewStrategy = _mapperVicinity.robotState.robotStrategyType != strategyPrev;

            if (isNewStrategy)
            {
                strategyPrev = _mapperVicinity.robotState.robotStrategyType;
                HeadlightsOff();
                lastSafePosture = DateTime.Now;
                SafePosture();
                Talker.Say(10, "New strategy " + strategyPrev);
            }

            // as a minimum, a strategy should set a goal and a RobotTacticsType. Then rely on the tactics to avoid obstacles.
            // More sophisticated behavior will evaluate obstacles, and offer tactics a number of plans.

            switch (_mapperVicinity.robotState.robotStrategyType)
            {
                case RobotStrategyType.None:
                    _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.None;     // active Stop
                    if ((DateTime.Now - lastSafePosture).TotalSeconds > 5.0d)
                    {
                        lastSafePosture = DateTime.Now;
                        SafePosture();
                    }
                    break;

                case RobotStrategyType.InTransition:
                    _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.InTransition;     // do not command the Power Brick; leave it for Strategy.
                    break;

                case RobotStrategyType.LayInWait:
                    _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.LayInWait;
                    break;

                case RobotStrategyType.GoalAndBack:
                    // choose robotTacticsType - current tactics:
                    _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.GoStraightToDirection;
                    break;

                case RobotStrategyType.RouteFollowing:
                    // follow GPS waypoints ("Mission"):
                    StrategyRouteFollowing();
                    break;

                case RobotStrategyType.PersonFollowing:
                    if (isNewStrategy)
                    {
                        StrategyPersonFollowingInit();
                    }

                    // follow a Kinect skeleton or a red shirt:
                    StrategyPersonFollowing();
                    break;

                case RobotStrategyType.PersonHunt:
                    // choose robotTacticsType - current tactics:
                    _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.None;
                    break;

                case RobotStrategyType.RandomScan:
            #if OBSOLETE_PLANANDAVOID_LOGIC
                    // choose robotTacticsType - current tactics:
                    _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.PlanAndAvoid;
            #else // OBSOLETE_PLANANDAVOID_LOGIC
                    _mapperVicinity.robotState.robotTacticsType = RobotTacticsType.None;     // active Stop
            #endif // OBSOLETE_PLANANDAVOID_LOGIC
                    break;
            }

            // set parameters so that the tactics can perform:
        }
コード例 #6
0
 private void VoiceCommandTurnRightHandler(SpeechRecognizerDictionaryItem grammarItem, double angle)
 {
     robotStrategyTypePrevious = _mapperVicinity.robotState.robotStrategyType;
     _mapperVicinity.robotState.robotStrategyType = RobotStrategyType.InTransition;
     SafePosture();
     int rotateAngle = 30;
     TurnByAngle(rotateAngle, ModerateTurnPower, true);  // use the shoot-and-forget version.
 }
コード例 #7
0
        private void VoiceCommandTrackHumansHandler(SpeechRecognizerDictionaryItem grammarItem, double angle)
        {
            Talker.Say(10, "Game On!");

            robotStrategyTypePrevious = RobotStrategyType.None;
            _mapperVicinity.robotState.robotStrategyType = RobotStrategyType.PersonFollowing;
        }
コード例 #8
0
 private void VoiceCommandBackUpHandler(SpeechRecognizerDictionaryItem grammarItem, double angle)
 {
     robotStrategyTypePrevious = _mapperVicinity.robotState.robotStrategyType;
     _mapperVicinity.robotState.robotStrategyType = RobotStrategyType.InTransition;
     SafePosture();
     Translate(-300, MaximumBackwardVelocityMmSec, true);  // use the shoot-and-forget version.
 }