Hi,here is a small patch for YASim, which introduces initial loads to the springs. With it you can tame e. g. the jitter of the beaver. It is a local diff to my last gear-patch. In principle it is independent from the last patch, but it is within the same lines of code, so the patch tool probably will fail if you patch the cvs-files.
Please find enclosed a cvs-diff for the documentation as well as a cvs-diff for the beaver (including the last patch).
@Andy: please commit to cvs. Maik
Index: dhc2F.xml =================================================================== RCS file: /var/cvs/FlightGear-0.9/data/Aircraft/dhc2/dhc2F.xml,v retrieving revision 1.7 diff -u -p -r1.7 dhc2F.xml --- dhc2F.xml 5 Sep 2006 19:03:42 -0000 1.7 +++ dhc2F.xml 1 Jan 2007 20:53:47 -0000 @@ -68,58 +68,110 @@ <!-- Floats--> - <gear x="3.28" y="1.5" z="-2.06" compression="0.2" spring = "2" sfric = "2.5"> - <control-input control="BRAKE" axis="/controls/gear/brake-parking" /> - <control-input control="BRAKE" axis="/controls/gear/brake-left" /> + <gear x="3.52" y="1.5" z="-2.4" compression="0.7" spring = "10" sfric = "0.8" dfric = "0.6" ignored-by-solver="1" + on-water="1" on-solid="0" reduce-friction-by-extension="1.25" + speed-planing="15" spring-factor-not-planing="0.15"> </gear> - <gear x="3.28" y="-1.5" z="-2.06" compression="0.2" spring = "2" sfric = "2.5"> - <control-input control="BRAKE" axis="/controls/gear/brake-parking" /> - <control-input control="BRAKE" axis="/controls/gear/brake-right" /> + <gear x="3.52" y="-1.5" z="-2.4" compression="0.7" spring = "10" sfric = "0.8" dfric = "0.6" ignored-by-solver="1" + on-water="1" on-solid="0" reduce-friction-by-extension="1.25" + speed-planing="15" spring-factor-not-planing="0.15"> </gear> - <gear x="-3.25" y="1.5" z="-1.6" compression="0.2" spring = "2" sfric = "2.5"> - <control-input axis="/controls/flight/rudder" control="STEER" -invert="true" square="true"/> + <gear x="0.0" y="1.5" z="-2.1" compression="0.7" spring = "10" sfric = "0.8" dfric = "0.6" ignored-by-solver="1" + on-water="1" on-solid="0" reduce-friction-by-extension="1.25" + speed-planing="25" spring-factor-not-planing="0.15"> </gear> - <gear x="-3.25" y="-1.5" z="-1.6" compression="0.2" spring = "2" sfric = "2.5"> - <control-input axis="/controls/flight/rudder" control="STEER" -invert="true" square="true"/> + <gear x="0.0" y="-1.5" z="-2.1" compression="0.7" spring = "10" sfric = "0.8" dfric = "0.6" ignored-by-solver="1" + on-water="1" on-solid="0" reduce-friction-by-extension="1.25" + speed-planing="25" spring-factor-not-planing="0.15"> </gear> - - <!-- Retractable wheels--> - <gear x="3.52" y="1.5" z="-2.57" compression="0.2" spring = "3" sfric = "2.5" retract-time="4"> + + <!-- Retractable wheels--> + + <gear x="3.52" y="1.5" z="-2.57" compression="0.2" spring = "2" sfric = "0.5" dfric=".45" retract-time="4" initial-load="0" damp="0.6"> <control-input control="STEER" axis="/controls/flight/rudder" square="true"/> <control-input axis="/controls/gear/gear-down" control="EXTEND"/> <control-output control="EXTEND" prop="/gear/gear[4]/position-norm"/> <control-speed control="EXTEND" transition-time="4"/> </gear> - <gear x="3.52" y="-1.5" z="-2.57" compression="0.2" spring = "3" sfric = "2.5" retract-time="4"> + <gear x="3.52" y="-1.5" z="-2.57" compression="0.2" spring = "2" sfric = "0.5" dfric=".45" retract-time="4" initial-load="0" damp="0.6"> <control-input control="STEER" axis="/controls/flight/rudder" square="true"/> <control-input axis="/controls/gear/gear-down" control="EXTEND"/> <control-output control="EXTEND" prop="/gear/gear[5]/position-norm"/> <control-speed control="EXTEND" transition-time="4"/> </gear> - <gear x="-0.22" y="1.5" z="-2.57" compression="0.2" spring = "3" sfric = "2.5" retract-time="4"> - <control-input control="BRAKE" axis="/controls/gear/brake-parking" /> - <control-input control="BRAKE" axis="/controls/gear/brake-left" /> - <control-input axis="/controls/gear/gear-down" control="EXTEND"/> - <control-output control="EXTEND" prop="/gear/gear[6]/position-norm"/> - <control-speed control="EXTEND" transition-time="4"/> + <gear x="-0.22" y="1.5" z="-2.57" compression="0.2" spring = "3.5" sfric = "0.5" dfric=".45" retract-time="4" initial-load="1" damp="10.1"> + <control-input control="BRAKE" axis="/controls/gear/brake-parking" /> + <control-input control="BRAKE" axis="/controls/gear/brake-left" /> + <control-input axis="/controls/gear/gear-down" control="EXTEND"/> + <control-output control="EXTEND" prop="/gear/gear[6]/position-norm"/> + <control-speed control="EXTEND" transition-time="4"/> </gear> - - <gear x="-0.22" y="-1.5" z="-2.57" compression="0.2" spring = "3" sfric = "2.5" retract-time="4"> + + <gear x="-0.22" y="-1.5" z="-2.57" compression="0.2" spring = "3.5" sfric = "0.5" dfric=".45" retract-time="4" initial-load="1" damp="10.1"> <control-input control="BRAKE" axis="/controls/gear/brake-parking" /> <control-input control="BRAKE" axis="/controls/gear/brake-right" /> <control-input axis="/controls/gear/gear-down" control="EXTEND"/> <control-output control="EXTEND" prop="/gear/gear[7]/position-norm"/> <control-speed control="EXTEND" transition-time="4"/> </gear> - -<!-- Fuel --> <tank x="1.5" y="0" z="-0.7" capacity="210" /> + + +<!-- 2 more Floats, need to be at this position in the file to do not brake the animation + "reduce-friction-by-extension" is reduced to get steering control--> + + <gear x="-3.22" y="1.5" z="-2.0" compression="0.7" spring = "10" sfric = "0.8" dfric = "0.6" ignored-by-solver="1" + on-water="1" on-solid="0" reduce-friction-by-extension="0.9" + speed-planing="25" spring-factor-not-planing="0.15"> + <control-input axis="/controls/flight/rudder" control="STEER" + invert ="true" square="true"/> + </gear> + <gear x="-3.22" y="-1.5" z="-2.0" compression="0.7" spring = "10" sfric = "0.8" dfric = "0.6" ignored-by-solver="1" + on-water="1" on-solid="0" reduce-friction-by-extension="0.9" + speed-planing="25" spring-factor-not-planing="0.15"> + <control-input axis="/controls/flight/rudder" control="STEER" + invert="true" square="true"/> + </gear> + + + <!-- The Floats on solid ground--> + + <gear x="3.52" y="1.5" z="-2.4" compression="0.4" spring = "10" sfric = "1.5" dfric = "1.3" skid="1" ignored-by-solver="1"> + </gear> + + <gear x="3.52" y="-1.5" z="-2.4" compression="0.4" spring = "10" sfric = "1.5" dfric = "1.3" skid="1" ignored-by-solver="1"> + </gear> + + <gear x="0.0" y="1.5" z="-2.1" compression="0.2" spring = "10" sfric = "1.5" dfric = "1.3" skid="1" ignored-by-solver="1"> + </gear> + + <gear x="0.0" y="-1.5" z="-2.1" compression="0.2" spring = "10" sfric = "1.5" dfric = "1.3" skid="1" ignored-by-solver="1"> + </gear> + + <gear x="-3.22" y="1.5" z="-2.0" compression="0.2" spring = "10" sfric = "1.5" dfric = "1.3" skid="1" ignored-by-solver="1"> + </gear> + + <gear x="-3.22" y="-1.5" z="-2.0" compression="0.2" spring = "10" sfric = "1.5" dfric = "1.3" skid="1" ignored-by-solver="1"> + </gear> + + + <!-- Retractable wheels on water--> + <gear x="-0.22" y="1.5" z="-2.57" compression="0.2" spring = "0.1" sfric = "1" dfric="1" retract-time="4" on-water="1" on-solid="0" ignored-by-solver="1" reduce-friction-by-extension="0.9"> + <control-input axis="/controls/gear/gear-down" control="EXTEND"/> + <control-speed control="EXTEND" transition-time="4"/> + </gear> + + <gear x="-0.22" y="-1.5" z="-2.57" compression="0.2" spring = "0.1" sfric = "1" dfric ="1" retract-time="4" on-water="1" on-solid="0" ignored-by-solver="1" reduce-friction-by-extension="0.9"> + <control-input axis="/controls/gear/gear-down" control="EXTEND"/> + <control-speed control="EXTEND" transition-time="4"/> + </gear> + + + <!-- Fuel --> <tank x="1.5" y="0" z="-0.7" capacity="210" /> <tank x="0.0" y="0" z="-0.7" capacity="210" /> <tank x="-1.5" y="0" z="-0.7" capacity="156" />
Index: README.yasim =================================================================== RCS file: /var/cvs/FlightGear-0.9/data/Docs/README.yasim,v retrieving revision 1.17 diff -u -p -r1.17 README.yasim --- README.yasim 10 Nov 2006 18:06:24 -0000 1.17 +++ README.yasim 1 Jan 2007 20:55:53 -0000 @@ -44,6 +44,15 @@ fuselage: This defines a tubelike struct expressed as a fraction (0-1) of the width value. midpoint: The location of the widest part of the fuselage, expressed as a fraction of the distance between A and B. + idrag: Multiplier for the "induced drag" generated by this + object. Default is one. With idrag=0 the fuselage + generates only drag. + cx,cy,cz: Factors for the generated drag in the fuselages "local + coordinate system" with x pointing from end to front, + z perpendicular to x with y=0 in the aircraft coordinate + system. E.g. for a fuselage of a height of 2 times the + width you can define cy=2 and (due to the doubled front + surface) cx=2. wing: This defines the main wing of the aircraft. You can have only one (but see below about using vstab objects for extra @@ -288,10 +297,22 @@ actionpt: Defines an "action point" for x,y,z: The location of force application. gear: Defines a landing gear. Accepts <control> subelements to map - properties to steering and braking. + properties to steering and braking. Can also be used to simulate + floats. Although the coefficients are still called ..fric, it + is calculated in fluids as a drag (proportional to the square + of the speed). In fluids gears are not considured to detect + crashes (as on ground). x,y,z: The location of the fully-extended gear tip. compression: The distance in meters along the "up" axis that the gear will compress. + initial-load: The initial load of the spring in multiples of + compression. Defaults to 0. (With this parameter + a lower spring-constants will be used for the + gear-> can reuce numerical problems (jitter)) + Note: the spring-constant is varied from 0% + compression to 20% compression to get continous + behavior around 0 compression. (could be physically + explained by wheel deformation) upx/upy/upz: The direction of compression, defaults to vertical (0,0,1) if unspecified. These are used only for a direction -- the vector need @@ -312,6 +333,35 @@ gear: Defines a landing gear. Accep unstable. If you can't make the gear stop bouncing with this number, try increasing the compression length instead. + on-water: if this is set to "0" the gear will be ignored if + on water. Defaults to "0" + on-solid: if this set to "0" the gear will be ignored if + not on water. Defaults to "1" + inverse-speed-spring-is-doubled: At this speed (the inverse of + the speed must be given) the spring constant + is doubled. The idea is, to use this on water to + simulate the speed dependend lift of a float. + Defaults to "0" + speed-planing: + spring-factor-not-planing: + At zero speed the spring factor is multiplied by + spring-factor-not-planing. Above speed_planing this + factor is equalt to 1. THe diea is, to use this for + floats simulating the transition from swimming to + planing. speed_planing defaults to 0, + spring-factor-not-planing defaults to 1. + reduce-friction-by-extension: at full extension the friction is + reduced by this relative value. 0.7 means 30% friction + at full extension. If you specify a value greater + than one, the friction will be zero before reaching + full extension. Defaults to "0" + ignored-by-solver: with the on-water/on-solid tags you can have more + than one set of gears in one aircraft, If the solver + (who automatically generates the spring constants) + would take all gears into account, the result would be + wrong. E. G. set this tag to "1" for all gears, which + are not active on runways. Defaults to "0". You can + not exclude all gears in the solving process. launchbar: Defines a catapult launchbar or strop. x,y,z: The location of the mount point of the launch bar or @@ -469,6 +519,9 @@ rotor: A rotor. Used for simulating h If you specify a rotor, you do not need to specify a wing or hstab, the settings for approach and cruise will be ignored then. You have to specify the solver results manually. See below. + The rotor generates downwash acting on all stabs, surfaces and + fuselages. For all fuselages in the rotor downwash you should + specify idrag="0" to get realistic results. name: The name of the rotor. (some data is stored at /rotors/name/) @@ -481,7 +534,6 @@ rotor: A rotor. Used for simulating h A value stall gives the fraction of the rotor in stall (weighted by the fraction the have on lift and drag without stall). Use this for modifying the rotor-sound. - The torque property has a bug. x,y,z: The position of the rotor center nx,ny,nz: The normal of the rotor (pointing upwards, will be normalized by the computer) @@ -555,11 +607,6 @@ rotor: A rotor. Used for simulating h is stall. In the range between this incidences it is interpolated linear. - The airfoil of the rotor can be described in two ways. First you - can define the needed power for different pitch values and the - total lift force at a user-defined pitch value. Don't use pitch - values greater than the stall incidence. You could get strange - results. pitch-a: pitch-b: collective incidence angles, If you start flightgear @@ -573,6 +620,7 @@ rotor: A rotor. Used for simulating h coefficients instead (see below) and adjust the lift with rotor-correction-factor. + The airfoil of the rotor is described as follows: The way is to define the lift and drag coefficients directly. Without stall the c-lift of the profile is assumed to be sin(incidence-"airfoil-incidence-no-lift")*liftcoef; @@ -626,6 +674,8 @@ rotor: A rotor. Used for simulating h So delta3 is the proportional factor between flapping and decrease of incidence. I.e. the tail rotor of a Bo105 has a delta3 of 1. + In some publications delta3 is described by an angle. The + value in YASim is the atan of this angle delta: A factor for the damping constant for the flapping. 1 means a analytical result, which is only a approximation. Has a very strong result in the reaction of the rotor system on @@ -688,7 +738,11 @@ rotorgear: If you are using one ore more yasimliftfactor: the solver is not working with rotor-aircrafts. Therefore you have to specify the results yourself. 10 for drag and 140 for lift seem to be good starting - values. + values. Although the solve is not invoked for aircrafts + with at least one rotor, you need to specifiy the cruise + and the approach seetings. The approach speed is needed to + calculate the gear springs. Use a speed of approx. 50knots. + They do not need to match any real value. The rotorgear needs a <control> subelement for the engine (ROTORGEARENGINEON) and can have a <control> subelement for the
diff -up ./Airplane.cpp ../Airplane.cpp --- ./Airplane.cpp 2006-12-24 00:56:39.873990400 +0100 +++ ../Airplane.cpp 2007-01-01 18:27:13.758169600 +0100 @@ -730,7 +730,7 @@ void Airplane::solveGear() float e = energy * gr->wgt; float comp[3]; gr->gear->getCompression(comp); - float len = Math::mag3(comp); + float len = Math::mag3(comp)*(1+2*gr->gear->getInitialLoad()); // Energy in a spring: e = 0.5 * k * len^2 float k = 2 * e / (len*len); Only in ..: CVS diff -up ./FGFDM.cpp ../FGFDM.cpp --- ./FGFDM.cpp 2006-12-31 13:25:43.804753600 +0100 +++ ../FGFDM.cpp 2007-01-01 17:07:00.397899200 +0100 @@ -269,6 +269,7 @@ void FGFDM::startElement(const char* nam v[i] *= attrf(a, "compression", 1); g->setCompression(v); g->setBrake(attrf(a, "skid", 0)); + g->setInitialLoad(attrf(a, "initial-load", 0)); g->setStaticFriction(attrf(a, "sfric", 0.8)); g->setDynamicFriction(attrf(a, "dfric", 0.7)); g->setSpring(attrf(a, "spring", 1)); diff -up ./Gear.cpp ../Gear.cpp --- ./Gear.cpp 2006-12-31 14:37:14.003756800 +0100 +++ ../Gear.cpp 2007-01-01 20:53:43.137112000 +0100 @@ -21,6 +21,7 @@ Gear::Gear() _dfric = 0.7f; _brake = 0; _rot = 0; + _initialLoad=0; _extension = 1; _castering = false; _frac = 0; @@ -140,6 +141,11 @@ void Gear::setReduceFrictionByExtension( _reduceFrictionByExtension=s; } +void Gear::setInitialLoad(float l) +{ + _initialLoad=l; +} + void Gear::setGlobalGround(double *global_ground, float* global_vel, double globalX, double globalY, int type, const SGMaterial *material) @@ -368,7 +374,16 @@ void Gear::calcForce(RigidBody* body, St // Finally, we can start adding up the forces. First the spring // compression. (note the clamping of _frac to 1): _frac = (_frac > 1) ? 1 : _frac; - float fmag = _frac*clen*_spring; + + // Add the initial load to frac, but with continous transistion around 0 + float frac_with_initial_load; + if (_frac>0.2 || _initialLoad==0.0) + frac_with_initial_load=_frac+_initialLoad; + else + frac_with_initial_load=(_frac+_initialLoad) + *_frac*_frac*3*25-_frac*_frac*_frac*2*125; + + float fmag = frac_with_initial_load*clen*_spring; float inversespeed_multiplied_by_speed=0; if (_inverseSpeedSpringIsDoubled>0.0000001) { inversespeed_multiplied_by_speed=Math::mag3(cv)*_inverseSpeedSpringIsDoubled; diff -up ./Gear.hpp ../Gear.hpp --- ./Gear.hpp 2006-12-31 14:35:36.333313600 +0100 +++ ../Gear.hpp 2007-01-01 17:22:58.405446400 +0100 @@ -47,6 +47,7 @@ public: void setSpringFactorNotPlaning(float f); void setSpeedPlaning(float s); void setReduceFrictionByExtension(float s); + void setInitialLoad(float l); void setIgnoreWhileSolving(bool c); void setGlobalGround(double* global_ground, float* global_vel, double globalX, double globalY, @@ -63,6 +64,7 @@ public: float getBrake(); float getRotation(); float getExtension(); + float getInitialLoad() {return _initialLoad; } bool getCastering(); float getCasterAngle() { return _casterAngle; } float getRollSpeed() { return _rollSpeed; } @@ -103,6 +105,7 @@ private: float _contact[3]; float _wow; float _frac; + float _initialLoad; float _compressDist; double _global_ground[4]; float _global_vel[3];
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel