77 lines
2.3 KiB
Python
77 lines
2.3 KiB
Python
import time
|
|
from rp_lib import * # Bibliothèque Ropy
|
|
|
|
###############################################################################
|
|
# rp_cmd-test_couleur.py
|
|
# @title: Commandes pour le Rover Ropy - Test des couleurs
|
|
# @project: Ropy (Blender-EduTech)
|
|
###############################################################################
|
|
|
|
###############################################################################
|
|
# Initialisation du niveau :
|
|
# Niveau 1 : Les premiers pas de Ropy
|
|
# Niveau 2 : Ma première fonction
|
|
# Niveau 3 : Sécuriser Ropy
|
|
# Niveau 4 : Partir au bout du monde
|
|
# Niveau 5 : Faire face à l'inconnu
|
|
# Niveau 6 : Se rendre utile
|
|
###############################################################################
|
|
|
|
###############################################################################
|
|
# Fonctions
|
|
###############################################################################
|
|
|
|
# Avancer + marquer (mission 2)
|
|
def mrp_avancer ():
|
|
rp_avancer()
|
|
rp_marquer()
|
|
|
|
###############################################################################
|
|
# Commandes
|
|
###############################################################################
|
|
|
|
def commandes():
|
|
|
|
rp_gauche()
|
|
rp_avancer()
|
|
rp_avancer()
|
|
rp_droite()
|
|
rp_avancer()
|
|
|
|
for i in range (30) :
|
|
col=(30-i)/30
|
|
rp_couleur("Rover 1", (0,1,col,1))
|
|
rp_couleur("Station 1", (0,1,col,1))
|
|
rp_couleur("Rover 2", (0,0.25,col,1))
|
|
rp_couleur("Station 2", (0,0.25,col,1))
|
|
rp_couleur("Rover 3", (1,1,1,1))
|
|
rp_couleur("Station 3", (1,1,1,1))
|
|
rp_tempo(0.5)
|
|
|
|
for i in range (30) :
|
|
col=i/30
|
|
rp_couleur("Rover 1", (col,1,0,1))
|
|
rp_couleur("Station 1", (col,1,0,1))
|
|
rp_couleur("Rover 2", (col,0.25,0,1))
|
|
rp_couleur("Station 2", (col,0.25,0,1))
|
|
rp_couleur("Rover 3", (1,1,1,1))
|
|
rp_couleur("Station 3", (1,1,1,1))
|
|
rp_tempo(0.5)
|
|
|
|
rp_tempo(2)
|
|
rp_couleur_init()
|
|
|
|
###############################################################################
|
|
# En: External call << DONT CHANGE THIS SECTION >>
|
|
# Fr: Appel externe << NE PAS MODIFIER CETTE SECTION >>
|
|
###############################################################################
|
|
|
|
def cycle():
|
|
commandes()
|
|
rp_fin()
|
|
|
|
if __name__=='start':
|
|
thread_cmd_start(cycle)
|
|
if __name__=='stop':
|
|
thread_cmd_stop()
|