Exemplo n.º 1
0
        /// <summary>
        /// Keeps radar locked on a target. If you wish to move the radar independently from the robot make sure
        /// "IsAdjustRadarForGunTurn" is set to true.
        /// Since robots are 36*36 pixels and max velocity is 8px it is possible
        /// to always keep the radar on a target. Usually you'd call this method on the OnScannedRobot event
        /// </summary>
        /// <param name="targetBearingRadians"></param>
        internal void SetTurnMultiplierRadarLock(double targetBearingRadians)
        {
            var radarTurn =
                // Absolute bearing to target
                _robot.HeadingRadians + targetBearingRadians
                // Subtract current radar heading to get turn required
                - _robot.RadarHeadingRadians;

            _robot.SetTurnRadarRightRadians(2.0 * Utils.NormalRelativeAngle(radarTurn));
        }