Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Este programa realiza la ruta para hacer la prueba del procesado del Tecnocampus ( http://www.tecno-campus.com )
- # Esta hecho para el Robot Thymio ( https://www.thymio.org/en:thymio ) , en el lenguaje Aseba
- # Aqui está nuestra historia ( http://guadatech.blogspot.com.es/2015/06/equipo-ar-ii-tecnocampus-provincial.html )
- # ESTADOS
- var estado = 0 #0 parado
- # VARIABLES DE CALIBRACION
- var velAvanceIzq = 245
- var velAvanceDer = 245
- var velgiro = 100
- var tiempoParaGirar90grados = 2250
- var tiempoParaMoverse10cm = 1480
- var sentirNegro = 150
- var tiempoPausa = 100
- # TEMPORIZADORES
- timer.period[0] = 0
- timer.period[1] = 0
- # SUBRUTINAS
- sub avance
- motor.left.target = velAvanceIzq
- motor.right.target = velAvanceDer
- return
- sub retroceso
- motor.left.target = -1* velAvanceIzq
- motor.right.target = -1* velAvanceDer
- return
- sub giroDerecha
- motor.left.target = velgiro
- motor.right.target = -1* velgiro
- return
- sub giroIzquierda
- motor.left.target = -1*velgiro
- motor.right.target = velgiro
- return
- sub parada
- motor.left.target = 0
- motor.right.target = 0
- return
- # EVENTOS
- onevent buttons
- #Boton central para pausar el robot
- if button.center==1 then
- timer.period[0] = 0
- timer.period[1] = 0
- callsub parada
- estado = 0
- end
- #Boton adelante para iniciar el programa
- if button.forward == 1 then
- #Avanza 20cm
- timer.period[0] = tiempoParaMoverse10cm * 2
- callsub avance
- estado = 1
- end
- onevent timer0 # Temporizador para los estados impares
- if estado == 1 then
- estado = 2
- callsub retroceso
- timer.period[1] = tiempoParaMoverse10cm * 2
- timer.period[0] = 0
- end
- if estado == 3 then
- estado = 4
- callsub avance
- timer.period[1] = tiempoParaMoverse10cm * 3
- timer.period[0] = 0
- end
- if estado == 5 then
- estado = 6
- callsub avance
- timer.period[1] = tiempoParaMoverse10cm * 2
- timer.period[0] = 0
- end
- if estado == 7 then
- estado = 8
- callsub avance
- timer.period[1] = tiempoParaMoverse10cm * 2
- timer.period[0] = 0
- end
- if estado == 9 then
- estado = 10
- callsub avance
- timer.period[1] =tiempoParaMoverse10cm * 3
- timer.period[0] = 0
- end
- if estado == 11 then
- estado = 12
- callsub parada
- timer.period[1] =tiempoPausa
- timer.period[0] = 0
- end
- onevent timer1 # Temporizador para los estados pares
- if estado == 2 then
- estado = 3
- callsub giroDerecha
- timer.period[0] = tiempoParaGirar90grados
- timer.period[1] = 0
- end
- if estado == 4 then
- estado = 5
- callsub giroIzquierda
- timer.period[0] = tiempoParaGirar90grados
- timer.period[1] = 0
- end
- if estado == 6 then
- estado = 7
- callsub giroDerecha
- timer.period[0] = tiempoParaGirar90grados * 2
- timer.period[1] = 0
- end
- if estado == 8 then
- estado = 9
- callsub giroDerecha
- timer.period[0] = tiempoParaGirar90grados
- timer.period[1] = 0
- end
- if estado == 10 then
- estado = 11
- callsub giroDerecha
- timer.period[0] =tiempoParaGirar90grados
- timer.period[1] = 0
- end
- if estado == 12 then
- estado = 1
- callsub avance
- timer.period[0] =tiempoParaMoverse10cm * 2
- timer.period[1] = 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement