Hi all , and Andy,I've added propeller reverse to YASim , with Controlmap type PROPREVERSE ... I've tested it with the piston and turboprop , and seems to be working well . Just wonder if this could be added if Andy approves . Of course , it might need improvements , but I thought I'd include the patch for comments , viewing , etc. All it does is multiply the thrust by -0.2 when the chosen property, ("/controls/engines/engine/reverser", here), is true. Wasn't sure what the best factor was , most of the data sheets i've
read show blade reverse angles of about -8 degrees. Hope it can be included ... Cheers
Index: ControlMap.cpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/ControlMap.cpp,v retrieving revision 1.13 diff -U 3 -r1.13 ControlMap.cpp --- ControlMap.cpp 10 Dec 2007 19:25:24 -0000 1.13 +++ ControlMap.cpp 27 Sep 2008 05:47:56 -0000 @@ -196,6 +196,7 @@ case ADVANCE: ((PropEngine*)obj)->setAdvance(lval); break; case PROPPITCH: ((PropEngine*)obj)->setPropPitch(lval); break; case PROPFEATHER: ((PropEngine*)obj)->setPropFeather((int)lval); break; + case PROPREVERSE: ((PropEngine*)obj)->setPropReverse((bool)lval); break; case REHEAT: ((Jet*)obj)->setReheat(lval); break; case VECTOR: ((Jet*)obj)->setRotation(lval); break; case BRAKE: ((Gear*)obj)->setBrake(lval); break; Index: ControlMap.hpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/ControlMap.hpp,v retrieving revision 1.12 diff -U 3 -r1.12 ControlMap.hpp --- ControlMap.hpp 10 Dec 2007 19:25:24 -0000 1.12 +++ ControlMap.hpp 27 Sep 2008 05:47:56 -0000 @@ -13,7 +13,7 @@ ADVANCE, REHEAT, PROP, BRAKE, STEER, EXTEND, HEXTEND, LEXTEND, INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR, - BOOST, CASTERING, PROPPITCH, PROPFEATHER, + BOOST, CASTERING, PROPPITCH, PROPFEATHER,PROPREVERSE, COLLECTIVE, CYCLICAIL, CYCLICELE, ROTORENGINEON, TILTYAW, TILTPITCH, TILTROLL, ROTORBRAKE, ROTORENGINEMAXRELTORQUE, ROTORRELTARGET, Index: FGFDM.cpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/FGFDM.cpp,v retrieving revision 1.55 diff -U 3 -r1.55 FGFDM.cpp --- FGFDM.cpp 13 Apr 2008 21:12:36 -0000 1.55 +++ FGFDM.cpp 27 Sep 2008 05:47:57 -0000 @@ -954,6 +954,7 @@ if(eq(name, "CASTERING")) return ControlMap::CASTERING; if(eq(name, "PROPPITCH")) return ControlMap::PROPPITCH; if(eq(name, "PROPFEATHER")) return ControlMap::PROPFEATHER; + if(eq(name, "PROPREVERSE")) return ControlMap::PROPREVERSE; if(eq(name, "COLLECTIVE")) return ControlMap::COLLECTIVE; if(eq(name, "CYCLICAIL")) return ControlMap::CYCLICAIL; if(eq(name, "CYCLICELE")) return ControlMap::CYCLICELE; Index: PropEngine.cpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/PropEngine.cpp,v retrieving revision 1.18 diff -U 3 -r1.18 PropEngine.cpp --- PropEngine.cpp 27 Feb 2006 23:35:02 -0000 1.18 +++ PropEngine.cpp 27 Sep 2008 05:47:57 -0000 @@ -42,6 +42,12 @@ _prop->setPropPitch(proppitch); } +void PropEngine::setPropReverse(bool state) +{ + // toggle Propeller reverse + _prop->setPropReverse(state); +} + void PropEngine::setPropFeather(int state) { // toggle prop feathering on/off Index: PropEngine.hpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/PropEngine.hpp,v retrieving revision 1.8 diff -U 3 -r1.8 PropEngine.hpp --- PropEngine.hpp 13 Dec 2004 23:48:43 -0000 1.8 +++ PropEngine.hpp 27 Sep 2008 05:47:57 -0000 @@ -18,6 +18,7 @@ void setMagnetos(int magnetos); void setAdvance(float advance); void setPropPitch(float proppitch); + void setPropReverse(bool state); void setVariableProp(float min, float max); void setPropFeather(int state); void setGearRatio(float ratio) { _gearRatio = ratio; } Index: Propeller.cpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Propeller.cpp,v retrieving revision 1.6 diff -U 3 -r1.6 Propeller.cpp --- Propeller.cpp 26 Feb 2006 16:46:51 -0000 1.6 +++ Propeller.cpp 27 Sep 2008 05:47:57 -0000 @@ -25,6 +25,7 @@ _manual = false; _proppitch = 0; _propfeather = 0; + _propreverse = 0; } void Propeller::setTakeoff(float omega0, float power0) @@ -68,6 +69,11 @@ _propfeather = (state != 0); } +void Propeller::setPropReverse(bool state) +{ + _propreverse = state; +} + void Propeller::calc(float density, float v, float omega, float* thrustOut, float* torqueOut) { @@ -114,7 +120,7 @@ torque = tau0 - tau0 * (lambda - 1) / (lambdaWM - 1); torque *= 0.5f * density * V2 * _f0; } - + if(_propreverse)thrust =thrust*-0.2; *thrustOut = thrust; *torqueOut = torque; } Index: Propeller.hpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Propeller.hpp,v retrieving revision 1.4 diff -U 3 -r1.4 Propeller.hpp --- Propeller.hpp 26 Feb 2006 16:46:51 -0000 1.4 +++ Propeller.hpp 27 Sep 2008 05:47:57 -0000 @@ -24,6 +24,8 @@ void setPropPitch(float proppitch); + void setPropReverse(bool state); + void setPropFeather(int state); void setManualPitch(); @@ -46,6 +48,7 @@ bool _manual; // manual pitch mode float _proppitch; // prop pitch control setting (0 ~ 1.0) float _propfeather; // prop feather control setting (0 = norm, 1 = feather) + bool _propreverse; // prop reversed(0 ~1.0) }; }; // namespace yasim
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel