2022-12-18 17:33:23 +01:00
import bge # Bibliothèque Blender Game Engine (UPBGE)
import twin # Bibliothèque de l'environnement 3D des jumeaux numériques
import math
import time
###############################################################################
# montchg.py
# @title: Commandes pour le monte-charge
# @project: Blender-EduTech
# @lang: fr
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
2023-01-14 07:49:53 +01:00
# @copyright: Copyright (C) 2022-2023 Philippe Roy
2022-12-18 17:33:23 +01:00
# @license: GNU GPL
###############################################################################
# Récupérer la scène UPBGE
scene = bge . logic . getCurrentScene ( )
2023-01-18 18:21:12 +01:00
# Configuration des variables publiques
# 'nom_variable' :
2023-01-31 11:15:21 +01:00
# - Objet 3D : [nom de l'objet 3D, propriété associée à la valeur (activate ou activated_real), type de la valeur ('d' (digital, binary), 'a', (analog) ou 'n' (numeric)), échelle (1 si ommis)]
2023-02-03 05:58:20 +01:00
# - Configuration de la broche : [nom de la propriété stockant l'object broche (pyfirmata),
# type de broche par défaut : 'd' (digital), 'a' (analog) ou 'p' (pwm)), mode de la broche par défaut : 'i' (input) ou 'o' (output)]
# - Configuration du graphique : ['marque', 'type de ligne', 'couleur', linewidth]] (Codification de Matplotlib)
2023-01-18 18:21:12 +01:00
#
# 'nom_variable_r' est la valeur réelle de la variable (valeur numérique) 'nom_variable' issue du jumelage numérique.
# Dans ce cas, il n'y a pas configuration de broche car elle est présente sur la variable 'nom_variable'.
2023-02-03 05:58:20 +01:00
# Ce distinguo ne concerne que les entrées, car les sorties sont pilotées par le numérique.
2023-01-18 18:21:12 +01:00
public_vars = {
2023-01-31 14:06:34 +01:00
' t ' : [ [ ' System ' , ' time ' , ' a ' ] , [ ] , [ ] ] ,
' voy_0 ' : [ [ ' Led niveau 0 ' , ' activated ' , ' d ' ] , [ ' pin ' , ' d ' , ' o ' ] , [ ] ] ,
' voy_1 ' : [ [ ' Led niveau 1 ' , ' activated ' , ' d ' ] , [ ' pin ' , ' d ' , ' o ' ] , [ ] ] ,
2023-02-15 17:56:49 +01:00
' pc_0 ' : [ [ ' Microrupteur niveau 0 ' , ' activated ' , ' d ' ] , [ ' pin ' , ' d ' , ' i ' ] , [ ] ] ,
' pc_0_r ' : [ [ ' Microrupteur niveau 0 ' , ' activated_real ' , ' d ' ] , [ ] , [ ] ] ,
2023-01-31 14:06:34 +01:00
' pc_1 ' : [ [ ' Microrupteur niveau 1 ' , ' activated ' , ' d ' ] , [ ' pin ' , ' d ' , ' i ' ] , [ ] ] ,
' pc_1_r ' : [ [ ' Microrupteur niveau 1 ' , ' activated_real ' , ' d ' ] , [ ] , [ ] ] ,
' ba_0 ' : [ [ ' Bp niveau 0 ' , ' activated ' , ' d ' ] , [ ' pin ' , ' d ' , ' i ' ] , [ ] ] ,
' ba_0_r ' : [ [ ' Bp niveau 0 ' , ' activated_real ' , ' d ' ] , [ ] , [ ] ] ,
' ba_1 ' : [ [ ' Bp niveau 1 ' , ' activated ' , ' d ' ] , [ ' pin ' , ' d ' , ' i ' ] , [ ] ] ,
' ba_1_r ' : [ [ ' Bp niveau 1 ' , ' activated_real ' , ' d ' ] , [ ] , [ ] ] ,
' mot_m ' : [ [ ' Moteur ' , ' up ' , ' d ' ] , [ ' pin_up ' , ' d ' , ' o ' ] , [ ] ] ,
' mot_d ' : [ [ ' Moteur ' , ' down ' , ' d ' ] , [ ' pin_down ' , ' d ' , ' o ' ] , [ ] ] ,
' mot_angle ' : [ [ ' Moteur ' , ' alpha ' , ' a ' ] , [ ] , [ ] ] ,
' mot_vitesse ' : [ [ ' Moteur ' , ' speed ' , ' a ' ] , [ ] , [ ] ] ,
' mot_pas ' : [ [ ' Moteur ' , ' step ' , ' a ' ] , [ ] , [ ] ] ,
' cabine_z ' : [ [ ' Cabine ' , ' z ' , ' a ' , 1 / 0.333 ] , [ ] , [ ] ] ,
' cabine_vitesse ' : [ [ ' Cabine ' , ' speed ' , ' a ' , 1 / 0.333 ] , [ ] , [ ] ] ,
' cabine_pas ' : [ [ ' Cabine ' , ' step ' , ' a ' , 1 / 0.333 ] , [ ] , [ ] ] }
2023-01-07 18:01:03 +01:00
2022-12-18 17:33:23 +01:00
# Couleurs
2022-12-21 19:01:21 +01:00
color_passive = ( 0.800 , 0.005 , 0.315 , 1 ) # bouton non activable : magenta
color_active = ( 0.799 , 0.130 , 0.063 , 1 ) # bouton activable : orange
color_hl = ( 0.8 , 0.8 , 0.8 , 1 ) # bouton focus : blanc
2023-01-07 18:01:03 +01:00
color_activated = ( 0.8 , 0.619 , 0.021 , 1 ) # bouton activé numériquement uniquement : jaune
color_activated_real = ( 0.799 , 0.031 , 0.038 , 1 ) # élément activé physiquement uniquement : rouge (hors clic)
color_activated_dbl = ( 0.246 , 0.687 , 0.078 , 1 ) # élément activé physiquement et numériquement : vert clair
2022-12-18 17:33:23 +01:00
# Constantes UPBGE
JUST_ACTIVATED = bge . logic . KX_INPUT_JUST_ACTIVATED
JUST_RELEASED = bge . logic . KX_INPUT_JUST_RELEASED
ACTIVATE = bge . logic . KX_INPUT_ACTIVE
# JUST_DEACTIVATED = bge.logic.KX_SENSOR_JUST_DEACTIVATED
###############################################################################
# Initialisation de la scène
###############################################################################
def init ( cont ) :
if cont . sensors [ ' Init ' ] . positive == False : # 1 seule fois
return False
twin . manip_init ( ) # Manipulation du modèle 3D
twin . cmd_init ( ) # Commandes
2023-01-07 18:01:03 +01:00
# Brochage
2023-01-18 18:21:12 +01:00
for pin in public_vars :
if public_vars [ pin ] [ 1 ] != [ ] :
scene . objects [ public_vars [ pin ] [ 0 ] [ 0 ] ] [ public_vars [ pin ] [ 1 ] [ 0 ] ] = None
2023-01-07 18:01:03 +01:00
2022-12-21 19:01:21 +01:00
# Mémorisation de la position et orientation des composants du système au départ
2022-12-21 22:23:47 +01:00
scene . objects [ ' Cabine ' ] [ ' init_lx ' ] = scene . objects [ ' Cabine ' ] . worldPosition . x
scene . objects [ ' Cabine ' ] [ ' init_ly ' ] = scene . objects [ ' Cabine ' ] . worldPosition . y
scene . objects [ ' Cabine ' ] [ ' init_lz ' ] = scene . objects [ ' Cabine ' ] . worldPosition . z
scene . objects [ ' Contrepoids ' ] [ ' init_lx ' ] = scene . objects [ ' Contrepoids ' ] . worldPosition . x
scene . objects [ ' Contrepoids ' ] [ ' init_ly ' ] = scene . objects [ ' Contrepoids ' ] . worldPosition . y
scene . objects [ ' Contrepoids ' ] [ ' init_lz ' ] = scene . objects [ ' Contrepoids ' ] . worldPosition . z
scene . objects [ ' Moteur vis sans fin ' ] [ ' init_rx ' ] = scene . objects [ ' Moteur vis sans fin ' ] . worldOrientation . to_euler ( ) . x
scene . objects [ ' Moteur vis sans fin ' ] [ ' init_ry ' ] = scene . objects [ ' Moteur vis sans fin ' ] . worldOrientation . to_euler ( ) . y
scene . objects [ ' Moteur vis sans fin ' ] [ ' init_rz ' ] = scene . objects [ ' Moteur vis sans fin ' ] . worldOrientation . to_euler ( ) . z
scene . objects [ ' Moteur pignon ' ] [ ' init_rx ' ] = scene . objects [ ' Moteur pignon ' ] . worldOrientation . to_euler ( ) . x
scene . objects [ ' Moteur pignon ' ] [ ' init_ry ' ] = scene . objects [ ' Moteur pignon ' ] . worldOrientation . to_euler ( ) . y
scene . objects [ ' Moteur pignon ' ] [ ' init_rz ' ] = scene . objects [ ' Moteur pignon ' ] . worldOrientation . to_euler ( ) . z
2023-01-06 21:23:44 +01:00
2023-01-11 22:09:10 +01:00
# Groupe de focus pour les actionneurs
twin . cycle_def_focusgroup ( [ [ " Moteur " , " blue-dark " ] ,
[ " Moteur arriere " , " blue-dark " ] ,
[ " Moteur condensateur " , " grey " ] ,
[ " Reducteur flanc droit " , " blue " ] ,
[ " Reducteur flanc gauche " , " blue " ] ,
[ " Moteur vis sans fin " , " blue-dark " ] ,
[ " Moteur pignon " , " blue-dark " ] ,
[ " Moteur axe 1 " , " blue " ] ,
[ " Moteur axe 2 " , " blue-dark " ] ,
[ " Moteur gaine thermo " , " blue " ] ,
[ " Cable " , " blue " ] ] , " Moteur : mot_m(True | False), mot_d(True | False) " )
twin . cycle_def_focusgroup ( [ [ " Led niveau 0 " , " led_yellow " ] ] , " Voyant témoin d \" étage niveau 0 : voy_0(True | False) " )
twin . cycle_def_focusgroup ( [ [ " Led niveau 1 " , " led_yellow " ] ] , " Voyant témoin d \" étage niveau 1 : voy_1(True | False) " )
2023-01-06 21:23:44 +01:00
# Description des composants sensibles
scene . objects [ ' Bp niveau 0 ' ] [ ' description ' ] = " Bouton poussoir appel niveau 0 : ba_0() "
scene . objects [ ' Bp niveau 1 ' ] [ ' description ' ] = " Bouton poussoir appel niveau 1 : ba_1() "
scene . objects [ ' Microrupteur niveau 0 ' ] [ ' description ' ] = " Capteur présence cabine niveau 0 : pc_0() "
scene . objects [ ' Microrupteur niveau 1 ' ] [ ' description ' ] = " Capteur présence cabine niveau 1 : pc_1() "
2022-12-18 17:33:23 +01:00
system_init ( ) # Initialisation du système
2023-01-18 18:21:12 +01:00
def get_public_vars ( ) :
return public_vars
2023-01-09 05:54:31 +01:00
2022-12-22 05:02:33 +01:00
###############################################################################
# Actionneurs
###############################################################################
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
# Moteur et cabine
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
def mot ( cont ) :
if scene . objects [ ' System ' ] [ ' run ' ] :
2023-01-19 15:35:57 +01:00
fps = 60 # frame per second
2022-12-22 05:02:33 +01:00
obj = cont . owner
obj_vissansfin = scene . objects [ ' Moteur vis sans fin ' ]
obj_pignon = scene . objects [ ' Moteur pignon ' ]
obj_cabine = scene . objects [ ' Cabine ' ]
obj_contrepoids = scene . objects [ ' Contrepoids ' ]
2023-01-19 15:35:57 +01:00
obj_cable = scene . objects [ ' Cable ' ] # FIXME : animation du cable -> plus tard
# Roue et vis sans fin
z = 48 # nb dents pignon
diam_axe = 3 # diamètre de l'axe moteur
obj [ ' step ' ] = obj [ ' speed_setting ' ] / fps # Vitesse du moteur numérique : 1,3 rad /s par défaut
obj_pignon [ ' step ' ] = obj [ ' step ' ] / z
obj_cabine [ ' step ' ] = obj_pignon [ ' step ' ] * ( math . pi * diam_axe )
2023-01-07 18:01:03 +01:00
# Monter
2022-12-22 05:02:33 +01:00
if obj [ ' up ' ] :
2023-01-19 15:35:57 +01:00
2023-02-03 05:58:20 +01:00
# Physique du modèle 3D
if obj [ ' prior ' ] :
obj_vissansfin . applyRotation ( ( 0 , 0 , obj [ ' step ' ] ) , True )
obj [ ' alpha ' ] = obj [ ' alpha ' ] + obj [ ' step ' ]
if scene . objects [ ' System ' ] [ ' time ' ] != obj [ ' last_time ' ] :
obj [ ' speed ' ] = ( obj [ ' step ' ] ) / ( scene . objects [ ' System ' ] [ ' time ' ] - obj [ ' last_time ' ] )
obj_pignon . applyRotation ( ( obj_pignon [ ' step ' ] , 0 , 0 ) , True )
obj_cabine . applyMovement ( ( 0 , 0 , obj_cabine [ ' step ' ] ) , True )
obj_cabine [ ' z ' ] = obj_cabine [ ' z ' ] + obj_cabine [ ' step ' ] # Echelle pas pris en compte
if scene . objects [ ' System ' ] [ ' time ' ] != obj [ ' last_time ' ] :
obj_cabine [ ' speed ' ] = obj_cabine [ ' step ' ] / ( scene . objects [ ' System ' ] [ ' time ' ] - obj [ ' last_time ' ] )
obj_contrepoids . applyMovement ( ( 0 , 0 , - obj_cabine [ ' step ' ] ) , True )
obj [ ' last_time ' ] = scene . objects [ ' System ' ] [ ' time ' ]
2023-01-07 18:01:03 +01:00
# Modele 3D -> Arduino
2023-02-03 05:58:20 +01:00
if scene . objects [ ' System ' ] [ ' twins ' ] and obj [ ' prior_real ' ] :
2023-02-14 00:06:50 +01:00
if scene . objects [ ' Moteur ' ] [ ' pin_up ' ] is not None :
if scene . objects [ ' Moteur ' ] [ ' pin_down ' ] is not None :
scene . objects [ ' Moteur ' ] [ ' pin_down ' ] . write ( 0 )
scene . objects [ ' Moteur ' ] [ ' pin_up ' ] . write ( 1 )
2023-01-07 18:01:03 +01:00
# Descendre
2022-12-22 05:02:33 +01:00
# else: # Pas de priorité
if obj [ ' down ' ] :
2023-01-19 15:35:57 +01:00
2023-02-03 05:58:20 +01:00
# Physique du modèle 3D
if obj [ ' prior ' ] :
obj_vissansfin . applyRotation ( ( 0 , 0 , - obj [ ' step ' ] ) , True )
obj [ ' alpha ' ] = obj [ ' alpha ' ] - obj [ ' step ' ]
if scene . objects [ ' System ' ] [ ' time ' ] != obj [ ' last_time ' ] :
obj [ ' speed ' ] = ( - obj [ ' step ' ] ) / ( scene . objects [ ' System ' ] [ ' time ' ] - obj [ ' last_time ' ] )
obj_pignon . applyRotation ( ( - obj_pignon [ ' step ' ] , 0 , 0 ) , True )
obj_cabine . applyMovement ( ( 0 , 0 , - obj_cabine [ ' step ' ] ) , True )
obj_cabine [ ' z ' ] = obj_cabine [ ' z ' ] - obj_cabine [ ' step ' ] # Echelle pas pris en compte
if scene . objects [ ' System ' ] [ ' time ' ] != obj [ ' last_time ' ] :
obj_cabine [ ' speed ' ] = - obj_cabine [ ' step ' ] / ( scene . objects [ ' System ' ] [ ' time ' ] - obj [ ' last_time ' ] )
obj_contrepoids . applyMovement ( ( 0 , 0 , obj_cabine [ ' step ' ] ) , True )
obj [ ' last_time ' ] = scene . objects [ ' System ' ] [ ' time ' ]
2023-01-19 15:35:57 +01:00
# Modele 3D -> Arduino
2023-02-03 05:58:20 +01:00
if scene . objects [ ' System ' ] [ ' twins ' ] and obj [ ' prior_real ' ] :
2023-02-14 00:06:50 +01:00
if scene . objects [ ' Moteur ' ] [ ' pin_down ' ] is not None :
if scene . objects [ ' Moteur ' ] [ ' pin_up ' ] is not None :
scene . objects [ ' Moteur ' ] [ ' pin_up ' ] . write ( 0 )
scene . objects [ ' Moteur ' ] [ ' pin_down ' ] . write ( 1 )
2022-12-21 19:01:21 +01:00
2023-01-07 18:01:03 +01:00
# Arrêter
if obj [ ' up ' ] == False and obj [ ' down ' ] == False :
2023-02-03 05:58:20 +01:00
# Physique du modèle 3D
if obj [ ' prior ' ] :
obj [ ' speed ' ] = 0
obj_cabine [ ' speed ' ] = 0
obj [ ' last_time ' ] = scene . objects [ ' System ' ] [ ' time ' ]
2023-01-19 15:35:57 +01:00
2023-01-07 18:01:03 +01:00
# Modele 3D -> Arduino
2023-02-03 05:58:20 +01:00
if scene . objects [ ' System ' ] [ ' twins ' ] and obj [ ' prior_real ' ] :
2023-02-14 00:06:50 +01:00
if scene . objects [ ' Moteur ' ] [ ' pin_down ' ] is not None :
if scene . objects [ ' Moteur ' ] [ ' pin_up ' ] is not None :
scene . objects [ ' Moteur ' ] [ ' pin_up ' ] . write ( 0 )
scene . objects [ ' Moteur ' ] [ ' pin_down ' ] . write ( 0 )
2023-01-07 18:01:03 +01:00
2022-12-18 17:33:23 +01:00
###############################################################################
2022-12-22 05:02:33 +01:00
# Capteurs
2022-12-18 17:33:23 +01:00
###############################################################################
##
2022-12-22 05:02:33 +01:00
# Etat capteur présence cabine niveau 0
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
def pc_0 ( cont ) :
if scene . objects [ ' System ' ] [ ' run ' ] :
obj = cont . owner
2023-01-07 18:01:03 +01:00
# Arduino -> Modele 3D
2023-02-03 05:58:20 +01:00
if scene . objects [ ' System ' ] [ ' twins ' ] and obj [ ' prior_real ' ] :
2023-01-07 18:01:03 +01:00
if obj [ ' pin ' ] is not None :
if obj [ ' pin ' ] . read ( ) == True and obj [ ' activated_real ' ] == False :
obj [ ' activated_real ' ] = True
if obj [ ' pin ' ] . read ( ) == False and obj [ ' activated_real ' ] == True :
obj [ ' activated_real ' ] = False
2022-12-22 05:02:33 +01:00
# Etat capteur en fonction de la position de la cabine : localPosition.z entre -40 et -42
2023-02-03 05:58:20 +01:00
if scene . objects [ ' Cabine ' ] . localPosition . z < - 40 and scene . objects [ ' Cabine ' ] . localPosition . z > - 42 and obj [ ' activated ' ] == False and obj [ ' prior ' ] :
2022-12-22 05:02:33 +01:00
obj [ ' activated ' ] = True
2023-02-03 05:58:20 +01:00
if ( scene . objects [ ' Cabine ' ] . localPosition . z > - 40 or scene . objects [ ' Cabine ' ] . localPosition . z < - 42 ) and obj [ ' activated ' ] == True and obj [ ' prior ' ] :
2022-12-22 05:02:33 +01:00
obj [ ' activated ' ] = False
2023-01-07 18:01:03 +01:00
# Forçage par clic
2023-02-03 05:58:20 +01:00
if obj [ ' click ' ] == True and obj [ ' prior ' ] :
2022-12-22 05:02:33 +01:00
obj [ ' activated ' ] = True
# Couleurs
2023-01-07 18:01:03 +01:00
twin . cycle_sensitive_color ( obj )
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
# Etat capteur présence cabine niveau 1
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
def pc_1 ( cont ) :
if scene . objects [ ' System ' ] [ ' run ' ] :
obj = cont . owner
2023-01-07 18:01:03 +01:00
# Arduino -> Modele 3D
2023-02-03 05:58:20 +01:00
if scene . objects [ ' System ' ] [ ' twins ' ] and obj [ ' prior_real ' ] :
2023-01-07 18:01:03 +01:00
if obj [ ' pin ' ] is not None :
if obj [ ' pin ' ] . read ( ) == True and obj [ ' activated_real ' ] == False :
obj [ ' activated_real ' ] = True
if obj [ ' pin ' ] . read ( ) == False and obj [ ' activated_real ' ] == True :
obj [ ' activated_real ' ] = False
2022-12-22 05:02:33 +01:00
# Etat capteur en fonction de la position de la cabine : localPosition.z entre 0 et -2
2023-02-03 05:58:20 +01:00
if scene . objects [ ' Cabine ' ] . localPosition . z < 0 and scene . objects [ ' Cabine ' ] . localPosition . z > - 2 and obj [ ' activated ' ] == False and obj [ ' prior ' ] :
2022-12-22 05:02:33 +01:00
obj [ ' activated ' ] = True
2023-02-03 05:58:20 +01:00
if ( scene . objects [ ' Cabine ' ] . localPosition . z > 0 or scene . objects [ ' Cabine ' ] . localPosition . z < - 2 ) and obj [ ' activated ' ] == True and obj [ ' prior ' ] :
2022-12-22 05:02:33 +01:00
obj [ ' activated ' ] = False
2023-01-07 18:01:03 +01:00
# Forçage par clic
2023-02-03 05:58:20 +01:00
if obj [ ' click ' ] == True and obj [ ' prior ' ] :
2022-12-22 05:02:33 +01:00
obj [ ' activated ' ] = True
# Couleurs
2023-01-07 18:01:03 +01:00
twin . cycle_sensitive_color ( obj )
2022-12-18 17:33:23 +01:00
###############################################################################
2022-12-22 05:02:33 +01:00
# Système
2022-12-18 17:33:23 +01:00
###############################################################################
##
2022-12-22 05:02:33 +01:00
# Initialisation du système
# # Le moteur est géré en continue.
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
def system_init ( ) :
system_reset ( )
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
# Réinitialisation du système
2022-12-18 17:33:23 +01:00
##
2022-12-22 05:02:33 +01:00
def system_reset ( ) :
2023-02-03 05:58:20 +01:00
# Entrées à l'état initial
objs = [ ' Bp niveau 0 ' , ' Bp niveau 1 ' , ' Microrupteur niveau 0 ' , ' Microrupteur niveau 1 ' ]
for obj in objs :
scene . objects [ obj ] [ ' activated ' ] = False
scene . objects [ obj ] [ ' activated_real ' ] = False
2022-12-22 05:02:33 +01:00
# Voyants aux états initiaux
2023-02-03 05:58:20 +01:00
scene . objects [ ' Led niveau 0 ' ] [ ' activated ' ] = False
scene . objects [ ' Led niveau 1 ' ] [ ' activated ' ] = False
2022-12-22 05:02:33 +01:00
scene . objects [ ' Led niveau 0 ' ] . setVisible ( True , False )
scene . objects [ ' Led niveau 0-on ' ] . setVisible ( False , False )
scene . objects [ ' Led niveau 1 ' ] . setVisible ( True , False )
scene . objects [ ' Led niveau 1-on ' ] . setVisible ( False , False )
# Cabine
2023-02-03 05:58:20 +01:00
scene . objects [ ' Cabine ' ] [ ' z ' ] = 0
scene . objects [ ' Cabine ' ] [ ' speed ' ] = 0
scene . objects [ ' Cabine ' ] [ ' step ' ] = 0
2022-12-29 10:08:55 +01:00
scene . objects [ ' Cabine ' ] . worldPosition . x = scene . objects [ ' Cabine ' ] [ ' init_lx ' ] - scene . objects [ ' System ' ] [ ' init_lx ' ] + scene . objects [ ' System ' ] . worldPosition . x
scene . objects [ ' Cabine ' ] . worldPosition . y = scene . objects [ ' Cabine ' ] [ ' init_ly ' ] - scene . objects [ ' System ' ] [ ' init_ly ' ] + scene . objects [ ' System ' ] . worldPosition . y
scene . objects [ ' Cabine ' ] . worldPosition . z = scene . objects [ ' Cabine ' ] [ ' init_lz ' ] - scene . objects [ ' System ' ] [ ' init_lz ' ] + scene . objects [ ' System ' ] . worldPosition . z
scene . objects [ ' Contrepoids ' ] . worldPosition . x = scene . objects [ ' Contrepoids ' ] [ ' init_lx ' ] - scene . objects [ ' System ' ] [ ' init_lx ' ] + scene . objects [ ' System ' ] . worldPosition . x
scene . objects [ ' Contrepoids ' ] . worldPosition . y = scene . objects [ ' Contrepoids ' ] [ ' init_ly ' ] - scene . objects [ ' System ' ] [ ' init_ly ' ] + scene . objects [ ' System ' ] . worldPosition . y
scene . objects [ ' Contrepoids ' ] . worldPosition . z = scene . objects [ ' Contrepoids ' ] [ ' init_lz ' ] - scene . objects [ ' System ' ] [ ' init_lz ' ] + scene . objects [ ' System ' ] . worldPosition . z
2022-12-22 05:02:33 +01:00
2023-02-03 05:58:20 +01:00
# Moteur
2022-12-22 08:11:43 +01:00
scene . objects [ ' Moteur ' ] [ ' up ' ] = False
scene . objects [ ' Moteur ' ] [ ' down ' ] = False
2023-01-19 15:35:57 +01:00
scene . objects [ ' Moteur ' ] [ ' alpha ' ] = 0
scene . objects [ ' Moteur ' ] [ ' speed ' ] = 0
scene . objects [ ' Moteur ' ] [ ' speed_setting ' ] = 31.4 # Vitesse du moteur numérique : 31,4 rad /s ( 5 tr / s )
scene . objects [ ' Moteur ' ] [ ' step ' ] = 0
2023-02-03 05:58:20 +01:00
# Priorités activées
objs = [ ' Bp niveau 0 ' , ' Bp niveau 1 ' , ' Microrupteur niveau 0 ' , ' Microrupteur niveau 1 ' , ' Led niveau 0 ' , ' Led niveau 1 ' , ' Moteur ' ]
for obj in objs :
scene . objects [ obj ] [ ' prior ' ] = True
scene . objects [ obj ] [ ' prior_real ' ] = True