diff --git a/monte_charge/montchg_doc.py b/monte_charge/montchg_doc.py index c290b0e..a0c3862 100644 --- a/monte_charge/montchg_doc.py +++ b/monte_charge/montchg_doc.py @@ -34,7 +34,7 @@ card_pin_title="Brochage" card_pin_text=""" Le brochage est un dictionnaire qui permet \n d'associer les objets 3D du jumeau \n numérique aux broches du jumeau réel, brochage = { nom:[type, broche, mode] } : - nom : nom de l'objet 3D, - - type : a (analogique) ou d (numérique), + - type : a (analogique) ou d (binaire), - broche : numéro de la broche de carte, - mode : i (entrée), o (sortie) ou p (pwm). Par exemple : brochage = { 'ba_0':['d',2,'i'] }.\n diff --git a/portail_coulissant/porcou.py b/portail_coulissant/porcou.py index 887a6f2..3876df7 100644 --- a/portail_coulissant/porcou.py +++ b/portail_coulissant/porcou.py @@ -154,10 +154,10 @@ def mot (cont): # Modele 3D -> Arduino if scene.objects['System']['twins'] and obj['prior_real']: - if scene.objects['Moteur']['pin_o'] is not None : - if scene.objects['Moteur']['pin_f'] is not None: - scene.objects['Moteur']['pin_f'].write(0) - scene.objects['Moteur']['pin_o'].write(1) + if scene.objects['Moteur']['pin_open'] is not None : + if scene.objects['Moteur']['pin_close'] is not None: + scene.objects['Moteur']['pin_close'].write(0) + scene.objects['Moteur']['pin_open'].write(1) # Fermer # else: # Pas de priorité @@ -177,10 +177,10 @@ def mot (cont): # Modele 3D -> Arduino if scene.objects['System']['twins'] and obj['prior_real']: - if scene.objects['Moteur']['pin_f'] is not None: - if scene.objects['Moteur']['pin_o'] is not None: - scene.objects['Moteur']['pin_o'].write(0) - scene.objects['Moteur']['pin_f'].write(1) + if scene.objects['Moteur']['pin_close'] is not None: + if scene.objects['Moteur']['pin_open'] is not None: + scene.objects['Moteur']['pin_open'].write(0) + scene.objects['Moteur']['pin_close'].write(1) # Arrêrer if obj['open']== False and obj['close'] == False and obj['prior']: @@ -193,10 +193,10 @@ def mot (cont): # Modele 3D -> Arduino if scene.objects['System']['twins'] and obj['prior_real']: - if scene.objects['Moteur']['pin_f'] is not None: - if scene.objects['Moteur']['pin_o'] is not None: - scene.objects['Moteur']['pin_o'].write(0) - scene.objects['Moteur']['pin_f'].write(0) + if scene.objects['Moteur']['pin_close'] is not None: + if scene.objects['Moteur']['pin_open'] is not None: + scene.objects['Moteur']['pin_open'].write(0) + scene.objects['Moteur']['pin_close'].write(0) ############################################################################### # Capteurs fin de course diff --git a/portail_coulissant/porcou_cmd.py b/portail_coulissant/porcou_cmd.py index 8717783..81ccc98 100644 --- a/portail_coulissant/porcou_cmd.py +++ b/portail_coulissant/porcou_cmd.py @@ -39,13 +39,29 @@ from porcou_lib import * # Bibliothèque utilisateur du portail coulissant # ############################################################################### -# Brochage du portail coulissant +# Brochage du portail coulissant (Grove) brochage={ - 'bp_ext' : [],'bp_int' : [], - 'fdc_o' : [],'fdc_f' : [], - 'mot_o' : [],'mot_f' : [], - 'gyr' : [], - 'ir_emet' : [],'ir_recep' : []} + 'bp_ext' : ['a',0,'i'],'bp_int' : ['a',1,'i'], + 'fdc_o' : ['d',7,'i'],'fdc_f' : ['d',8,'i'], + 'mot_o' : ['d',5,'o'],'mot_f' : ['d',6,'o'], + 'gyr' : ['d',4,'o'], + 'ir_emet' : ['d',2,'o'],'ir_recep' : ['a',3,'i']} + +# Brochage du portail coulissant (AutoProgUno) +# brochage={ +# 'bp_ext' : ['d',2,'i'],'bp_int' : ['d',3,'i'], +# 'fdc_o' : ['d',7,'i'],'fdc_f' : ['d',8,'i'], +# 'mot_o' : ['d',5,'o'],'mot_f' : ['d',6,'o'], +# 'gyr' : ['d',4,'o'], +# 'ir_emet' : ['d',9,'o'],'ir_recep' : ['d',10,'i']} + +# Brochage vierge +# brochage={ +# 'bp_ext' : [],'bp_int' : [], +# 'fdc_o' : [],'fdc_f' : [], +# 'mot_o' : [],'mot_f' : [], +# 'gyr' : [], +# 'ir_emet' : [],'ir_recep' : []} ############################################################################### # Fonctions @@ -69,14 +85,42 @@ def commandes(): # Données # daq(['mot_angle', 'mot_vitesse', 'portail_x', 'portail_vitesse']) reset_t() - daq(['bp_ext', 'bp_ext_r', 'bp_int', 'bp_int_r', 'fdc_o', 'fdc_o_r', 'fdc_f', 'fdc_f_r', 'mot_o', 'mot_f', 'gyr', 'mot_angle', 'mot_vitesse', 'portail_x', 'portail_vitesse', 'ir_emet', 'ir_recep', 'ir_recep_r']) + + # daq(['bp_ext', 'bp_ext_r', 'bp_int', 'bp_int_r', 'fdc_o', 'fdc_o_r', 'fdc_f', 'fdc_f_r', 'mot_o', 'mot_f', 'gyr', 'mot_angle', 'mot_vitesse', 'portail_x', 'portail_vitesse', 'ir_emet', 'ir_recep', 'ir_recep_r']) # daq(['bp_ext', 'bp_ext_r', 'bp_int', 'bp_int_r', 'fdc_o', 'fdc_o_r', 'fdc_f', 'fdc_f_r', 'mot_o', 'mot_f', 'gyr']) - plot(['mot_angle', 'mot_vitesse', 'portail_x', 'portail_vitesse']) + + # plot(['mot_angle', 'mot_vitesse', 'portail_x', 'portail_vitesse']) + # plot([['bp_ext', 'bp_ext_r'], ['bp_int', 'bp_int_r'], ['fdc_o', 'fdc_o_r'], ['fdc_f', 'fdc_f_r'], 'mot_o', 'mot_f', 'gyr', ['mot_angle', 'mot_vitesse', 'portail_x', 'portail_vitesse']]) # Jumelage - # jumeau_mode(True,True, False, False) + jumeau(brochage) # jumeau_mode() + # jumeau_mode(True,True, False, False) + # jumeau_mode(True,True, True, True) + + # jumeau_mode_object ('gyr', False, True) + gyr(False) + while True : + + jumeau_mode_object ('gyr', False, True) + gyr(True) + print ('gyr Numérique') + tempo(0.5) + jumeau_mode_object ('gyr', True, True) + gyr(False) + tempo(0.1) + + jumeau_mode_object ('gyr', True, False) + gyr(True) + print (('gyr Physique')) + tempo(0.5) + jumeau_mode_object ('gyr', True, True) + gyr(False) + tempo(0.1) + + if bp_ext(): + break # Fermeture mot_vitesse (1256) # Vitesse par défaut 125,6 rad /s ( 20 tr / s ) @@ -102,6 +146,7 @@ def commandes(): mot_o(True) mot_o(False) gyr(False) + tempo(1) fin() # A garder diff --git a/portail_coulissant/portail_coulissant-17.blend b/portail_coulissant/portail_coulissant-17.blend index 78a0fc4..0f86520 100644 Binary files a/portail_coulissant/portail_coulissant-17.blend and b/portail_coulissant/portail_coulissant-17.blend differ diff --git a/twin.py b/twin.py index c9a76b4..3e32e7a 100644 --- a/twin.py +++ b/twin.py @@ -732,10 +732,10 @@ def cycle_voy(cont): elif scene.objects['System']['run']: # Activation - if obj['activated'] and obj_on.visible == False: + if obj['activated']: - # Modele 3D - if obj['prior']: + # Physique du modèle 3D + if obj_on.visible == False and obj['prior']: obj_on.setVisible(True,False) obj.setVisible(False,False) @@ -745,10 +745,10 @@ def cycle_voy(cont): obj['pin'].write(1) # Désactivation - if obj['activated']==False and obj_on.visible == True: + if obj['activated']==False: - # Modele 3D - if obj['prior']: + # Physique du modèle 3D + if obj_on.visible == True and obj['prior']: obj.setVisible(True,False) obj_on.setVisible(False,False) diff --git a/twin_config.xml b/twin_config.xml index 3ad3c82..a69ef30 100644 --- a/twin_config.xml +++ b/twin_config.xml @@ -1,7 +1,7 @@ - 1590 - 894 + 999 + 562 1 diff --git a/twin_serial.py b/twin_serial.py index 8d474e4..cd87ca4 100644 --- a/twin_serial.py +++ b/twin_serial.py @@ -176,7 +176,8 @@ def jumeau (brochage=None): # Brochage if brochage is not None: for pin in pin_config : - scene.objects[pin_config[pin][0][0]][pin_config[pin][1][0]] = jumeau_get_pin(board, pin, brochage) + if len (pin_config[pin][1])>0: + scene.objects[pin_config[pin][0][0]][pin_config[pin][1][0]] = jumeau_get_pin(board, pin, brochage) return board else: return None diff --git a/volet_roulant/volet_roulant-17.blend b/volet_roulant/volet_roulant-17.blend index 59f232b..4ea74af 100644 Binary files a/volet_roulant/volet_roulant-17.blend and b/volet_roulant/volet_roulant-17.blend differ diff --git a/volet_roulant/volrou_doc.py b/volet_roulant/volrou_doc.py index 0c2e2e6..21c56fa 100644 --- a/volet_roulant/volrou_doc.py +++ b/volet_roulant/volrou_doc.py @@ -34,7 +34,7 @@ card_pin_title="Brochage" card_pin_text=""" Le brochage est un dictionnaire qui permet \n d'associer les objets 3D du jumeau \n numérique aux broches du jumeau réel, brochage = { nom:[type, broche, mode] } : - nom : nom de l'objet 3D, - - type : a (analogique) ou d (numérique), + - type : a (analogique) ou d (binaire), - broche : numéro de la broche de carte, - mode : i (entrée), o (sortie) ou p (pwm). Par exemple : brochage = { 'bp_m':['d',2,'i'] }.\n