OK, if anyone wants to try it before I get home, the following 5-line
patch adds support for a settable "castering" attribute for gear
objects.  Apply it to the YASim directory, and then replace the tail
wheel definition in dc3.xml with this:

 <!-- Tail wheel; has castering selectable by a wheel lock -->
 <gear x="-17.3" y="0" z="-1.5" compression="0.2">
   <control-input axis="/controls/tailwheel-castering" control="CASTERING"/>
 </gear>

Then bind a key to toggle it, and we're set.  Hopefully I haven't
broken anything.  I'll test it this evening.

Note that I chose the sense of the property ("-castering" instead of
"-locked") to make the default state (false) to mean "locked for
takeoff".  Changing this to the inverse could be done via the src/dst
parameters to the control-input tag.  This is a little messy, as they
were designed for floating point mappings and not booleans, but it
works:

 <!-- Tail wheel; has castering selectable by a wheel lock -->
 <gear x="-17.3" y="0" z="-1.5" compression="0.2">
   <control-input axis="/controls/tailwheel-locked" control="CASTERING"
                  src0="0" src1="1" dst0="1" dst1="0"/>
 </gear>

Andy

-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
 - Sting (misquoted)
Index: ControlMap.cpp
===================================================================
RCS file: /var/cvs/FlightGear-0.7/FlightGear/src/FDM/YASim/ControlMap.cpp,v
retrieving revision 1.8
diff -u -r1.8 ControlMap.cpp
--- ControlMap.cpp      10 May 2002 21:35:07 -0000      1.8
+++ ControlMap.cpp      22 May 2002 22:02:56 -0000
@@ -192,6 +192,7 @@
        case BRAKE:    ((Gear*)obj)->setBrake(lval);               break;
        case STEER:    ((Gear*)obj)->setRotation(lval);            break;
        case EXTEND:   ((Gear*)obj)->setExtension(lval);           break;
+       case CASTERING:((Gear*)obj)->setCastering(lval != 0);      break;
        case SLAT:     ((Wing*)obj)->setSlat(lval);                break;
        case FLAP0:    ((Wing*)obj)->setFlap0(lval, rval);         break;
        case FLAP1:    ((Wing*)obj)->setFlap1(lval, rval);         break;
Index: ControlMap.hpp
===================================================================
RCS file: /var/cvs/FlightGear-0.7/FlightGear/src/FDM/YASim/ControlMap.hpp,v
retrieving revision 1.7
diff -u -r1.7 ControlMap.hpp
--- ControlMap.hpp      1 Mar 2002 05:47:28 -0000       1.7
+++ ControlMap.hpp      22 May 2002 22:02:56 -0000
@@ -13,7 +13,7 @@
                      ADVANCE, REHEAT, PROP,
                      BRAKE, STEER, EXTEND,
                      INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR,
-                      BOOST };
+                      BOOST, CASTERING };
 
     enum { OPT_SPLIT  = 0x01,
            OPT_INVERT = 0x02,
Index: FGFDM.cpp
===================================================================
RCS file: /var/cvs/FlightGear-0.7/FlightGear/src/FDM/YASim/FGFDM.cpp,v
retrieving revision 1.10
diff -u -r1.10 FGFDM.cpp
--- FGFDM.cpp   21 May 2002 05:40:46 -0000      1.10
+++ FGFDM.cpp   22 May 2002 22:02:57 -0000
@@ -174,8 +174,6 @@
         g->setBrake(attrf(a, "skid", 0));
        g->setStaticFriction(attrf(a, "sfric", 0.8));
        g->setDynamicFriction(attrf(a, "dfric", 0.7));
-       if(a->hasAttribute("castering"))
-           g->setCastering(true);
        _airplane.addGear(g);
     } else if(eq(name, "fuselage")) {
        float b[3];
@@ -500,6 +498,7 @@
     if(eq(name, "FLAP1"))     return ControlMap::FLAP1;
     if(eq(name, "SLAT"))      return ControlMap::SLAT;
     if(eq(name, "SPOILER"))   return ControlMap::SPOILER;
+    if(eq(name, "CASTERING")) return ControlMap::CASTERING;
     SG_LOG(SG_FLIGHT,SG_ALERT,"Unrecognized control type '"
            << name << "' in YASim aircraft description.");
     exit(1);

Reply via email to