コード例 #1
0
        public FindNaoMarkBackup(int markID, NaoConnectionHelper connection,
                                 float rotationAmount             = DEFAULT_ROTATION_AMOUNT,
                                 float maxRotation                = DEFAULT_MAX_ROTATION,
                                 float headPitchStepAmount        = DEFAULT_HEAD_PITCH_STEP_AMOUNT,
                                 float headYawStepAmount          = DEFAULT_HEAD_YAW_STEP_AMOUNT,
                                 float maxHeadYaw                 = DEFAULT_MAX_HEAD_YAW,
                                 LookDirection startLookDirection = LookDirection.Left)
        {
            if (!connection.TestConnection(string.Empty))
            {
                throw new ArgumentException("Could not connect to the robot!");
            }

            this._connection         = connection;
            this.RotationAmount      = rotationAmount;
            this.MaxRotation         = maxRotation;
            this.HeadPitchStepAmount = headPitchStepAmount;
            this.MarkID             = markID;
            this.HeadYawStepAmount  = headYawStepAmount;
            this.MaxHeadYaw         = maxHeadYaw;
            this.StartLookDirection = startLookDirection;

            // initialize background worker
            _findMarkWorker         = new BackgroundWorker();
            _findMarkWorker.DoWork += new DoWorkEventHandler(_findMarkWorker_DoWork);
            _findMarkWorker.WorkerSupportsCancellation = true;
            _findMarkWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(_findMarkWorker_RunWorkerCompleted);
        }
コード例 #2
0
ファイル: WalkToNaoMark.cs プロジェクト: rurdea/NaoCoopApp
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="connection">Robot connection</param>
        /// <param name="markInfo">Checkpoint mark information</param>
        /// <param name="startLookDirection">Start look direction</param>
        public WalkToNaoMark(NaoConnectionHelper connection, WalkToLandMarkInfo markInfo,
                             FindNaoMark.LookDirection startLookDirection = FindNaoMark.LookDirection.Left)
        {
            this.MarkInfo               = markInfo;
            this.StartLookDirection     = startLookDirection;
            this._robotConnectionHelper = connection;

            if (!_robotConnectionHelper.TestConnection(string.Empty))
            {
                throw new ArgumentException("Could not connect to the robot!");
            }

            _walkWorker.DoWork += new DoWorkEventHandler(_walkWorker_DoWork);
            _walkWorker.WorkerSupportsCancellation = true;
            _walkWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(_walkWorker_RunWorkerCompleted);
        }