I would like to present what i am developing  for crash animation
handling, with JSBSim
That exemple is only a skeleton. It use Nasal, and should be tailor made
for the Aircraft.

It is only based on AC_GEAR contact points (CP)  definitions, test of
values for each CP and decision or not to start the crash processing (in
the exemple we only use WOW).
Once the crash detected an animation process can be started which look
like "bo105 animation" (in that case everything is possible).

This is only working with FG-9.8
The last CVS modification which activate a Pause on AGL test makes it
impossible. The contact points become unusable.

Nasal exemple as attached document

-- 
Gerard
#====CRASH_ANIMATION_WITH_JSBSim_FDM====
#===========================INITIALIZATION================================

state = getprop("sim/model/f4u/state");
print ("state: " , state);

type = getprop("sim/aircraft");
print ("type: " , type);



#=Init_SENSORS======each_one_being_defined_in_JSBAircraft.xml==========

setprop("gear/gear[3]/wow",0);
setprop("gear/gear[4]/wow",0);
setprop("gear/gear[5]/wow",0);
setprop("gear/gear[6]/wow",0);
setprop("gear/gear[7]/wow",0);
setprop("gear/gear[8]/wow",0);
setprop("gear/gear[9]/wow",0);
setprop("gear/gear[10]/wow",0);
setprop("gear/gear[11]/wow",0);
setprop("gear/gear[12]/wow",0);



#==========================

delay = 4;
print ("delay crash: ", delay);
crashstart = 0;

# ==========================CRASH MANAGEMENT========================
crash = func {
        setprop("controls/engines/engine[0]/magnetos",0);       
        print ("moteur coupé");
        crashstart = getprop("/sim/time/elapsed-sec");  
        #every_animations_we_want
        print ("start", crashstart);
        crashdeb();
}

#==Delay_before_Stop====
crashdeb = func {
        now  = getprop("sim/time/elapsed-sec");         
        if (now - crashstart > delay ) {
        print ("now", now);     
        crashend();     
        } else {
        settimer (crashdeb,1);
        print ("boucle");
        }               
}
#===fin_crash=========
crashend = func {       
        print ("crash actif");  
        setprop("sim/freeze/clock", 1); 
        setprop("sim/freeze/main", 1)
}
#==another_quick_end_without_delay====          
crashgr = func {
        setprop("controls/engines/engine[0]/magnetos",0);
        print ("moteur coupé");        
        setprop("sim/freeze/clock", 1); 
}






# ==========================CRASH_DETECTION================================



main_loop = func {
        crashedgr = props.globals.getNode("gear/gear[12]/wow",1);
        crashed3 = props.globals.getNode("gear/gear[3]/wow",1); 
        crashed4 = props.globals.getNode("gear/gear[4]/wow",1);
        crashed5 = getprop("gear/gear[5]/wow"); 
        crashed6 = getprop("gear/gear[6]/wow");
        crashed7 = getprop("gear/gear[7]/wow"); 
        crashed8 = getprop("gear/gear[8]/wow");
        crashed9 = getprop("gear/gear[9]/wow"); 
        crashed10 = getprop("gear/gear[10]/wow");
        crashed11 = getprop("gear/gear[11]/wow");

        if (crashed3.getValue()) {
        print ("sensor3");
        crashgr();      
        } 
        elsif (crashed4.getValue()) {
        print ("sensor4");
        crashgr();      
        } 
        elsif (crashed5 == 1) {
        print ("sensor5");
        crash();
        }
        elsif (crashed6 == 1) {
        print ("sensor6");
        crash();        
        }       
        elsif (crashed7 == 1) {
        print ("sensor7");
        crash();        
        } 
        elsif (crashed8 == 1) {
        print ("sensor8");
        crash();        
        } 
        elsif (crashed9 == 1) {
        print ("sensor9");
        crash();
        }
        elsif (crashed10  == 1) {
        print ("sensor10");     
        crash();
        }
        elsif (crashed11 == 1) {
        print ("sensor11");
        crash();        
        }       
        elsif (crashedgr.getValue()) {
        print ("sensorgr");
        setprop("controls/gear/brake-parking",1);
        crash();        
        } 
        else {
        settimer(main_loop,2);
        }
}
main_loop();





_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to