Ejemplo n.º 1
0
        SINAL_VERMELHO, SINAL_VERDE = trata.sinalizacao_direita(
            imagem_sinalizacao_dir)

        status_obstaculo_vl53x = False

        # ----------------------------- DEFININDO COMANDOS ------------------------------
        (MOVIMENTO_FRENTE, CORRECAO_MOTOR_DIR_VISAO, CORRECAO_MOTOR_ESQ_VISAO,
         DETECCAO_OBSTACULOS_VISAO, FAIXA_CONTENCAO_VISAO,
         FAIXA_CONTENCAO_FOTO) = gerencia.definicao_de_comandos(
             status_a0, status_a1, status_a2, status_a3, status_b0, status_b1,
             status_b2, status_b3, status_visao_faixa_dir,
             status_visao_faixa_esq, status_faixa_contencao_visao,
             status_obstaculo_vl53x)
        # -------------------------------------------------------------------------------
        gerencia.movimento_frente(var.velNormal, ctr_vel_motor_dir,
                                  ctr_vel_motor_esq)

        if (FAIXA_CONTENCAO_VISAO is True):
            print("Faixa de contenção a frente! Andar com cautela...")
            CORRECAO_MOTOR_DIR_VISAO = False
            CORRECAO_MOTOR_ESQ_VISAO = False
            DETECTAR_FAIXA_PEDESTRE = True
            gerencia.movimento_frente(var.velCautela, ctr_vel_motor_dir,
                                      ctr_vel_motor_esq)

        if (DETECTAR_FAIXA_PEDESTRE is True):
            while (DETECTAR_FAIXA_PEDESTRE is True):
                a0, a1, _, a3, b0, b1, _, b3 = sensor.fototransistores()
                gerencia.movimento_frente(var.velCautela, ctr_vel_motor_dir,
                                          ctr_vel_motor_esq)
                if (((a0 <= var.CONST_A0) and (b0 <= var.CONST_B0))
Ejemplo n.º 2
0
         status_faixa_contencao_visao
         ) = trata.deteccao_faixas_visao(imagem_pista)
        # --------------------------------------------------------------------------------

        (status_a0, status_a1, status_a2, status_a3, status_b0, status_b1,
         status_b2, status_b3) = trata.deteccao_faixas_fototransistores(
             a0, a1, a2, a3, b0, b1, b2, b3)
        # --------------------------------------------------------------------------------

        (status_placa_pare, _,
         _) = trata.sinalizacao_direita(imagem_sinalizacao_dir)
        # --------------------------------------------------------------------------------

        status_obstaculo_vl53x = False

        gerencia.movimento_frente(var.velNormal, ctr_vel_motor_dir,
                                  ctr_vel_motor_esq)

        # -------------------------- Condicionais Placas---------------------------------
        if (status_placa_pare is True):
            while (tempoDeteccao <= var.CONST_TEMPO_PLC_PARE):
                gerencia.luz_de_freio()
                gerencia.interrupcao_movimento(ctr_vel_motor_dir,
                                               ctr_vel_motor_esq)
                tempoDeteccao += 1
            gerencia.desliga_luzes()
            print("Identificou a placa pare!")
            break

        # ----------------------------- DEFININDO COMANDOS ------------------------------
        (MOVIMENTO_FRENTE, CORRECAO_MOTOR_DIR_VISAO, CORRECAO_MOTOR_ESQ_VISAO,
         DETECCAO_OBSTACULOS_VISAO, FAIXA_CONTENCAO_VISAO,