示例#1
0
        protected override void StopCore()
        {
            //左转和右转进行了灯光检测
            var isCheckedLeftIndicatorLight  = CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight);
            var isCheckedRightIndicatorLight = CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight);

            var isCheckedLeftIndicatorLightEnough  = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
            var isCheckedRightIndicatorLightEnough = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);

            if (!(isCheckedLeftIndicatorLight || isCheckedRightIndicatorLight))
            {
                BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020503);
            }
            else
            {
                if (!(isCheckedLeftIndicatorLightEnough || isCheckedRightIndicatorLightEnough))
                {
                    BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020603);
                }
            }
            //夜考双闪
            if (Settings.ChangeLanesLowAndHighBeamCheck && Context.ExamTimeMode == ExamTimeMode.Night)
            {
                if (!AdvancedSignal.CheckHighBeam(StartTime))
                {
                    BreakRule(DeductionRuleCodes.RC41603);
                }
            }
            base.StopCore();
        }
示例#2
0
        protected override void StopCore()
        {
            var isOk = CheckSpeedLimit();

            if (!isOk)
            {
                CheckRule(true, DeductionRuleCodes.RC41001);
            }

            //喇叭检测
            if ((CheckLoudSpeakerInDay && Context.ExamTimeMode == ExamTimeMode.Day) ||
                (CheckLoudSpeakerInNight && Context.ExamTimeMode == ExamTimeMode.Night))
            {
                var hasLoudSpeaker = CarSignalSet.Query(StartTime).Any(x => x.Sensor.Loudspeaker);
                if (!hasLoudSpeaker)
                {
                    CheckRule(true, DeductionRuleCodes.RC30212);
                }
            }
            //夜间远近光交替
            if (CheckLowAndHighBeam && Context.ExamTimeMode == ExamTimeMode.Night)
            {
                var hasLowAndHighBeam = AdvancedSignal.CheckHighBeam(StartTime);
                if (!hasLowAndHighBeam)
                {
                    CheckRule(true, DeductionRuleCodes.RC41603);
                }
            }

            base.StopCore();
        }
示例#3
0
        protected override void StopCore()
        {
            if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.RightIndicatorLight) >= Constants.ErrorSignalCount)
            {
                //打错转向灯
                BreakRule(DeductionRuleCodes.RC30205);
            }
            else
            {
                //检测转向灯
                if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.LeftIndicatorLight) < Constants.ErrorSignalCount)
                {
                    //是否打转向灯
                    BreakRule(DeductionRuleCodes.RC30205);
                }
                else
                {
                    var isOk = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                    if (!isOk)
                    {
                        BreakRule(DeductionRuleCodes.RC30206);
                    }
                }
            }


            base.StopCore();
        }
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            if (sensor.LeftIndicatorLight)
            {
                _isLeft = true;
            }
            if (sensor.RightIndicatorLight ||
                sensor.CautionLight ||
                sensor.FogLight)
            {
                return(false);
            }

            if (!sensor.LowBeam ||
                !sensor.OutlineLight)
            {
                return(false);
            }

            double timeout = LightTimeout;
            ////作对就通过,不能检测7秒前的,不然会检测到上一次操作的远光(中控还没有配置时间和操作)
            //if (Settings.SimulationLightPassway == 1)
            //    timeout = 3;

            var result = AdvancedSignal.CheckHighBeam(timeout, 1) && _isLeft;

            return(result);
        }
示例#5
0
        protected override void StopCore()
        {
            //最后判断是否有打转向灯
            if (Settings.ChangeLanesAngle == 0)
            {
                //如果没打左转
                if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                {
                    BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                }
                else
                {
                    if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                    {
                        BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020604);
                    }
                }

                //
            }
            //夜考双闪
            if (Settings.ChangeLanesLowAndHighBeamCheck && Context.ExamTimeMode == ExamTimeMode.Night)
            {
                if (!AdvancedSignal.CheckHighBeam(StartChangeLanesTime))
                {
                    BreakRule(DeductionRuleCodes.RC41603);
                }
            }
            Logger.InfoFormat("变道结束  当前流程状态;{0} 设定角度:{1} 开始角度:{2} 结束角度:{3}", StepState.ToString(), Settings.ChangeLanesAngle, StartChangeLanesAngle, CarSignalSet.Current.BearingAngle);

            base.StopCore();
        }
示例#6
0
        /// <summary>
        /// 检测右转(动方向或者车停时检测)
        /// </summary>
        protected void CheckRightIndicatorLight()
        {
            if (IsRightIndicatorLightChecked)
            {
                return;
            }

            //如果扣分了
            //IsRightIndicatorLightChecked = true;
            if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight))
            {
                IsRightIndicatorLightChecked = true;
                BreakRule(DeductionRuleCodes.RC40610);
            }
            else
            {
                var advancedSignal = Singleton.GetAdvancedCarSignal;
                var rightIndicator = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                if (!rightIndicator)
                {
                    IsRightIndicatorLightChecked = true;
                    BreakRule(DeductionRuleCodes.RC40611);
                }
            }
        }
示例#7
0
        protected void CheckRight()
        {
            indicatorChecked = true;
            //
            if (hasLeftIndicator && CarSignalSet.Query(StartTime).Count(d => d.Sensor.LeftIndicatorLight) >= Constants.ErrorSignalCount)
            {
                BreakRule(DeductionRuleCodes.RC30205);
            }
            else
            {
                if (!hasRightIndicator && CarSignalSet.Query(StartTime).Count(d => d.Sensor.RightIndicatorLight) < Constants.ErrorSignalCount)
                {
                    //是否打转向灯
                    //
                    BreakRule(DeductionRuleCodes.RC30205);
                    //是否
                }

                else
                {
                    //检测时间
                    var isOk = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                    if (!isOk)
                    {
                        BreakRule(DeductionRuleCodes.RC30206);
                    }
                }
            }
        }
示例#8
0
        protected override void StopCore()
        {
            //判断车辆是否返回原车道
            if (OvertakeStepState == OvertakeStep.EndChangeLanesToLeft)
            {
                BreakRule(DeductionRuleCodes.RC41408);
            }

            //检查喇叭
            if (!IsLoudSpeakerCheck)
            {
                if (Settings.OvertakeLoudSpeakerNightCheck && Context.ExamTimeMode == ExamTimeMode.Night)
                {
                    BreakRule(DeductionRuleCodes.RC30212);
                }
                if (Settings.OvertakeLoudSpeakerDayCheck && Context.ExamTimeMode == ExamTimeMode.Day)
                {
                    BreakRule(DeductionRuleCodes.RC30212);
                }
            }

            //夜考双闪
            if (Settings.OvertakeLowAndHighBeamCheck && Context.ExamTimeMode == ExamTimeMode.Night)
            {
                if (!AdvancedSignal.CheckHighBeam(StartTime))
                {
                    BreakRule(DeductionRuleCodes.RC41603);
                }
            }
            base.StopCore();
        }
示例#9
0
        protected override void StopCore()
        {
            //全程没有达到最低速度
            if (!IsArrivedLowSpeed)
            {
                CheckRule(true, DeductionRuleCodes.RC30116);
            }
            if (IsDefaultRule)
            {
                if (!IsSuccess)
                {
                    //BreakRule(DeductionRuleCodes.RC30103);
                }
            }
            else
            {
                //如果不是默认规则就只需要检查转向灯
                if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                {
                    BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                    Logger.InfoFormat("OverTakeTest Not LeftIndicatorLight");
                }
                else
                {
                    if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                    {
                        BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020604);
                        Logger.InfoFormat("OverTakeTest LeftIndicatorLight Time:{0}", Settings.TurnLightAheadOfTime);
                    }
                }
            }

            //检查喇叭
            if (!IsLoudSpeakerCheck)
            {
                if (Settings.OvertakeLoudSpeakerNightCheck && Context.ExamTimeMode == ExamTimeMode.Night)
                {
                    BreakRule(DeductionRuleCodes.RC30212);
                }
                if (Settings.OvertakeLoudSpeakerDayCheck && Context.ExamTimeMode == ExamTimeMode.Day)
                {
                    BreakRule(DeductionRuleCodes.RC30212);
                }
            }

            //夜考双闪
            if (Settings.OvertakeLowAndHighBeamCheck && Context.ExamTimeMode == ExamTimeMode.Night)
            {
                if (!AdvancedSignal.CheckHighBeam(StartTime))
                {
                    BreakRule(DeductionRuleCodes.RC41603);
                }
            }
            Logger.InfoFormat("超车结束  当前流程状态:{0} 设定角度:{1} 开始角度:{2} 结束角度:{3}", OvertakeStepState.ToString(), Settings.OvertakeChangeLanesAngle, StartChangeLanesAngle, CarSignalSet.Current.BearingAngle);

            //Speaker.PlayAudioAsync(EndVoiceFile, Infrastructure.Speech.SpeechPriority.Highest);
            base.StopCore();
        }
示例#10
0
        protected override void StopCore()
        {
            if (Settings.SharpTurnLeftLightCheck && !Settings.SharpTurnRightLightCheck)
            {
                if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.LeftIndicatorLight) < Constants.ErrorSignalCount)
                {
                    //是否打转向灯
                    BreakRule(DeductionRuleCodes.RC30205);
                }
                else
                {
                    var isOk = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                    if (!isOk)
                    {
                        BreakRule(DeductionRuleCodes.RC30206);
                    }
                }
            }
            //检测转向灯
            if (Settings.SharpTurnRightLightCheck && !Settings.SharpTurnLeftLightCheck)
            {
                if (CarSignalSet.Query(StartTime).Count(d => d.Sensor.RightIndicatorLight) < Constants.ErrorSignalCount)
                {
                    //是否打转向灯
                    BreakRule(DeductionRuleCodes.RC30205);
                    //是否
                }

                else
                {
                    //检测时间
                    var isOk = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                    if (!isOk)
                    {
                        BreakRule(DeductionRuleCodes.RC30206);
                    }
                }
            }
            //这样左转和右转只要随便开了一个就可以
            if (Settings.SharpTurnLeftLightCheck && Settings.SharpTurnRightLightCheck)
            {
                var isOkRight = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                var isOkLeft  = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                if (!isOkLeft && !isOkRight)
                {
                    BreakRule(DeductionRuleCodes.RC30206);
                }
            }


            base.StopCore();
        }
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            if (sensor.LowBeam)
            {
                isOpenLowBem = true;
            }

            var result = AdvancedSignal.CheckHighBeam(LightTimeout, 1);

            if (result && isOpenLowBem)
            {
                return(true);
            }
            return(false);
        }
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            if (sensor.LeftIndicatorLight ||
                sensor.RightIndicatorLight ||
                sensor.CautionLight ||
                sensor.FogLight)
            {
                return(false);
            }


            var result = AdvancedSignal.CheckHighBeam(LightTimeout, 2);

            if (result && sensor.LowBeam)
            {
                return(true);
            }
            return(false);
        }
示例#13
0
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            if (sensor.LeftIndicatorLight)
            {
                isOpenLeftIndicatorLight = true;
            }
            if (sensor.RightIndicatorLight)
            {
                isOpenRightIndicatorLight = true;
            }
            //远近光交替
            var result = AdvancedSignal.CheckHighBeam(LightTimeout, 1);

            if (result && isOpenLeftIndicatorLight && isOpenRightIndicatorLight)
            {
                return(true);
            }

            return(false);
        }
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            if (sensor.LeftIndicatorLight ||
                sensor.RightIndicatorLight ||
                sensor.FogLight)
            {
                return(false);
            }

            if (!sensor.LowBeam ||
                !sensor.OutlineLight)
            {
                return(false);
            }
            //由于程序检测语音播完时,可能第一次闪光都已经操作过了,所以时间往前推1秒,20160801,李
            double LightTimeout_new = LightTimeout + 1;
            var    result           = AdvancedSignal.CheckHighBeam(LightTimeout_new, 2) && !sensor.HighBeam;

            return(result);
        }
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            if (sensor.LeftIndicatorLight ||
                sensor.RightIndicatorLight ||
                sensor.CautionLight ||
                sensor.FogLight)
            {
                return(false);
            }

            if (!sensor.LowBeam ||
                !sensor.OutlineLight)
            {
                return(false);
            }
            //var result = AdvancedSignal.CheckHighBeam(LightTimeout, 1);
            //由于设定7秒,会检测到上一个远光操作,如果连续几个远近光一次,会出现第2次不操作也会算对的情况,改为3秒
            var result = AdvancedSignal.CheckHighBeam(3, 1);

            return(result);
        }
示例#16
0
        private bool CheckGears()
        {
            var query = from a in AdvancedSignal.GetGearChangedStates(StartTime)
                        where a.Gear != Gear.Neutral &&
                        a.PeriodMilliseconds >= ModifiedGearIgnoreMilliseconds
                        group a by a.Gear
                        into g
                        select new
            {
                Gear         = g.Key,
                Milliseconds = g.Max(x => x.PeriodMilliseconds),
                Count        = g.Count()
            };

            var gearStates = query.ToArray();

            Logger.InfoFormat("加减档:{0}", string.Join(",", gearStates.Select(x => string.Format("{0}-{1}-{2}", x.Gear.ToDisplayGearText(), x.Count, x.Milliseconds))));

            //加一次,减一次档就可以了,20161230
            if (InitGear.HasValue)
            {
                var tempGear = gearStates.FirstOrDefault().Gear;
                if (InitGear != tempGear && !GearRecord.Contains(tempGear))
                {
                    InitGear = tempGear;
                    GearRecord.Add(tempGear);
                }
                if (GearRecord.Count >= 2)
                {
                    return(true);
                }
            }
            if (!InitGear.HasValue && gearStates.Length > 0)
            {
                InitGear = gearStates.FirstOrDefault().Gear;
            }
            return(false);
        }
示例#17
0
        //CheckGear
        private bool CheckGears()
        {
            var query = from a in AdvancedSignal.GetGearChangedStates(StartTime)
                        where a.Gear != Gear.Neutral &&
                        a.PeriodMilliseconds >= ModifiedGearIgnoreMilliseconds
                        group a by a.Gear
                        into g
                        select new
            {
                Gear         = g.Key,
                Milliseconds = g.Max(x => x.PeriodMilliseconds),
                Count        = g.Count()
            };

            var gearStates = query.ToArray();

            //Logger.InfoFormat("加减档:{0}", string.Join(",", gearStates.Select(x => string.Format("{0}-{1}-{2}", x.Gear.ToDisplayGearText(), x.Count, x.Milliseconds))));
            if (gearStates.Length < ModifiedGears.Count)
            {
                return(false);
            }

            foreach (var item in ModifiedGears)
            {
                var a = gearStates.FirstOrDefault(x => x.Gear == item.Item1);
                if (a == null)
                {
                    return(false);
                }

                if (a.Count < item.Item2)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#18
0
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            if (sensor.LeftIndicatorLight ||
                sensor.RightIndicatorLight ||
                sensor.CautionLight ||
                sensor.FogLight)
            {
                return(false);
            }

            if (!sensor.LowBeam ||
                !sensor.OutlineLight)
            {
                return(false);
            }

            //Light
            //
            //
            //LightTimeout = 3;
            var result = AdvancedSignal.CheckHighBeam(LightTimeout, 1);

            return(result);
        }
示例#19
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (!IsLoudSpeakerCheck && signalInfo.Sensor.Loudspeaker)
            {
                IsLoudSpeakerCheck = true;
            }
            //过滤10m
            if (!isOverPrepareDistance)
            {
                //超车10米后才评判
                if (signalInfo.Distance - StartDistance < Settings.OvertakePrepareDistance)
                {
                    return;
                }
                if (signalInfo.BearingAngle.IsValidAngle())
                {
                    isOverPrepareDistance = true;
                    StartAngle            = signalInfo.BearingAngle;
                }
                return;
            }
            //检测是否超速
            if (Settings.OvertakeSpeedLimit > 0 && signalInfo.SpeedInKmh > Settings.OvertakeSpeedLimit)
            {
                CheckRule(true, DeductionRuleCodes.RC30116);
            }

            //超车只要达到最低速度就可以了
            if (Settings.OvertakeLowestSpeed >= 0 && signalInfo.SpeedInKmh > Settings.OvertakeLowestSpeed)
            {
                IsArrivedLowSpeed = true;
            }

            //检测开始超车转向角度
            if (OvertakeStepState == OvertakeStep.None)
            {
                if (signalInfo.BearingAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.OvertakeChangeLanesAngle))
                {
                    //检测是否反向超车,20161107
                    //if (Settings.ReverseOvertakeCheck)
                    //{
                    //    var current = Locator.Current.Resolve<DirectionJudgeClass>();
                    //    var direction = current.JudgeDirectoin(StartAngle, signalInfo.BearingAngle, Settings.OvertakeChangeLanesAngle, Settings.AngleSource);
                    //    if (direction == Direction.Right)
                    //    {
                    //        CheckRule(true, DeductionRuleCodes.RC41409);
                    //    }
                    //}
                    //设置开始变道时的距离
                    OvertakeStepState          = OvertakeStep.StartChangeLanesToLeft;
                    StartChangingLanesDistance = signalInfo.Distance;

                    if (Settings.OvertakeLightCheck && !IsCheckedOvertakeLeftLight)
                    {
                        IsCheckedOvertakeLeftLight = true;
                        //超车,左转向灯***********/
                        if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                        {
                            BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                            Logger.InfoFormat("OverTakeTest Not LeftIndicatorLight");
                        }
                        else
                        {
                            if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                            {
                                BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020604);
                                Logger.InfoFormat("OverTakeTest LeftIndicatorLight Time:{0}", Settings.TurnLightAheadOfTime);
                            }
                        }
                    }
                }
            }
            else if (OvertakeStepState == OvertakeStep.StartChangeLanesToLeft)
            {
                //当开始变道后向前行驶15米则认为变道成功
                Logger.DebugFormat("OvertakeDistince :{0}", signalInfo.Distance - StartChangingLanesDistance);
                if (signalInfo.Distance - StartChangingLanesDistance >= ChangingLanesDistance &&
                    signalInfo.BearingAngle.IsValidAngle())
                {
                    OvertakeStepState     = OvertakeStep.EndChangeLanesToLeft;
                    StartChangeLanesAngle = signalInfo.BearingAngle;
                }
            }
            else if (OvertakeStepState == OvertakeStep.EndChangeLanesToLeft)
            {
                //结束考试项目
                IsSuccess = true;
                return;
            }



            base.ExecuteCore(signalInfo);
        }
示例#20
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if ((int)PullOverStepState >= (int)PullOverStep.StopCar)
            {
                if (!isSpeakHandBrake && signalInfo.Sensor.Handbrake)
                {
                    isSpeakHandBrake = true;
                    //请操作完成后下车
                    Speaker.PlayAudioAsync("请操作完成后下车", SpeechPriority.Normal);
                }
            }

            if (PullOverStepState == PullOverStep.None)
            {
                ///拉手刹结束启动靠边停车检测
                if (signalInfo.Sensor.Handbrake)
                {
                    PullOverStepState = PullOverStep.StopCar;
                    StopCarTime       = DateTime.Now;
                    Messenger.Send(new EngineRuleMessage(false));
                    Logger.DebugFormat("{0}-关闭发动机熄火评判规则", Name);
                }
            }
            else if (PullOverStepState == PullOverStep.StopCar)
            {
                //停车转向灯检查
                PullOverStepState = PullOverStep.OpenPullOverLight;
                if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight))
                {
                    BreakRule(DeductionRuleCodes.RC40610);
                }
                else
                {
                    var rightIndicator = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                    if (!rightIndicator)
                    {
                        BreakRule(DeductionRuleCodes.RC40611);
                    }
                }
            }
            else if (PullOverStepState == PullOverStep.OpenPullOverLight)
            {
                CheckHandbrake(signalInfo);
            }
            else if (PullOverStepState == PullOverStep.PullHandbrake)
            {
                //判断靠边停车是否结束
                CheckEndMark(signalInfo);
            }
            else if (PullOverStepState == PullOverStep.CheckStop)
            {
                if (!_isCheckedPulloverStop)
                {
                    _isCheckedPulloverStop = true;
                    CheckPullOverStop(signalInfo);
                }

                if (!(Settings.PullOverEndMark == PullOverEndMark.None ||
                      Settings.PullOverEndMark == PullOverEndMark.OpenCloseDoorCheck))
                {
                    StopCore();
                    return;
                }

                if (!OpenDoorTime.HasValue)
                {
                    OpenDoorTime = DateTime.Now;
                }

                if (!signalInfo.Sensor.Door)
                {
                    PullOverStepState = PullOverStep.CloseDoor;
                    Messenger.Send(new DoorChangedMessage(signalInfo.Sensor.Door));
                    StopCore();
                    return;
                }

                //在规定的时间内没有关闭车门
                if (CloseDoorTimeOut())
                {
                    BreakRule(DeductionRuleCodes.RC40605);
                    StopCore();
                }
            }
        }
示例#21
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (Constants.ChangeLaneDistance == 0)
            {
                Constants.ChangeLaneDistance = signalInfo.Distance;
            }
            if (stopDelayDistance.HasValue)
            {
                if ((signalInfo.Distance - stopDelayDistance.Value) > 10)
                {
                    StopCore();
                }
            }
            if (signalInfo.CarState == CarState.Stop)
            {
                return;
            }
            //播报第2次语音
            if (IsSecondVoice == false && !string.IsNullOrEmpty(Settings.ChangeLanesSecondVoice) && Settings.ChangeLanesPrepareDistance > 1)
            {
                IsSecondVoice = true;
                Speaker.PlayAudioAsync(Settings.ChangeLanesSecondVoice, SpeechPriority.Normal);
            }
            //过滤10m
            if (!isOverPrepareDistance)
            {
                if (signalInfo.Distance - StartChangeLanesDistance < Settings.ChangeLanesPrepareDistance)
                {
                    return;
                }
                else
                {
                    isOverPrepareDistance = true;
                    StartChangeLanesAngle = signalInfo.BearingAngle;
                    return;
                }
            }
            //不要超时避免误判
            //不要吵
            //if (IsTimeOut())
            //{
            //    if (!IsSuccess)
            //    {
            //        BreakRule(DeductionRuleCodes.RC40503);
            //    }

            //    StopCore();
            //    return;
            //}

            //变更车道超距
            if (IsOverDistance(signalInfo))
            {
                if (!IsSuccess)
                {
                    BreakRule(DeductionRuleCodes.RC40503);
                }
                StopCore();
                return;
            }
            Logger.InfoFormat("变道流程状态: {0}", StepState.ToString());
            //Logger.Error("变道流程状态"+StepState.ToString()+"ChangeLanes" + signalInfo.BearingAngle.ToString()+ "StartChangeLanesAngle:"+ StartChangeLanesAngle.ToString()+ "Settings.ChangeLanesAngle:" + Settings.ChangeLanesAngle.ToString());
            if (Settings.ChangeLanesAngle > 0)
            {
                if (StepState == ChangeLanesStep.None)
                {
                    //变道摆正10米后才进行下面的检测(转向灯评判太快,车还没摆正)
                    if (ChangeStartDistance.HasValue)
                    {
                        if (signalInfo.Distance - ChangeStartDistance.Value > Settings.ChangeLanesPrepareDistance)
                        {
                            StepState = ChangeLanesStep.StartChangeLanes;
                        }
                    }
                    //判断车辆是否在进行变道
                    if (signalInfo.BearingAngle.IsValidAngle() &&
                        StartChangeLanesAngle.IsValidAngle() &&
                        !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartChangeLanesAngle, Settings.ChangeLanesAngle))
                    {
                        StepState            = ChangeLanesStep.StartChangeLanes;
                        ChangeStartDistance  = signalInfo.Distance;
                        ChangeLanesStartTime = DateTime.Now;
                    }
                }
                else if (StepState == ChangeLanesStep.StartChangeLanes)
                {
                    StepState = ChangeLanesStep.EndChangeLanes;
                    if (Settings.ChangeLanesLightCheck)
                    {
                        //只能左转
                        if (Settings.ChangelineDirect.Equals(1))
                        {
                            //是否打转向灯
                            var hasTurnLight  = CarSignalSet.Query(StartChangeLanesTime).Any(d => d.Sensor.LeftIndicatorLight);
                            var hasErrorLight = CarSignalSet.Query(StartChangeLanesTime).Any(d => d.Sensor.RightIndicatorLight);
                            if (!hasTurnLight || hasErrorLight)
                            {
                                BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020503);
                            }
                            else
                            {
                                //转向灯是否超过3秒
                                var hasIndicatorLight = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                                if (hasIndicatorLight)
                                {
                                    return;
                                }
                                BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020603);
                            }
                        }//只能右转
                        else if (Settings.ChangelineDirect.Equals(2))
                        {
                            //是否打转向灯
                            var hasTurnLight  = CarSignalSet.Query(StartChangeLanesTime).Any(d => d.Sensor.RightIndicatorLight);
                            var hasErrorLight = CarSignalSet.Query(StartChangeLanesTime).Any(d => d.Sensor.LeftIndicatorLight);
                            if (!hasTurnLight || hasErrorLight)
                            {
                                BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020503);
                            }
                            else
                            {
                                //转向灯是否超过3秒
                                var hasIndicatorLight = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                                if (hasIndicatorLight)
                                {
                                    return;
                                }
                                BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020603);
                            }
                        }
                        else
                        {
                            //是否打转向灯
                            var hasTurnLight = CarSignalSet.Query(StartChangeLanesTime).Any(d => d.Sensor.LeftIndicatorLight || d.Sensor.RightIndicatorLight);
                            if (!hasTurnLight)
                            {
                                BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020503);
                            }
                            else
                            {
                                //转向灯是否超过3秒
                                var hasIndicatorLight = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight || x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                                if (hasIndicatorLight)
                                {
                                    return;
                                }
                                BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020603);
                            }
                        }
                    }
                }
                else
                {
                    IsSuccess = true;
                    //完成变道,结束该项目
                    if (Settings.ChkChangeLanesEndFlag && !stopDelayDistance.HasValue)
                    {
                        stopDelayDistance = signalInfo.Distance;
                    }
                    return;
                }
            }
            else if (Settings.ChangeLanesAngle == 0)
            {
                IsSuccess = true;
            }

            base.ExecuteCore(signalInfo);
        }
示例#22
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (!InitializedExamParms)
            {
                return;
            }

            //喇叭检测
            if (signalInfo.Sensor.Loudspeaker)
            {
                IsLoudSpeakerCheck = true;
            }

            //检测远近光交替
            if (Settings.TurnRoundLightCheck && !IsCheckedLowAndHighBeam)
            {
                IsCheckedLowAndHighBeam = signalInfo.Sensor.HighBeam;
            }

            //检测右转
            if (Settings.TurnRoundErrorLight && !IsCheckedTurnRoundLight)
            {
                if (signalInfo.Sensor.RightIndicatorLight)
                {
                    IsCheckedTurnRoundLight = true;
                    CheckRule(true, DeductionRuleCodes.RC41503);
                }
            }

            ///停车不检测角度
            if (signalInfo.CarState == CarState.Stop)
            {
                return;
            }

            if (StepState == TurnRoundStep.None)
            {
                //检测方向角是否开始调头
                //Gps角度其实也是可以通过一些方法滤波的
                if (signalInfo.BearingAngle.IsValidAngle() && StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.TurnRoundStartAngleDiff))
                {
                    StepState = TurnRoundStep.StartTurnRound;
                }
            }
            else if (StepState == TurnRoundStep.StartTurnRound)
            {
                //开始掉头检测灯光
                if (!IsCheckedTurnRoundLight)
                {
                    IsCheckedTurnRoundLight = true;
                    if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                    {
                        CheckRule(true, DeductionRuleCodes.RC41503);
                    }
                    else
                    {
                        var isOk = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                        if (!isOk)
                        {
                            BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020607);
                        }
                    }
                    ////
                    //if (CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight))
                    //{
                    //    BreakRule(DeductionRuleCodes.RC30206);
                    //}
                }

                //检测是否掉头完毕
                if (signalInfo.BearingAngle.IsValidAngle() &&
                    StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.TurnRoundEndAngleDiff))
                {
                    if (Settings.TurnRoundBrakeRequired &&
                        !CarSignalSet.Query(StartTime).Any(x => x.Sensor.Brake))
                    {
                        BreakRule(DeductionRuleCodes.RC41505);
                    }
                    StepState = TurnRoundStep.EndTurnRound;
                }
            }
            else
            {
                StopCore();
            }

            base.ExecuteCore(signalInfo);
        }
示例#23
0
        protected override bool CheckLights(IList <string> propertyNames, CarSensorInfo sensor)
        {
            var result = AdvancedSignal.CheckHighBeam(LightTimeout, 1);

            return(result);
        }
示例#24
0
        protected override void StopCore()
        {
            //达到一次速度判断
            if (Settings.OvertakeSpeedOnce > 10 && IsCheckOverSpeed == false)
            {
                IsCheckOverSpeed = true;
                if (_reachSpeedSet.Count < 12)
                {
                    CheckRule(true, DeductionRuleCodes.RC30116);
                }
                ;
            }
            //判断车辆是否返回原车道
            if (Settings.OvertakeChangeLanesAngle > 0)
            {
                if (OvertakeStepState == OvertakeStep.EndChangeLanesToLeft)
                {
                    BreakRule(DeductionRuleCodes.RC41408);
                }
                if (!IsSuccess)
                {
                    CheckRule(true, DeductionRuleCodes.RC30103, DeductionRuleCodes.SRC3010302);
                }
            }
            //如果角度设置为0 只需要检测转向灯
            if (Settings.OvertakeChangeLanesAngle == 0)
            {
                //TODO:海南海口版本特殊要求 其他地方不适合
                //检测左转
                if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                {
                    BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                }
                else
                {
                    if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                    {
                        BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020604);
                    }
                }
                //判断是否返回原车到    //检测右转
                if (Settings.OvertakeBackToOriginalLane)
                {
                    if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight))
                    {
                        BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                    }
                    else
                    {
                        if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                        {
                            BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020604);
                        }
                    }
                }
            }


            //检查喇叭
            if (!IsLoudSpeakerCheck)
            {
                if (Settings.OvertakeLoudSpeakerNightCheck && Context.ExamTimeMode == ExamTimeMode.Night)
                {
                    BreakRule(DeductionRuleCodes.RC30212);
                }
                if (Settings.OvertakeLoudSpeakerDayCheck && Context.ExamTimeMode == ExamTimeMode.Day)
                {
                    BreakRule(DeductionRuleCodes.RC30212);
                }
            }

            //夜考双闪
            if (Settings.OvertakeLowAndHighBeamCheck && Context.ExamTimeMode == ExamTimeMode.Night)
            {
                if (!AdvancedSignal.CheckHighBeam(StartTime))
                {
                    BreakRule(DeductionRuleCodes.RC41603);
                }
            }
            base.StopCore();
        }
示例#25
0
        /// <summary>
        /// 项目执行
        /// </summary>
        /// <param name="signalInfo"></param>
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (!InitializedExamParms)
            {
                return;
            }

            if (IsSuccess || CommonModifiedGearStep == ModifiedGearStep.Finished)
            {
                return;
            }

            //如果没有启用自定义流程 /**********
            if (string.IsNullOrEmpty(Settings.ModifiedGearGearFlow))
            {
                IsSuccess = true;
                //IsSuccess = CheckGears();
                return;
            }

            var query = from a in AdvancedSignal.GetGearChangedStates(StartTime)
                        where a.Gear != Gear.Neutral &&
                        a.PeriodMilliseconds >= ModifiedGearIgnoreMilliseconds
                        group a by a.Gear
                        into g
                        select new
            {
                Gear         = g.Key,
                Milliseconds = g.Max(x => x.PeriodMilliseconds),
                Count        = g.Count()
            };

            if (query.Count() == 0)
            {
                return;
            }
            var NowGear = query.ToArray().FirstOrDefault().Gear;

            signalInfo.Sensor.IsNeutral = signalInfo.Sensor.Clutch;
            if (signalInfo.Sensor.IsNeutral)
            {
                NowGear = Gear.Neutral;
            }
            if (NowGear == Gear.Neutral)
            {
                return;
            }
            if (NowGear != LastGear)
            {
                if (IsPlayGearVocie)
                {
                    string GearVocie = string.Format("{0}档", Convert.ToInt32(NowGear));
                    Speaker.PlayAudioAsync(GearVocie);
                }
                if (GearFlowIndex == -1)
                {
                    SetGearFlowIndex(NowGear);
                }
                CheckFlowGear(NowGear);
                LastGear = NowGear;
            }
        }
示例#26
0
        protected void ChangeLineAngleCheck(CarSignalInfo signalInfo)
        {
            //由于停车和起步的时候会报触发规则,所以过滤
            //全程变道最低速度

            if (signalInfo.SpeedInKmh < 10)
            {
                return;
            }
            //过滤掉变更车道和会车,超车,掉头,左转,右转,起步,靠边停车
            if (tempExamitemSkip)
            {
                return;
            }
            //因为掉头,变道,角度达到就结束了,太快,所以延迟15s
            if (tempExamItem && finishTime.HasValue)
            {
                if ((DateTime.Now - finishTime.Value).TotalSeconds > 15)
                {
                    finishTime            = null;
                    tempExamItem          = false;
                    StartChangeLanesAngle = signalInfo.BearingAngle;
                }
                else
                {
                    return;
                }
            }
            //播报后进行延时
            if (IsChangeLineSpeak)
            {
                if ((DateTime.Now - delayDateTime).TotalSeconds > 12)
                {
                    IsChangeLineSpeak = false;
                    //重置角度
                    RecordSignalCount     = 0;
                    RecordSignalTime      = DateTime.Now;
                    StartChangeLanesAngle = signalInfo.BearingAngle;
                }
                else
                {
                    //重置角度
                    RecordSignalCount     = 0;
                    RecordSignalTime      = DateTime.Now;
                    StartChangeLanesAngle = signalInfo.BearingAngle;
                    return;
                }
            }
            RecordSignalCount++;
            if (!RecordSignalTime.HasValue)
            {
                RecordSignalTime = DateTime.Now;
            }
            //过滤掉大于30度的跳动
            if (GeoHelper.GetDiffAngle(StartChangeLanesAngle, signalInfo.BearingAngle) > 30)
            {
                StartChangeLanesAngle = signalInfo.BearingAngle;
                return;
            }
            //判断车辆是否在进行变道
            if ((DateTime.Now - RecordSignalTime.Value).TotalSeconds >= Settings.CommonExamItemsChangeLanesTimeOut && IsChangeLineSpeak == false && signalInfo.BearingAngle.IsValidAngle() &&
                StartChangeLanesAngle.IsValidAngle() &&
                !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartChangeLanesAngle, Settings.CommonExamItemsChangeLanesAngle))
            {
                //if (!signalInfo.Sensor.LeftIndicatorLight || !signalInfo.Sensor.RightIndicatorLight)
                if (!CarSignalSet.Query(DateTime.Now - TimeSpan.FromSeconds(12)).Any(d => d.Sensor.LeftIndicatorLight ||
                                                                                     d.Sensor.RightIndicatorLight))
                {
                    delayDateTime         = DateTime.Now;
                    IsChangeLineSpeak     = true;
                    RecordSignalCount     = 0;
                    RecordSignalTime      = null;
                    StartChangeLanesAngle = signalInfo.BearingAngle;
                    BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020503);
                }
                else
                {
                    delayDateTime     = DateTime.Now;
                    IsChangeLineSpeak = true;

                    //转向灯是否超过3秒,检测12秒前
                    var leftLight = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, DateTime.Now - TimeSpan.FromSeconds(12), Settings.TurnLightAheadOfTime);;
                    if (leftLight)
                    {
                        return;
                    }

                    var rightLight = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, DateTime.Now - TimeSpan.FromSeconds(12), Settings.TurnLightAheadOfTime);;
                    if (rightLight)
                    {
                        return;
                    }

                    BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020603);
                }
            }

            if (RecordSignalTime != null && (DateTime.Now - RecordSignalTime.Value).TotalSeconds > Settings.CommonExamItemsChangeLanesTimeOut)
            {
                //重置角度
                RecordSignalTime      = null;
                StartChangeLanesAngle = signalInfo.BearingAngle;
            }
        }
示例#27
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (!IsLoudSpeakerCheck && signalInfo.Sensor.Loudspeaker)
            {
                IsLoudSpeakerCheck = true;
            }
            //过滤10m
            //准备距离0 处理
            if (!isOverPrepareDistance && Settings.OvertakePrepareDistance > 0)
            {
                //超车10米后才评判
                if (signalInfo.Distance - StartDistance < Settings.OvertakePrepareDistance)
                {
                    return;
                }
                if (signalInfo.BearingAngle.IsValidAngle())
                {
                    isOverPrepareDistance = true;
                    StartAngle            = signalInfo.BearingAngle;
                }
                return;
            }
            //检测是否超速

            //检测打错灯,一进入就打右转
            if (OvertakeStepState == OvertakeStep.None && !checkErrorLight)
            {
                //超车,第一次打的是右转右灯判错
                if (signalInfo.Sensor.RightIndicatorLight || signalInfo.Sensor.LeftIndicatorLight)
                {
                    checkErrorLight = true;
                    if (signalInfo.Sensor.RightIndicatorLight)
                    {
                        CheckRule(true, DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                    }
                }
            }

            //TODO:以前有部分客户反馈是会2扣分得。原因不明。不知道是不是信号不稳定影响得。有时间可以打开在多次测试 2018.04.22 鲍君
            if (IsCheckOverSpeed == false && ((Settings.OvertakeSpeedLimit > 0 && signalInfo.SpeedInKmh > Settings.OvertakeSpeedLimit) ||
                                              (Settings.OvertakeLowestSpeed > 0 && signalInfo.SpeedInKmh < Settings.OvertakeLowestSpeed)))
            {
                IsCheckOverSpeed = true;
                CheckRule(true, DeductionRuleCodes.RC30116);
            }

            //达到一次速度
            if (Settings.OvertakeSpeedOnce > 10)
            {
                if (signalInfo.SpeedInKmh > Settings.OvertakeSpeedOnce)
                {
                    _reachSpeedSet.Enqueue(signalInfo.SpeedInKmh);
                }
                if (_reachSpeedSet.Count > 30)
                {
                    _reachSpeedSet.Dequeue();
                }
            }


            //检测是否低于规定速度

            //Logger.InfoFormat("OverTakeTest {0}", OvertakeStepState.ToString());
            //检测开始超车转向角度
            //如果角度大于0
            if (Settings.OvertakeChangeLanesAngle > 0)
            {
                if (OvertakeStepState == OvertakeStep.None)
                {
                    if (signalInfo.BearingAngle.IsValidAngle() &&
                        !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.OvertakeChangeLanesAngle))
                    {
                        //设置开始变道时的距离(由于评判转向灯太快,所以延后大概1秒)
                        if (!StartChangingLanesDistance.HasValue)
                        {
                            StartChangingLanesDistance = signalInfo.Distance;
                        }

                        //变道摆正10米后才开始评判
                        if (signalInfo.Distance - StartChangingLanesDistance.Value < 10)
                        {
                            return;
                        }

                        //设置开始变道时的距离
                        OvertakeStepState = OvertakeStep.StartChangeLanesToLeft;

                        if (Settings.OvertakeLightCheck && !IsCheckedOvertakeLeftLight)
                        {
                            IsCheckedOvertakeLeftLight = true;
                            //超车,左转向灯,或者右灯判错
                            if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                            {
                                CheckRule(true, DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                            }
                            else
                            {
                                if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                                {
                                    BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020604);
                                }
                            }
                        }

                        //判断一下是否有点客户不需要返回原车道
                    }
                }
                else if (OvertakeStepState == OvertakeStep.StartChangeLanesToLeft)
                {
                    //当开始变道后向前行驶15米则认为变道成功
                    if (signalInfo.Distance - StartChangingLanesDistance >= OvertakeChangingLanesSuccessOrBackToOriginalLanceDistance &&
                        signalInfo.BearingAngle.IsValidAngle())
                    {
                        //路径
                        //
                        OvertakeStepState     = OvertakeStep.EndChangeLanesToLeft;
                        StartChangeLanesAngle = signalInfo.BearingAngle;

                        //如果设置了不需要返回原车道

                        if (!Settings.OvertakeBackToOriginalLane)
                        {
                            OvertakeStepState = OvertakeStep.EndChangeLanesToRight;
                        }
                        else
                        {
                            Speaker.PlayAudioAsync(Settings.OvertakeBackToOriginalLaneVocie);
                        }
                    }
                }
                else if (OvertakeStepState == OvertakeStep.EndChangeLanesToLeft)
                {
                    if (signalInfo.BearingAngle.IsValidAngle() && !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartChangeLanesAngle, Settings.OvertakeChangeLanesAngle))
                    {
                        OvertakeStepState = OvertakeStep.EndChangeLanesToRight;
                        if (Settings.OvertakeLightCheck && !IsCheckedOvertakeRightLight)
                        {
                            IsCheckedOvertakeRightLight = true;
                            if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight))
                            {
                                BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                            }
                            else
                            {
                                if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                                {
                                    BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020506);
                                }
                            }
                        }
                    }
                }
                else if (OvertakeStepState == OvertakeStep.EndChangeLanesToRight)
                {
                    //结束考试项目
                    //StopCore();
                    IsSuccess = true;
                    return;
                }
            }
            else
            {
                //表示客户其实只关心打灯问题
                //简单的处理 如果打右转灯之前没有打过左转灯则扣分
                if (signalInfo.Sensor.RightIndicatorLight && !IsCheckedOvertakeLeftLight)
                {
                    //如果没有打左转灯就扣分
                    if (!AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime))
                    {
                        //CheckRule(true, DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                        //只有泸州版本才这样
                        //todo:之所以不分出来 是觉得其实全国所有的版本都可以这样做
                        if (DataBase.VersionNumber.Contains("泸州"))
                        {
                            BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020506);
                        }
                        else
                        {
                            BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                        }

                        // BreakRule(DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020504);
                        IsCheckedOvertakeLeftLight = true;
                    }
                }
                //    if (signalInfo.Sensor.RightIndicatorLight)
                //    {
                //        IsCheckedOvertakeLeftLight = true;
                //        CheckRule(tru

                IsSuccess = true;
            }



            base.ExecuteCore(signalInfo);
        }
示例#28
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            ///停车不检测角度
            if (signalInfo.CarState == CarState.Stop)
            {
                return;
            }
            //过滤10m
            if (!isOverPrepareDistance)
            {
                if (signalInfo.Distance - StartChangeLanesDistance < Settings.ChangeLanesPrepareDistance)
                {
                    return;
                }
                else
                {
                    isOverPrepareDistance = true;
                    StartChangeLanesAngle = signalInfo.BearingAngle;
                    return;
                }
            }
            //变更车道超时
            if (IsTimeOut())
            {
                if (!IsSuccess)
                {
                    BreakRule(DeductionRuleCodes.RC40503);
                }

                StopCore();
                return;
            }

            //变更车道超距
            if (IsOverDistance(signalInfo))
            {
                if (!IsSuccess)
                {
                    BreakRule(DeductionRuleCodes.RC40503);
                }
                StopCore();
                return;
            }

            if (IsLightChecked == false && IsSuccess == false)
            {
                if (signalInfo.Sensor.RightIndicatorLight)
                {
                    IsLightChecked = true;
                    CheckRule(true, DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020503);
                }
            }

            Logger.InfoFormat("变道流程状态: {0}", StepState.ToString());

            if (Settings.ChangeLanesAngle > 0)
            {
                if (StepState == ChangeLanesStep.None)
                {
                    //判断车辆是否在进行变道
                    if (signalInfo.BearingAngle.IsValidAngle() &&
                        StartChangeLanesAngle.IsValidAngle() &&
                        !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartChangeLanesAngle, Settings.ChangeLanesAngle))
                    {
                        StepState            = ChangeLanesStep.StartChangeLanes;
                        ChangeLanesStartTime = DateTime.Now;
                    }
                }
                else if (StepState == ChangeLanesStep.StartChangeLanes)
                {
                    StepState = ChangeLanesStep.EndChangeLanes;
                    if (Settings.ChangeLanesLightCheck && IsLightChecked == false)
                    {
                        IsLightChecked = true;
                        //是否打转向灯
                        var hasTurnLight = CarSignalSet.Query(StartChangeLanesTime).Any(d => d.Sensor.LeftIndicatorLight);

                        if (!hasTurnLight)
                        {
                            CheckRule(true, DeductionRuleCodes.RC30205, DeductionRuleCodes.SRC3020503);
                        }
                        else
                        {
                            //转向灯是否超过3秒
                            var hasIndicatorLight = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                            if (hasIndicatorLight)
                            {
                                return;
                            }

                            BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020603);
                        }
                    }
                }
                else
                {
                    IsSuccess = true;
                    //完成变道,结束该项目
                    return;
                    //StopCore();
                }
            }
            else if (Settings.ChangeLanesAngle == 0)
            {
                IsSuccess = true;
            }

            base.ExecuteCore(signalInfo);
        }
示例#29
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            if (!InitializedExamParms)
            {
                return;
            }

            //乱打灯不扣分,20160323,李
            if (!IsOpenLeftIndicatorLight && signalInfo.Sensor.LeftIndicatorLight)
            {
                IsOpenLeftIndicatorLight = true;
            }
            //掉头打完左转向,在打右转向不扣分,20160323
            if (!isSpeakIndicator && !IsOpenLeftIndicatorLight &&
                CarSignalSet.Query(StartTime).Count(d => d.Sensor.RightIndicatorLight) >= Constants.ErrorSignalCount)
            {
                isSpeakIndicator = true;
                BreakRule(DeductionRuleCodes.RC40212);
            }

            //喇叭检测
            if (signalInfo.Sensor.Loudspeaker)
            {
                IsLoudSpeakerCheck = true;
            }

            //检测远近光交替
            if (Settings.TurnRoundLightCheck && !IsCheckedLowAndHighBeam)
            {
                IsCheckedLowAndHighBeam = signalInfo.Sensor.HighBeam;
            }

            if (StepState == TurnRoundStep.None)
            {
                //检测方向角是否开始调头
                if (signalInfo.BearingAngle.IsValidAngle() && StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.TurnRoundStartAngleDiff))
                {
                    StepState = TurnRoundStep.StartTurnRound;
                }
            }
            else if (StepState == TurnRoundStep.StartTurnRound)
            {
                //开始掉头检测灯光
                if (!IsCheckedTurnRoundLight)
                {
                    IsCheckedTurnRoundLight = true;
                    if (!CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight))
                    {
                        BreakRule(DeductionRuleCodes.RC41503);
                    }
                    else
                    {
                        //打了右转向灯进行评判
                        if (!IsOpenLeftIndicatorLight && CarSignalSet.Query(StartTime).Any(d => d.Sensor.RightIndicatorLight))
                        {
                            BreakRule(DeductionRuleCodes.RC30205);
                            return;
                        }

                        var isOk = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.LeftIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                        if (!isOk)
                        {
                            BreakRule(DeductionRuleCodes.RC30206, DeductionRuleCodes.SRC3020607);
                        }
                    }
                }

                //检测是否掉头完毕
                if (signalInfo.BearingAngle.IsValidAngle() &&
                    StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.TurnRoundEndAngleDiff))
                {
                    if (Settings.TurnRoundBrakeRequired &&
                        !CarSignalSet.Query(StartTime).Any(x => x.Sensor.Brake))
                    {
                        BreakRule(DeductionRuleCodes.RC41505);
                    }
                    StepState = TurnRoundStep.EndTurnRound;
                }
            }
            else
            {
                IsSuccess = true;
                return;
                //StopCore();
            }

            base.ExecuteCore(signalInfo);
        }
示例#30
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            var query = from a in AdvancedSignal.GetGearChangedStates(StartTime)
                        where a.Gear != Gear.Neutral &&
                        a.PeriodMilliseconds >= ModifiedGearIgnoreMilliseconds
                        group a by a.Gear
                        into g
                        select new
            {
                Gear         = g.Key,
                Milliseconds = g.Max(x => x.PeriodMilliseconds),
                Count        = g.Count()
            };

            var gearStates = query.ToArray();

            if (gearStates.Length < 1)
            {
                return;
            }

            var tempGear = gearStates.FirstOrDefault().Gear;

            Logger.Debug("Gear" + tempGear.ToString());
            if (ModifiedGearStepState == ModifiedGearStep.Finshed)
            {
                return;
            }

            //涪陵考场新规则: 4 - 3 - 2 - 3  或者 2 - 1 - 2 - 3 或者 3 - 2 - 3 ,或者1-2-1 //三种都是可以的
            if (ModifiedGearStepState == ModifiedGearStep.None)
            {
                if (tempGear == Gear.Four)
                {
                    ModifiedGearStepState = ModifiedGearStep.GearFlowFirst43;

                    Speaker.PlayAudioAsync("请减到3档", SpeechPriority.Normal);
                }
                else if (tempGear == Gear.Three)
                {
                    ModifiedGearStepState = ModifiedGearStep.GearFlowThrid32;

                    Speaker.PlayAudioAsync("请减到2档", SpeechPriority.Normal);
                }
                else if (tempGear == Gear.Two)
                {
                    ModifiedGearStepState = ModifiedGearStep.GearFlowSecond21;

                    Speaker.PlayAudioAsync("请减到1档", SpeechPriority.Normal);
                }
                else if (tempGear == Gear.One)
                {
                    ModifiedGearStepState = ModifiedGearStep.GearFlowFuorth12;

                    Speaker.PlayAudioAsync("请加到2档", SpeechPriority.Normal);
                }
            }
            #region 第一种流程4-3-2-3

            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowFirst43)
            {
                if (tempGear == Gear.Three)
                {
                    ModifiedGearStepState = ModifiedGearStep.GearFlowFirst32;

                    Speaker.PlayAudioAsync("请减到2档", SpeechPriority.Normal);
                }
            }
            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowFirst32)
            {
                if (tempGear == Gear.Two)
                {
                    ModifiedGearStepState = ModifiedGearStep.GearFlowFirst23;

                    Speaker.PlayAudioAsync("请加到3档", SpeechPriority.Normal);
                }
            }
            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowFirst23)
            {
                if (tempGear == Gear.Three)
                {
                    ModifiedGearStepState = ModifiedGearStep.Finshed;
                }
            }
            #endregion

            #region 第二种流程 2-1-2-3
            //客户特殊要求  2-1-2就可以了,不需要加到3档
            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowSecond21)
            {
                if (tempGear == Gear.One)
                {
                    Speaker.PlayAudioAsync("请加到2档", SpeechPriority.Normal);
                    ModifiedGearStepState = ModifiedGearStep.GearFlowSecond12;
                }
            }
            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowSecond12)
            {
                if (tempGear == Gear.Two)
                {
                    //  Speaker.PlayAudioAsync("请加到3档", SpeechPriority.Normal);

                    ModifiedGearStepState = ModifiedGearStep.Finshed;
                    // ModifiedGearStepState = ModifiedGearStep.GearFlowSecond23;
                }
            }
            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowSecond23)
            {
                if (tempGear == Gear.Three)
                {
                    // PlayAudioAsync("AddToGear2.wav", SpeechPriority.Normal);
                    ModifiedGearStepState = ModifiedGearStep.Finshed;
                }
            }
            #endregion

            #region 第三种流程3-2-3

            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowThrid32)
            {
                if (tempGear == Gear.Two)
                {
                    Speaker.PlayAudioAsync("请加到3档", SpeechPriority.Normal);
                    ModifiedGearStepState = ModifiedGearStep.GearFlowThrid23;
                }
            }
            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowThrid23)
            {
                if (tempGear == Gear.Three)
                {
                    ModifiedGearStepState = ModifiedGearStep.Finshed;
                }
            }

            #endregion

            #region  第四流程 1-2-1

            if (ModifiedGearStepState == ModifiedGearStep.GearFlowFuorth12)
            {
                if (tempGear == Gear.Two)
                {
                    ModifiedGearStepState = ModifiedGearStep.GearFlowFuorth21;
                    Speaker.PlayAudioAsync("请减到1档", SpeechPriority.Normal);
                }
            }
            else if (ModifiedGearStepState == ModifiedGearStep.GearFlowFuorth21)
            {
                if (tempGear == Gear.One)
                {
                    ModifiedGearStepState = ModifiedGearStep.Finshed;
                }
            }


            #endregion

            if (ModifiedGearStepState == ModifiedGearStep.Finshed)
            {
                IsSuccess = true;
            }


            base.ExecuteCore(signalInfo);
        }