CVS: data/Aircraft/ASK13/Nasal AR3201.nas, NONE, 1.1 ask13-dual-control.nas, NONE, 1.1 wool-thread.nas, NONE, 1.1

Emmanuel Baranger <[email protected]> Sun, 11 Apr 2010 14:49:45 -0500
Newsgroups gmane.games.flightgear.cvc
Message-ID <[email protected]>
Update of /var/cvs/FlightGear-0.9/data/Aircraft/ASK13/Nasal
In directory baron.flightgear.org:/tmp/cvs-serv29125/Nasal

Added Files:
	AR3201.nas ask13-dual-control.nas wool-thread.nas 
Log Message:
- new glider by Patrice POLY

--- NEW FILE "AR3201.nas" ---
# Becker AR-3201 transciever

var ar3201 = func {

setprop("instrumentation/comm/serviceable" ,0);

var chan = 0;
setprop("instrumentation/AR-3201/chan", chan);

var ch=[ 0,0,0,0,0 ];
 ch[0] = getprop("instrumentation/comm/frequencies/selected-mhz");
 ch[1] = 121.5 ;
 ch[2] = 121.5 ;
 ch[3] = 121.5 ;
 ch[4] = 121.5 ;

setprop("instrumentation/AR-3201/stby", ch[0]);
setprop("instrumentation/AR-3201/dummy", ch[0]);
setprop("instrumentation/comm/frequencies/selected-mhz", ch[0]);

setlistener("instrumentation/AR-3201/power", func { 

         if ( getprop("instrumentation/AR-3201/power") == 1 and getprop("instrumentation/comm/serviceable") == 0  )
	      {
		setprop("instrumentation/AR-3201/starting", 1);
                settimer(func { 
				if (getprop("instrumentation/AR-3201/power") > 0) 
				{
				  setprop("instrumentation/AR-3201/starting", 0);
				  setprop("instrumentation/comm/serviceable" ,1)
				}
			      }, 2);			      
	      }

         if (getprop("instrumentation/AR-3201/power") == 0)
	      {
                setprop("instrumentation/AR-3201/starting", 0);
		setprop("instrumentation/comm/serviceable" ,0 );
	      }

 });

setlistener("instrumentation/AR-3201/dummy", func { 

    settimer(func {
    if ( chan  == 0 ) 
    {
        ch[0] = getprop("instrumentation/AR-3201/stby") ;           
        setprop("instrumentation/comm/frequencies/selected-mhz" ,ch[0] );        
    } 
    }, 0.02);

 });

setlistener("instrumentation/AR-3201/chan", func { 

    chan = getprop("instrumentation/AR-3201/chan" );
    setprop("instrumentation/comm/frequencies/selected-mhz", ch[chan] );

 });



setlistener("instrumentation/AR-3201/store", func { 

    chan = getprop("instrumentation/AR-3201/chan" );
    ch[chan] = getprop("instrumentation/AR-3201/stby");
    setprop("instrumentation/comm/frequencies/selected-mhz", ch[chan] );

 });

}

# Start the transciever ASAP
ar3201();

--- NEW FILE "ask13-dual-control.nas" ---
###############################################################################
## 
## Nasal for MP-passenger on the ASK-13 over the multiplayer network.
##
##  Copyright (C) 2010 Patrice Poly, based on dual control by
##  Anders Gidenstam  :  http://www.gidenstam.org/FlightGear/DualControl/
##  This file is licensed under the GPL license version 2 or later.
##
###############################################################################

# Renaming (almost :)
var DCT = dual_control_tools;

######################################################################
# Pilot/copilot aircraft identifiers. Used by dual_control.
var pilot_type   = "Aircraft/ASK13/Models/ask13.xml";
var copilot_type = "";

props.globals.initNode("/sim/remote/pilot-callsign", "", "STRING");

######################################################################
# MP enabled properties.
# NOTE: These must exist very early during startup - put them
#       in the -set.xml file.


######################################################################
# Useful local property paths.

######################################################################
# Slow state properties for replication.


###############################################################################
# Pilot MP property mappings and specific copilot connect/disconnect actions.


######################################################################
# Used by dual_control to set up the mappings for the pilot.
var pilot_connect_copilot = func (copilot) {
    return 
        [
         ######################################################################
         # Process received properties.
         ######################################################################
         ######################################################################
         # Process properties to send.
         ######################################################################
        ];
}

######################################################################
var pilot_disconnect_copilot = func {
}


###############################################################################
# Copilot MP property mappings and specific pilot connect/disconnect actions.


######################################################################
# Used by dual_control to set up the mappings for the copilot.
var copilot_connect_pilot = func (pilot) {
    # Initialize Nasal wrappers for copilot pick anaimations.
    set_copilot_wrappers(pilot);

    return
        [
         ######################################################################
         # Process received properties.
         ######################################################################
         ######################################################################
         # Process properties to send.
         ######################################################################
        ];
}

######################################################################
var copilot_disconnect_pilot = func {
    # Reset local sound properties.

#    p = "/gear/gear[0]/wow";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
#    p = "/gear/gear[1]/wow";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
#    p = "/gear/gear[2]/wow";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
    p = "/velocities/groundspeed-kt";
    props.globals.getNode(p).unalias();
    props.globals.getNode(p).setValue(0);
    p = "/velocities/airspeed-kt";
    props.globals.getNode(p).unalias();
    props.globals.getNode(p).setValue(0);
    p = "/position/altitude-ft";
    props.globals.getNode(p).unalias();
    props.globals.getNode(p).setValue(0);
#    p = "/surface-positions/speedbrake-pos-norm";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
#    p = "/fdm/jsbsim/aero/alpha-rad[0]";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
    p = "/velocities/vertical-speed-fps";
    props.globals.getNode(p).unalias();
    props.globals.getNode(p).setValue(0);
    p = "/velocities/speed-down-fps";
    props.globals.getNode(p).unalias();
    props.globals.getNode(p).setValue(0);
#    p = "/accelerations/pilot-gdamped";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
#    p = "/orientation/pitch-rate-degps";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
#    p = "/sim/hitches/winch/open";
#    props.globals.getNode(p).unalias();
#    props.globals.getNode(p).setValue(0);
}

######################################################################
# Copilot Nasal wrappers

var set_copilot_wrappers = func (pilot) {
    # Setup aliases to animate the MP 3d model.
    var p = "instrumentation/magnetic-compass/indicated-heading-deg";
    pilot.getNode(p,1).alias(props.globals.getNode(p));

    # Setup aliases to drive local sound.

#    p = "/gear/gear[0]/wow";
#    props.globals.getNode(p).alias(pilot.getNode(p));
#    p = "/gear/gear[1]/wow";
#    props.globals.getNode(p).alias(pilot.getNode(p));
#    p = "/gear/gear[2]/wow";
#    props.globals.getNode(p).alias(pilot.getNode(p));
    p = "/velocities/groundspeed-kt";
    props.globals.getNode(p).alias(pilot.getNode(p));
    p = "/velocities/airspeed-kt";
    props.globals.getNode(p).alias(pilot.getNode(p));
    p = "/position/altitude-ft";
    props.globals.getNode(p).alias(pilot.getNode(p));
#    p = "/surface-positions/speedbrake-pos-norm";
#    props.globals.getNode(p).alias(pilot.getNode(p));
#    p = "/fdm/jsbsim/aero/alpha-rad[0]";
#    props.globals.getNode(p).alias(pilot.getNode(p));
    p = "/velocities/vertical-speed-fps";
    props.globals.getNode(p).alias(pilot.getNode(p));
    p = "/velocities/speed-down-fps";
    props.globals.getNode(p).alias(pilot.getNode(p));
#    p = "/accelerations/pilot-gdamped";
#    props.globals.getNode(p).alias(pilot.getNode(p));
#    p = "/orientation/pitch-rate-degps";
#    props.globals.getNode(p).alias(pilot.getNode(p));
#    p = "/sim/hitches/winch/open";
#    props.globals.getNode(p).alias(pilot.getNode(p));
}

--- NEW FILE "wool-thread.nas" ---
# Simple vibrating yawstring

var yawstring = func {

	var airspeed = getprop("velocities/airspeed-kt");
        var severity = 0;	
        if  (  airspeed < 54 ) 
	{
         severity = ( math.sin (  math.pi * airspeed/54 ) * rand() ) ;
        }
	var position = getprop("orientation/side-slip-deg") + severity ;

	setprop("instrumentation/yawstring",position);
	
	settimer(yawstring,0);

}

# Start the yawstring ASAP
yawstring();


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev