Beispiel #1
0
        /// <summary>
        /// 检测转向灯
        /// </summary>
        protected override void LeftIndicatorCheck(IndicatorCheckState checkState)
        {
            //角度设置0时,不进行角度达到检测转向灯
            if (checkState == IndicatorCheckState.MidCheckAngle && Settings.TurnLeftAngle < 0.5)
            {
                return;
            }
            if (indicatorChecked)
            {
                return;
            }

            if (checkState == IndicatorCheckState.MidCheckAngle)
            {
                //设置了变道角度后
                if (CurrentAngle.IsValidAngle() &&
                    StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(CurrentAngle, StartAngle, Settings.TurnLeftAngle))
                {
                    if (Settings.TurnLeftEndFlag)
                    {
                        stopDelayDistance = CurrentDistance;
                    }
                    CheckLeft();
                }
            }
            else if (checkState == IndicatorCheckState.StopCheck)
            {
                CheckLeft();
            }
        }
Beispiel #2
0
        /// <summary>
        /// 检测转向灯
        /// </summary>
        protected override void LeftIndicatorCheck(IndicatorCheckState checkState)
        {
            //角度设置0时,不进行角度达到检测转向灯
            if (checkState == IndicatorCheckState.MidCheckAngle && Settings.TurnRightAngle < 0.5)
            {
                return;
            }
            if (indicatorChecked)
            {
                return;
            }

            if (checkState == IndicatorCheckState.MidCheckAngle)
            {
                //设置了变道角度后
                if (CarSignalSet.Current.BearingAngle.IsValidAngle() &&
                    StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(CarSignalSet.Current.BearingAngle, StartAngle, Settings.TurnRightAngle))
                {
                    CheckRight();
                }
            }
            else if (checkState == IndicatorCheckState.StopCheck)
            {
                CheckRight();
            }
        }
Beispiel #3
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            //设置了变道角度后
            //设置了变道
            if (Constants.PullOverDistance == 0)
            {
                Constants.PullOverDistance = signalInfo.Distance;
            }

            if (Settings.PulloverAngle > 0.5 && signalInfo.BearingAngle.IsValidAngle() &&
                StartAngle.IsValidAngle() &&
                !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.PulloverAngle))
            {
                CheckRightIndicatorLight();
            }
            if (Settings.PullOverEndMark == PullOverEndMark.OpenCloseDoorCheck &&
                PullOverStepState < PullOverStep.StopCar && signalInfo.Sensor.Door)
            {
                if (!signalInfo.Sensor.Handbrake)
                {
                    CheckRule(true, DeductionRuleCodes.RC40607, DeductionRuleCodes.SRC4060701);
                }

                CheckEndMark(signalInfo);
            }
            if (PullOverStepState == PullOverStep.None)
            {
                if ((signalInfo.CarState == CarState.Stop && Settings.PullOverMark == PullOverMark.CarStop) ||
                    (signalInfo.Sensor.Handbrake && Settings.PullOverMark == PullOverMark.Handbrake))
                {
                    PullOverStepState = PullOverStep.StopCar;
                    StopCarTime       = DateTime.Now;
                    Messenger.Send(new EngineRuleMessage(false));
                }
            }
            else if (PullOverStepState == PullOverStep.StopCar)
            {
                //停车转向灯检查
                PullOverStepState = PullOverStep.OpenPullOverLight;

                CheckRightIndicatorLight();
            }
            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.OpenDoorCheck)
                {
                    StopCore();
                    return;
                }
                //true false
                if (!(Settings.PullOverEndMark == PullOverEndMark.None ||
                      Settings.PullOverEndMark == PullOverEndMark.OpenCloseDoorCheck))
                {
                    StopCore();
                    return;
                }
                if (!OpenDoorTime.HasValue)
                {
                    OpenDoorTime = DateTime.Now;
                }

                //关车门
                if (!signalInfo.Sensor.Door)
                {
                    //海南版本特殊要求开关车门两次
                    if (DataBase.VersionNumber.Contains("海南"))
                    {
                        if (CloseDoorCount >= 2)
                        {
                            PullOverStepState = PullOverStep.CloseDoor;
                            //关车门
                            Messenger.Send(new DoorChangedMessage(signalInfo.Sensor.Door));
                            StopCore();
                            return;
                        }
                    }
                    else
                    {
                        PullOverStepState = PullOverStep.CloseDoor;
                        //关车门
                        Messenger.Send(new DoorChangedMessage(signalInfo.Sensor.Door));
                        StopCore();
                        return;
                    }
                }
                //在规定的时间内没有关闭车门
                if (CloseDoorTimeOut())
                {
                    BreakRule(DeductionRuleCodes.RC40605);
                    StopCore();
                }
            }
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            //启用角度
            if (Settings.PulloverAngle > 1 && CheckAngleLight &&
                PullOverStepState < PullOverStep.StopCar)
            {
                if (signalInfo.BearingAngle.IsValidAngle() &&
                    StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.PulloverAngle))
                {
                    CheckAngleLight = false;
                    if (CarSignalSet.Query(StartTime).Any(d => d.Sensor.LeftIndicatorLight) || !signalInfo.Sensor.RightIndicatorLight)
                    {
                        CheckRule(true, DeductionRuleCodes.RC40610);
                    }
                    else
                    {
                        var lastSignal = CarSignalSet.QueryCachedSeconds(Settings.TurnLightAheadOfTime).LastOrDefault();

                        if (lastSignal == null || !lastSignal.Sensor.RightIndicatorLight)
                        {
                            CheckRule(true, DeductionRuleCodes.RC40611);
                        }
                    }
                }
            }

            //如果车停了又继续走了,并且状态在结束 标识之前 充值状态 //要求是下车前
            //if ((int)PullOverStepState >= (int)PullOverStep.StopCar && signalInfo.CarState != CarState.Stop && PullOverStepState != PullOverStep.CloseDoor && PullOverStepState != PullOverStep.CheckStop)
            //{
            //    PullOverStepState = PullOverStep.None;
            //    _isTouchExteriorMirror = false;
            //}
            if ((int)PullOverStepState >= (int)PullOverStep.StopCar &&
                !_isTouchExteriorMirror)
            {
                if (signalInfo.Sensor.ExteriorMirror)
                {
                    _isTouchExteriorMirror = true;
                    //......
                    //......
                    //......
                    //......
                    Speaker.PlayAudioAsync("观望镜确认");
                }
            }

            if (PullOverStepState == PullOverStep.None)
            {
                if (signalInfo.Sensor.Handbrake)
                {
                    PullOverStepState = PullOverStep.StopCar;
                    StopCarTime       = DateTime.Now;
                    Messenger.Send(new EngineRuleMessage(false));
                    Logger.DebugFormat("{0}-关闭发动机熄火评判规则", Name);
                }
                //if (signalInfo.CarState == CarState.Stop)
                //{
                //    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.LeftIndicatorLight) || !signalInfo.Sensor.RightIndicatorLight)
                {
                    CheckRule(true, DeductionRuleCodes.RC40610);
                }
                else
                {
                    var lastSignal = CarSignalSet.QueryCachedSeconds(Settings.TurnLightAheadOfTime).LastOrDefault();

                    if (lastSignal == null || !lastSignal.Sensor.RightIndicatorLight)
                    {
                        CheckRule(true, DeductionRuleCodes.RC40611);
                    }
                    //var advancedSignal = Resolve<IAdvancedCarSignal>();
                    //var rightIndicator = AdvancedSignal.CheckOperationAheadSeconds(x => x.Sensor.RightIndicatorLight, StartTime, Settings.TurnLightAheadOfTime);
                    //if (!rightIndicator)
                    //{
                    //    BreakRule(DeductionRuleCodes.RC40611);
                    //}
                }
            }
            //开光车门之后再检查手刹
            else if (PullOverStepState == PullOverStep.OpenPullOverLight)
            {
                CheckHandbrake(signalInfo);
                PullOverStepState = PullOverStep.PullHandbrake;
            }
            else if (PullOverStepState == PullOverStep.PullHandbrake)
            {
                //判断靠边停车是否结束
                CheckEndMark(signalInfo);
            }
            else if (PullOverStepState == PullOverStep.CheckStop)
            {
                //if (signalInfo.Sensor.ExteriorMirror)
                //{
                //    _isTouchExteriorMirror = true;
                //    Speaker.PlayAudioAsync("sanya/ExteriorMirror.wav", Infrastructure.Speech.SpeechPriority.Normal);
                //}
                //检测手刹
                //

                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();
                }
            }
        }
Beispiel #7
0
        protected override void ExecuteCore(CarSignalInfo signalInfo)
        {
            //设置了变道角度后
            //todo:bug
            if (Settings.PulloverAngle > 0.5 && signalInfo.BearingAngle.IsValidAngle() &&
                StartAngle.IsValidAngle() &&
                !GeoHelper.IsBetweenDiffAngle(signalInfo.BearingAngle, StartAngle, Settings.PulloverAngle))
            {
                CheckRightIndicatorLight();
            }

            queueOpenDoor.Enqueue(signalInfo.Sensor.Door);
            if (queueOpenDoor.Count > 3)
            {
                queueOpenDoor.Dequeue();
            }
            //有可能错误检测到了开门信号导致直接结束考试流程
            //判断下是否停车肯定是停车状态下
            //判断下最近
            //if (Settings.PullOverEndMark == PullOverEndMark.OpenCloseDoorCheck &&
            //    //停车状态下至少是3个连续信号
            //    //保证OpenDoor都是开门信号
            //    //保证基本上是车停的时候
            //    PullOverStepState < PullOverStep.StopCar&& signalInfo.Sensor.SpeedInKmh<=1&& signalInfo.Sensor.Door&&queueOpenDoor.Where(s=>s==true).Count()>=2)
            //{
            //    //闪过一个信号后判断
            //    if(!signalInfo.Sensor.Handbrake)
            //        CheckRule(true,DeductionRuleCodes.RC40607, DeductionRuleCodes.SRC4060701);

            //    CheckEndMark(signalInfo);
            //}

            if (PullOverStepState == PullOverStep.None)
            {
                if ((signalInfo.CarState == CarState.Stop && Settings.PullOverMark == PullOverMark.CarStop) ||
                    (signalInfo.Sensor.Handbrake && Settings.PullOverMark == PullOverMark.Handbrake))
                {
                    if (signalInfo.Sensor.Handbrake)
                    {
                        Speaker.PlayAudioAsync("请下车", SpeechPriority.High);
                    }

                    PullOverStepState = PullOverStep.StopCar;
                    StopCarTime       = DateTime.Now;
                    Messenger.Send(new EngineRuleMessage(false));
                }
            }
            else if (PullOverStepState == PullOverStep.StopCar)
            {
                //停车转向灯检查
                PullOverStepState = PullOverStep.OpenPullOverLight;

                CheckRightIndicatorLight();
            }
            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.OpenDoorCheck)
                {
                    StopCore();
                    return;
                }
                //true false
                if (!(Settings.PullOverEndMark == PullOverEndMark.None ||
                      Settings.PullOverEndMark == PullOverEndMark.OpenCloseDoorCheck))
                {
                    StopCore();
                    return;
                }
                if (!OpenDoorTime.HasValue)
                {
                    OpenDoorTime = DateTime.Now;
                }

                //开车门维持3秒
                if (OpenDoorTime.HasValue && (DateTime.Now - OpenDoorTime.Value).TotalSeconds > 3 &&
                    signalInfo.Sensor.Door && isCheckOverOpendoor == false)
                {
                    isCheckOverOpendoor = true;
                    Speaker.PlayAudioAsync("请下车", SpeechPriority.High);
                }

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


                //在规定的时间内没有关闭车门
                if (CloseDoorTimeOut() && isCheckOverOpendoor)
                {
                    BreakRule(DeductionRuleCodes.RC40605);
                    StopCore();
                }
            }
        }