//==================== REGLES D'INITIALISATION DE PROBLEME ==================== #REGLE ; :nom "init" ; :var () ; :precond ((veut_bouger_tete ?p3d)) ; :new_pb ((bouger_tete ?p3d)) ; :plan () ; :modif () ; #REGLE ; :nom "init" ; :var () ; :precond ((veut_se_tourner)) ; :new_pb ((tourner_sur_soi)) ; :plan () ; :modif () ; #REGLE ; :nom "init" ; :var () ; :precond ((veut_se_deplacer ?p3d)) ; :new_pb ((aller_vers ?p3d) ET (repos)) ; :plan () ; :modif () ; /===================== REGLE DE MISE AU REPOS DE L'AGENT ====================== #REGLE ; :nom "repos" ; :var () ; :precond ( (assign ?x 0.00 0.00 0.00) (orientation ?z) ) ; :new_pb () ; :plan ((move #ROT ?z) (move #BRAS_DROIT ?x) (move #BRAS_GAUCHE ?x) (move #JAMBE_DROITE ?x) (move #JAMBE_GAUCHE ?x)) ; :modif ((rot_agent ?z)) ; //============================ REGLES D'ANIMATION ============================ #REGLE ; :nom "tourner_sur_soi" ; :var () ; :precond ((assign ?rot1 0.00 +PI 0.00) (assign ?rot2 0.00 +2PI 0.00) (assign ?rot3 0.00 -PI 0.00) (assign ?rot4 0.00 0.00 0.00) ) ; :new_pb () ; :plan (BOUCLE (move #ROT ?rot1) PUIS (move #ROT ?rot2) PUIS (move #ROT ?rot3) PUIS (move #ROT ?rot4) ) ; :modif () ; ;----------------------------------------------------------------------------- #REGLE ; :nom "trajet_vers" ; :var (?x) ; :precond ((trajectoire =t ?x) ) ; :new_pb ((suivre =t)) ; :plan () ; :modif () ; #REGLE ; :nom "suivre" ; :var (=t) ; :precond ( (non_nul =t) (premier ?x =t) (suivant =s =t) ) ; :new_pb ( (aller_droit ?x) ET (suivre =s) ) ; :plan () ; :modif () ; #REGLE ; :nom "suivre" ; :var (=t) ; :precond ( (vrai) ) ; :new_pb () ; :plan () ; :modif () ; ;------------------------------------------------------------------------------ #REGLE ; :nom "aller_vers" ; :var (?x) ; :precond ( (horizontal ?x) ) ; :new_pb ( (trajet_vers ?x) ) ; :plan () ; :modif () ; #REGLE ; :nom "aller_vers" ; :var (?x) ; :precond ( (plus_haut ?x) (assign ?t 0.00 2.00 0.00) (pos_agent ?p3d) (add ?z ?p3d ?t) (add ?y ?x ?t) ) ; :new_pb ( (tourner_vers ?x) ET (voler_droit ?z) ET (voler_vers ?y) ET (repos) ET (voler_droit ?x) ) ; :plan () ; :modif () ; #REGLE ; :nom "aller_vers" ; :var (?x) ; :precond ( (plus_bas ?x) (assign ?t 0.00 2.00 0.00) (pos_agent ?p3d) (add ?z ?p3d ?t) (add ?y ?x ?t) ) ; :new_pb ((tourner_vers ?x) ET (voler_droit ?z) ET (voler_vers ?y) ET (voler_droit ?x) ) ; :plan () ; :modif () ; #REGLE ; :nom "voler_vers" ; :var (?x) ; :precond () ; :new_pb ( (trajet_vers ?x) ) ; :plan () ; :modif () ; ;------------------------------------------------------------------------------ #REGLE ; :nom "aller_droit" ; :var (?x) ; :precond ((horizontal ?x)) ; :new_pb ( (tourner_vers ?x) ET (avancer_tout_droit ?x) ); :plan () ; :modif () ; #REGLE ; :nom "aller_droit" ; :var (?x) ; :precond ((plus_haut ?x)) ; :new_pb ((position_envol ?x) ET (monter_droit ?x)) ; :plan () ; :modif () ; #REGLE ; :nom "aller_droit" ; :var (?x) ; :precond ((plus_bas ?x)) ; :new_pb ((voler_droit ?x)) ; :plan () ; :modif () ; ;------------------------------------------------------------------------------ #REGLE ; :nom "tourner_vers" ; :var (?x) ; :precond ((calcule_angle ?rot ?x) (assign ?t 0.00 0.00 0.00)) ; :new_pb () ; :plan ((move #ROT ?rot) (move #TETE ?t)) ; :modif ((rot_agent ?rot)) ; ;--- decompose une marche en 4 mouvements #REGLE ; :nom "avancer_tout_droit" ; :var (?x) ; :precond ((calcule_incr ?t ?x 0.5)) ; :new_pb (BOUCLE (droite ?t) PUIS (milieu ?t) PUIS (gauche ?t) PUIS (milieu ?t) ); :plan () ; :modif ((transl_agent ?x)) ; ;--- avance jambe droite, recule jambe gauche et bouge les bras #REGLE ; :nom "droite" ; :var (?x) ; :precond ( (assign ?plus +PI_4 0.00 0.00) (assign ?moins -PI_4 0.00 0.00) ) ; :new_pb () ; :plan ((move #TRANSL ?x) (move #JAMBE_GAUCHE ?moins) (move #JAMBE_DROITE ?plus) (move #BRAS_GAUCHE ?plus) (move #BRAS_DROIT ?moins)) ; :modif () ; ;--- replace les jambes au milieu #REGLE ; :nom "milieu" ; :var (?x) ; :precond ( (assign ?plus 0.00 0.00 0.00) ) ; :new_pb () ; :plan ((move #TRANSL ?x) (move #JAMBE_GAUCHE ?plus) (move #JAMBE_DROITE ?plus) (move #BRAS_GAUCHE ?plus) (move #BRAS_DROIT ?plus)) ; :modif () ; ;--- avance jambe gauche et recule jambe droite #REGLE ; :nom "gauche" ; :var (?x) ; :precond ( (assign ?plus +PI_4 0.00 0.00) (assign ?moins -PI_4 0.00 0.00)) ; :new_pb () ; :plan ((move #TRANSL ?x) (move #JAMBE_GAUCHE ?plus) (move #JAMBE_DROITE ?moins) (move #BRAS_GAUCHE ?moins) (move #BRAS_DROIT ?plus)) ; :modif () ; ;----------------------------------------------------------------------------- //--- vole en ligne droite vers ?x en battant des ailes #REGLE ; :nom "voler_droit" ; :var (?x) ; :precond ((calcule_incr ?t ?x 1)) ; :new_pb (BOUCLE (haut ?t) PUIS (bas ?t)) ; :plan () ; :modif ((transl_agent ?x)) ; #REGLE ; :nom "haut" ; :var (?x) ; :precond ((assign ?plus 0.00 0.00 +PI_2) (assign ?moins 0.00 0.00 -PI_2)) ; :new_pb () ; :plan ((move #TRANSL ?x) (move #BRAS_DROIT ?moins) (move #BRAS_GAUCHE ?plus)) ; :modif () ; #REGLE ; :nom "bas" ; :var (?x) ; :precond ((assign ?moins 0.00 0.00 0.00)) ; :new_pb () ; :plan ((move #TRANSL ?x) (move #BRAS_DROIT ?moins) (move #BRAS_GAUCHE ?moins)); :modif () ; ;----------------------------------------------------------------------------- #REGLE ; :nom "position_envol" ; :var (?x) ; :precond ((calcule_angle ?rot ?x) (assign ?y +PI_4 0.00 0.00) (add ?r ?y ?rot) (assign ?z 0.00 0.00 0.00) ); :new_pb () ; :plan ((move #ROT ?r) (move #BRAS_DROIT ?y) (move #BRAS_GAUCHE ?y) (move #TETE ?z) ); :modif ((rot_agent ?r)) ; #REGLE ; :nom "monter_droit" ; :var (?x) ; :precond ((calcule_incr ?t ?x 2)) ; :new_pb () ; :plan (BOUCLE (move #TRANSL ?t)) ; :modif ((transl_agent ?x)) ; ;----------------------------------------------------------------------------- #REGLE ; :nom "bouger_tete" ; :var (?x) ; :precond ((supY ?x -PI_2) (infY ?x +PI_2)) ; :new_pb () ; :plan ((move #TETE ?x)) ; :modif () ; #REGLE ; :nom "bouger_tete" ; :var (?x) ; :precond ((supY ?x 0) (assign ?rot 0.00 +PI_2 0.00) (diff ?y ?x ?rot) (orientation ?z) (add ?t ?y ?z) ) ; :new_pb () ; :plan ((move #ROT ?t) (move #TETE ?rot)) ; :modif ((rot_agent ?t)) ; #REGLE ; :nom "bouger_tete" ; :var (?x) ; :precond ((assign ?rot 0.00 -PI_2 0.00) (diff ?y ?x ?rot) (orientation ?z) (add ?t ?y ?z) ) ; :new_pb () ; :plan ((move #ROT ?t) (move #TETE ?rot)) ; :modif ((rot_agent ?t)) ;