Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="target">has to be in range[0, 100][%]</param>
        public void SetTarget(double target)
        {
            if (Limiter.LimitAndReturnTrueIfLimitted(ref target, 0, 100))
            {
                Logger.Log(this, "target brake is not in range [0, 100]", 1);
            }

            double calculatedSteering;

            if (alertBrakeActive)
            {
                calculatedSteering = regulator.SetTargetValue(ALERT_BRAKE_BRAKE_SETTING);
            }
            else if (targetBrakeOverriden)
            {
                calculatedSteering = regulator.SetTargetValue(targetBrakeOverridenValue);
            }
            else
            {
                calculatedSteering = regulator.SetTargetValue(target);
            }

            //this will also invoke evNewBrakeSettingCalculated event
            BrakeSteering = calculatedSteering;
        }
Exemplo n.º 2
0
        private double ConvertReceivedBrakeAngleToRealBrakePosition(int value)
        {
            double val = Convert.ToDouble(value);

            if (Limiter.LimitAndReturnTrueIfLimitted(ref val, BRAKE_OUTPUT_MAX_PULLED, BRAKE_OUTPUT_MAX_PUSHED))
            {
                Logger.Log(this, "brake received value is out of range", 1);
            }
            return(ReScaller.ReScale(ref val, BRAKE_OUTPUT_MAX_PULLED, BRAKE_OUTPUT_MAX_PUSHED, BRAKE_POWER_WHEN_MAX_PULLED, BRAKE_POWER_WHEN_MAX_PUSHED));
        }
Exemplo n.º 3
0
        private double ConvertReceivedSteeringWheelAngleToRealWheelAngle(int value)
        {
            double val = Convert.ToDouble(value);

            if (Limiter.LimitAndReturnTrueIfLimitted(ref val, WHEEL_ANGLE_ON_MAX_LEFT, WHEEL_ANGLE_ON_MAX_RIGHT))
            {
                Logger.Log(this, String.Format(
                               "Steering wheel received value - {0} - is out of range [{1},{2}]",
                               val,
                               WHEEL_OUTPUT_WHEN_MAX_LEFT,
                               WHEEL_OUTPUT_WHEN_MAX_RIGHT),
                           1);
            }
            return(ReScaller.ReScale(ref val, WHEEL_OUTPUT_WHEN_MAX_LEFT, WHEEL_OUTPUT_WHEN_MAX_RIGHT, WHEEL_ANGLE_ON_MAX_LEFT, WHEEL_ANGLE_ON_MAX_RIGHT));
        }