From ad19acf1c63806e7cec0355a054a62ffbde3492b Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 29 May 2010 10:36:23 +0100 Subject: [PATCH 1/7] Remove C++ autobrake code - this can all be done easier in XML now! --- projects/VC90/FlightGear/FlightGear.vcproj | 8 - src/Autopilot/Makefile.am | 3 +- src/Autopilot/autobrake.cxx | 349 --------------------- src/Autopilot/autobrake.hxx | 108 ------- src/FDM/JSBSim/JSBSim.cxx | 10 - src/FDM/JSBSim/JSBSim.hxx | 4 - src/Main/fg_init.cxx | 2 - 7 files changed, 1 insertion(+), 483 deletions(-) delete mode 100644 src/Autopilot/autobrake.cxx delete mode 100644 src/Autopilot/autobrake.hxx diff --git a/projects/VC90/FlightGear/FlightGear.vcproj b/projects/VC90/FlightGear/FlightGear.vcproj index bb6d3f382..aa9d5ccb2 100644 --- a/projects/VC90/FlightGear/FlightGear.vcproj +++ b/projects/VC90/FlightGear/FlightGear.vcproj @@ -685,14 +685,6 @@ - - - - diff --git a/src/Autopilot/Makefile.am b/src/Autopilot/Makefile.am index 7ba3b5bb6..05e489b21 100644 --- a/src/Autopilot/Makefile.am +++ b/src/Autopilot/Makefile.am @@ -2,7 +2,6 @@ noinst_LIBRARIES = libAutopilot.a libAutopilot_a_SOURCES = \ route_mgr.cxx route_mgr.hxx \ - xmlauto.cxx xmlauto.hxx \ - autobrake.cxx autobrake.hxx + xmlauto.cxx xmlauto.hxx INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src diff --git a/src/Autopilot/autobrake.cxx b/src/Autopilot/autobrake.cxx deleted file mode 100644 index ec1fcfc0e..000000000 --- a/src/Autopilot/autobrake.cxx +++ /dev/null @@ -1,349 +0,0 @@ -// autobrake.cxx - generic, configurable autobrake system -// -// Written by James Turner, started September 2009. -// -// Copyright (C) 2009 Curtis L. Olson -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// $Id$ - -#include "autobrake.hxx" - -#include
- -FGAutoBrake::FGAutoBrake() : - _lastGroundspeedKts(0.0), - _step(0), - _rto(false), - _armed(false), - _rtoArmed(false), - _engaged(false), - _targetDecel(0.0), - _fcsBrakeControl(0.0), - _leftBrakeOutput(0.0), - _rightBrakeOutput(0.0) -{ - // default config, close to Boeing 747-400 / 777 values - _configNumSteps = 4; - _configRTOStep = -1; - _configDisengageStep = 0; - _configMaxDecel = 11; // ft-sec-sec - _configRTODecel = 11; // ft-sec-sec - _configRTOSpeed = 85; // kts -} - -FGAutoBrake::~FGAutoBrake() -{ -} - -void FGAutoBrake::init() -{ - _root = fgGetNode("/autopilot/autobrake", true); - - _root->tie("armed", SGRawValueMethods - (*this, &FGAutoBrake::getArmed, &FGAutoBrake::setArmed)); - - _root->tie("step", SGRawValueMethods - (*this, &FGAutoBrake::getStep, &FGAutoBrake::setStep)); - - _root->tie("rto", SGRawValueMethods - (*this, &FGAutoBrake::getRTO, &FGAutoBrake::setRTO)); - - _engineControlsNode = fgGetNode("/controls/engines"); - - // brake position nodes - _brakeInputs[0] = fgGetNode("/controls/gear/brake-left"); - _brakeInputs[1] = fgGetNode("/controls/gear/brake-right"); - _brakeInputs[2] = fgGetNode("/controls/gear/copilot-brake-left"); - _brakeInputs[3] = fgGetNode("/controls/gear/copilot-brake-right"); - - // config - SGPropertyNode_ptr config = _root->getChild("config", 0, true); - config->tie("num-steps", SGRawValuePointer(&_configNumSteps)); - config->tie("rto-step", SGRawValuePointer(&_configRTOStep)); - config->tie("disengage-step", SGRawValuePointer(&_configDisengageStep)); - config->tie("rto-decel-fts-sec", SGRawValuePointer(&_configRTODecel)); - config->tie("max-decel-fts-sec", SGRawValuePointer(&_configMaxDecel)); - config->tie("rto-engage-kts", SGRawValuePointer(&_configRTOSpeed)); - - - // outputs - _root->tie("target-decel-fts-sec", - SGRawValueMethods(*this, &FGAutoBrake::getTargetDecel)); - _root->tie("actual-decel-fts-sec", - SGRawValueMethods(*this, &FGAutoBrake::getActualDecel)); - _root->tie("fcs-brake", SGRawValuePointer(&_fcsBrakeControl)); - _root->tie("brake-left-output", SGRawValuePointer(&_leftBrakeOutput)); - _root->tie("brake-right-output", SGRawValuePointer(&_rightBrakeOutput)); - - _root->tie("engaged", SGRawValueMethods(*this, &FGAutoBrake::getEngaged)); -} - -void FGAutoBrake::postinit() -{ - _weightOnWheelsNode = fgGetNode("/gear/gear/wow"); - _groundspeedNode = fgGetNode("/velocities/groundspeed-kt"); - if (!_weightOnWheelsNode) { - return; // don't crash if we're using an acft (UFO, ATC, with no WoW flag) - } - - _lastWoW = _weightOnWheelsNode->getBoolValue(); -} - - -void FGAutoBrake::bind() -{ -} - -void FGAutoBrake::unbind() -{ -} - -void FGAutoBrake::update(double dt) -{ - _leftBrakeInput = SGMiscd::max(_brakeInputs[0]->getDoubleValue(), - _brakeInputs[2]->getDoubleValue()); - _rightBrakeInput = SGMiscd::max(_brakeInputs[1]->getDoubleValue(), - _brakeInputs[3]->getDoubleValue()); - - // various FDMs don't supply sufficent information for us to work, - // so just be passive in those cases. - if (!_weightOnWheelsNode || !_groundspeedNode || !_engineControlsNode) { - // pass the values straight through - _leftBrakeOutput = _leftBrakeInput; - _rightBrakeOutput = _rightBrakeInput; - return; - } - - if (dt <= 0.0) { - return; // paused - } - - double gs = _groundspeedNode->getDoubleValue(); - _actualDecel = (_lastGroundspeedKts - gs) / dt; - _lastGroundspeedKts = gs; - - if (!_armed || (_step == 0)) { - // even if we're off or disarmed, the physical valve system must pass - // pilot control values through. - _leftBrakeOutput = _leftBrakeInput; - _rightBrakeOutput = _rightBrakeInput; - return; - } - - if (_engaged) { - updateEngaged(dt); - } else { - bool e = shouldEngage(); - if (e) { - engage(); - updateEngaged(dt); - } - } - - // sum pilot inpiuts with auto-brake FCS input - _leftBrakeOutput = SGMiscd::max(_leftBrakeInput, _fcsBrakeControl); - _rightBrakeOutput = SGMiscd::max(_rightBrakeInput, _fcsBrakeControl); - - _lastWoW = _weightOnWheelsNode->getBoolValue(); -} - -void FGAutoBrake::engage() -{ - SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: engaging"); - _engaged = true; -} - -void FGAutoBrake::updateEngaged(double dt) -{ - // check for pilot braking input cancelling engage - const double BRAKE_INPUT_THRESHOLD = 0.02; // 2% application triggers - if ((_leftBrakeInput > BRAKE_INPUT_THRESHOLD) || (_rightBrakeInput > BRAKE_INPUT_THRESHOLD)) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "auto-brake, detected pilot brake input, disengaing"); - disengage(); - return; - } - - if (!throttlesAtIdle()) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "auto-brake, throttles not at idle, disengaing"); - disengage(); - return; - } - - // update the target deceleration; note step can be changed while engaged - if (_rto) { - _targetDecel = _configRTODecel; - } else { - double f = (double) _step / _configNumSteps; - _targetDecel = _configMaxDecel * f; - } -} - -bool FGAutoBrake::shouldEngage() -{ - if (_rto) { - return shouldEngageRTO(); - } - - if (_lastWoW || !_weightOnWheelsNode->getBoolValue()) { - return false; - } - - - if (!throttlesAtIdle()) { - return false; - } - - SG_LOG(SG_AUTOPILOT, SG_INFO, "Autobrake, should enage"); - return true; -} - -bool FGAutoBrake::shouldEngageRTO() -{ - double speed = _groundspeedNode->getDoubleValue(); - - if (_rtoArmed) { - if (speed < _configRTOSpeed) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: RTO armed, but speed is now below arming speed"); - _rtoArmed = false; - return false; - } - - if (!_weightOnWheelsNode->getBoolValue()) { - if (airborne()) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: RTO, airbone, disengaging"); - _rtoArmed = false; - _armed = false; - _step = _configDisengageStep; - } - - return false; - } - - if (throttlesAtIdle()) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: RTO, throttles at idle, will engage"); - return true; - } else { - return false; - } - } else { - // RTO arming case - if (speed > _configRTOSpeed) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "Autobrake RTO: passed " << _configRTOSpeed << " knots, arming RTO mode"); - _rtoArmed = true; - } - } - - return false; -} - -void FGAutoBrake::disengage() -{ - if (!_engaged) { - return; - } - - SG_LOG(SG_AUTOPILOT, SG_INFO, "FGAutoBrake: disengage"); - _engaged = false; - _fcsBrakeControl = 0.0; - _armed = false; - _rtoArmed = false; - _targetDecel = 0.0; - _step = _configDisengageStep; -} - -bool FGAutoBrake::airborne() const -{ - return !_weightOnWheelsNode->getBoolValue(); -} - -bool FGAutoBrake::throttlesAtIdle() const -{ - SGPropertyNode_ptr e; - const double IDLE_THROTTLE = 0.05; // 5% margin for idle setting - - for (int index=0; (e = _engineControlsNode->getChild("engine", index)) != NULL; ++index) { - if ((e->getDoubleValue("throttle") > IDLE_THROTTLE) && !e->getBoolValue("reverser")) { - return false; - } - } // of engines iteration - - return true; -} - -void FGAutoBrake::setArmed(bool aArmed) -{ - if (aArmed == _armed) { - return; - } - - disengage(); - _armed = aArmed; -} - -void FGAutoBrake::setRTO(bool aRTO) -{ - if (aRTO) { - // ensure we meet RTO selection criteria: - if (!_weightOnWheelsNode->getBoolValue()) { - // some systems combine RTO with a standard step, selecting RTO if on - // the ground. Handle that case by setting _rto = false, and letting - // setStep() do the rest of the work as normal. - if ((_configRTOStep > 0) && (_configRTOStep <= _configNumSteps)) { - // RTO is combined with a normal step, select that - } else { - SG_LOG(SG_AUTOPILOT, SG_WARN, "auto-brake: cannot select RTO mode, no weight on wheels"); - } - - _rto = false; - return; - } - - _rtoArmed = false; - _rto = true; - _step = _configRTOStep; - setArmed(true); - SG_LOG(SG_AUTOPILOT, SG_INFO, "RTO mode set"); - } else { - _rto = false; - _rtoArmed = false; - // and if we're enaged? - disengage(); - } -} - -void FGAutoBrake::setStep(int aStep) -{ - if (aStep == _step) { - return; - } - - SG_LOG(SG_AUTOPILOT, SG_INFO, "Autobrake step now=" << aStep); - _step = aStep; - bool validStep = false; - - if (aStep == _configRTOStep) { - setRTO(true); - validStep = true; - } else { - _rto = false; - validStep = (_step > 0) && (_step <= _configNumSteps); - } - - setArmed(validStep); // selecting a valid step arms the system -} - - diff --git a/src/Autopilot/autobrake.hxx b/src/Autopilot/autobrake.hxx deleted file mode 100644 index 2a6845c66..000000000 --- a/src/Autopilot/autobrake.hxx +++ /dev/null @@ -1,108 +0,0 @@ -// autobrake.hxx - generic, configurable autobrake system -// -// Written by James Turner, started September 2009. -// -// Copyright (C) 2009 Curtis L. Olson -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// $Id$ - -#ifndef FG_INSTR_AUTOBRAKE_HXX -#define FG_INSTR_AUTOBRAKE_HXX - -#include -#include - -// forward decls - -class FGAutoBrake : public SGSubsystem -{ -public: - FGAutoBrake(); - virtual ~FGAutoBrake(); - - virtual void init (); - virtual void postinit (); - virtual void bind (); - virtual void unbind (); - virtual void update (double dt); - -private: - - void engage(); - void disengage(); - - void updateEngaged(double dt); - - bool shouldEngage(); - bool shouldEngageRTO(); - - /** - * Helper to determine if all throttles are at idle - * (or have reverse thrust engaged) - */ - bool throttlesAtIdle() const; - - /** - * Helper to determine if we're airbone, i.e weight off all wheels - */ - bool airborne() const; - -// accessors, mostly for SGRawValueMethods use - void setArmed(bool aArmed); - bool getArmed() const { return _armed; } - - void setRTO(bool aRTO); - bool getRTO() const { return _rto; } - - void setStep(int aStep); - int getStep() const { return _step; } - - bool getEngaged() const { return _engaged;} - double getTargetDecel() const { return _targetDecel; } - double getActualDecel() const { return _actualDecel; } - -// members - double _lastGroundspeedKts; - int _step; - bool _rto; // true if in Rejected TakeOff mode - bool _armed; - bool _rtoArmed; ///< true if we have met arming criteria for RTO mode - bool _engaged; ///< true if auto-braking is currently active - double _targetDecel; // target deceleration ft-sec^2 - double _actualDecel; // measured current deceleration in ft-sec^2 - double _fcsBrakeControl; - bool _lastWoW; - double _leftBrakeInput; // summed pilot and co-pilot left brake input - double _rightBrakeInput; // summed pilot and co-pilot right brake input - double _leftBrakeOutput; - double _rightBrakeOutput; - - SGPropertyNode_ptr _root; - SGPropertyNode_ptr _brakeInputs[4]; - SGPropertyNode_ptr _weightOnWheelsNode; - SGPropertyNode_ptr _engineControlsNode; - SGPropertyNode_ptr _groundspeedNode; - - int _configNumSteps; - int _configRTOStep; - int _configDisengageStep; - double _configMaxDecel; ///< deceleration (in ft-sec^2) corresponding to step=numSteps - double _configRTODecel; ///< deceleration (in ft-sec^2) to use in RTO mode - double _configRTOSpeed; ///< speed (in kts) for RTO mode to arm -}; - -#endif // of FG_INSTR_AUTOBRAKE_HXX diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index 15daa8e22..04a2e70bb 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -258,10 +258,6 @@ FGJSBsim::FGJSBsim( double dt ) speedbrake_pos_pct->setDoubleValue(0); spoilers_pos_pct->setDoubleValue(0); - ab_brake_engaged = fgGetNode("/autopilot/autobrake/engaged", true); - ab_brake_left_pct = fgGetNode("/autopilot/autobrake/brake-left-output", true); - ab_brake_right_pct = fgGetNode("/autopilot/autobrake/brake-right-output", true); - temperature = fgGetNode("/environment/temperature-degc",true); pressure = fgGetNode("/environment/pressure-inhg",true); density = fgGetNode("/environment/density-slugft3",true); @@ -548,12 +544,6 @@ bool FGJSBsim::copy_to_JSBsim() double parking_brake = globals->get_controls()->get_brake_parking(); double left_brake = globals->get_controls()->get_brake_left(); double right_brake = globals->get_controls()->get_brake_right(); - - if (ab_brake_engaged->getBoolValue()) { - left_brake = ab_brake_left_pct->getDoubleValue(); - right_brake = ab_brake_right_pct->getDoubleValue(); - } - FCS->SetLBrake(FMAX(left_brake, parking_brake)); FCS->SetRBrake(FMAX(right_brake, parking_brake)); diff --git a/src/FDM/JSBSim/JSBSim.hxx b/src/FDM/JSBSim/JSBSim.hxx index d6f5f1b8c..8eb05feae 100644 --- a/src/FDM/JSBSim/JSBSim.hxx +++ b/src/FDM/JSBSim/JSBSim.hxx @@ -253,10 +253,6 @@ private: SGPropertyNode_ptr flap_pos_pct; SGPropertyNode_ptr speedbrake_pos_pct; SGPropertyNode_ptr spoilers_pos_pct; - - SGPropertyNode_ptr ab_brake_engaged; - SGPropertyNode_ptr ab_brake_left_pct; - SGPropertyNode_ptr ab_brake_right_pct; SGPropertyNode_ptr gear_pos_pct; SGPropertyNode_ptr wing_fold_pos_pct; diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index bddcc69f1..aee06568c 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -84,7 +84,6 @@ #include #include -#include #include #include @@ -1549,7 +1548,6 @@ bool fgInitSubsystems() { globals->add_subsystem( "xml-autopilot", new FGXMLAutopilotGroup ); globals->add_subsystem( "route-manager", new FGRouteMgr ); - globals->add_subsystem( "autobrake", new FGAutoBrake ); //////////////////////////////////////////////////////////////////// // Initialize the view manager subsystem. From 9626805a093fca9e94c5f11298e3c447caaef07d Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sat, 29 May 2010 16:31:05 +0200 Subject: [PATCH 2/7] Fix an uninitialized value valgrind warning. --- src/AIModel/AICarrier.cxx | 19 ++++++++++++------- src/AIModel/AICarrier.hxx | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/AIModel/AICarrier.cxx b/src/AIModel/AICarrier.cxx index ff2a42014..b6487519d 100644 --- a/src/AIModel/AICarrier.cxx +++ b/src/AIModel/AICarrier.cxx @@ -57,6 +57,7 @@ void FGAICarrier::readFromScenario(SGPropertyNode* scFileNode) { setMaxLong(scFileNode->getDoubleValue("max-long", 0)); setMinLong(scFileNode->getDoubleValue("min-long", 0)); setMPControl(scFileNode->getBoolValue("mp-control", false)); + setAIControl(scFileNode->getBoolValue("ai-control", false)); SGPropertyNode* flols = scFileNode->getChild("flols-pos"); if (flols) { @@ -121,6 +122,10 @@ void FGAICarrier::setMPControl(bool c) { MPControl = c; } +void FGAICarrier::setAIControl(bool c) { + AIControl = c; +} + void FGAICarrier::update(double dt) { // Now update the position and heading. This will compute new hdg and // roll values required for the rotation speed computation. @@ -134,8 +139,8 @@ void FGAICarrier::update(double dt) { TurnToLaunch(); } else if(turn_to_recovery_hdg ){ TurnToRecover(); - } else if(OutsideBox() || returning ) {// check that the carrier is inside - ReturnToBox(); // the operating box, + } else if(OutsideBox() || returning ) {// check that the carrier is inside + ReturnToBox(); // the operating box, } else { TurnToBase(); } @@ -168,10 +173,10 @@ void FGAICarrier::update(double dt) { eyeWrtCarrier = ec2body.transform(eyeWrtCarrier); // the eyepoints vector wrt the flols position SGVec3d eyeWrtFlols = eyeWrtCarrier - flols_off; - + // the distance from the eyepoint to the flols dist = norm(eyeWrtFlols); - + // now the angle, positive angles are upwards if (fabs(dist) < SGLimits::min()) { angle = 0; @@ -180,7 +185,7 @@ void FGAICarrier::update(double dt) { sAngle = SGMiscd::min(1, SGMiscd::max(-1, sAngle)); angle = SGMiscd::rad2deg(asin(sAngle)); } - + // set the value of source if ( angle <= 4.35 && angle > 4.01 ) source = 1; @@ -436,12 +441,12 @@ void FGAICarrier::TurnToRecover(){ if (wind_speed_kts < 3){ tgt_heading = base_course + 60; } else if (rel_wind < -9 && rel_wind >= -180){ - tgt_heading = wind_from_deg; + tgt_heading = wind_from_deg; } else if (rel_wind > -7 && rel_wind < 45){ tgt_heading = wind_from_deg + 60; } else if (rel_wind >=45 && rel_wind < 180){ tgt_heading = wind_from_deg + 45; - } else + } else tgt_heading = hdg; SG_NORMALIZE_RANGE(tgt_heading, 0.0, 360.0); diff --git a/src/AIModel/AICarrier.hxx b/src/AIModel/AICarrier.hxx index 9df40db41..da3380502 100644 --- a/src/AIModel/AICarrier.hxx +++ b/src/AIModel/AICarrier.hxx @@ -58,6 +58,7 @@ public: void setMaxLong( double deg ); void setMinLong( double deg ); void setMPControl( bool c ); + void setAIControl( bool c ); void TurnToLaunch(); void TurnToRecover(); void TurnToBase(); From a565e90c4f56988e143a73044be0be442b8e3f27 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sat, 29 May 2010 16:31:58 +0200 Subject: [PATCH 3/7] Fix an uninitialized value valgrind warning. --- src/AIModel/AIShip.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AIModel/AIShip.cxx b/src/AIModel/AIShip.cxx index b0e0eb65f..41f09550e 100644 --- a/src/AIModel/AIShip.cxx +++ b/src/AIModel/AIShip.cxx @@ -52,6 +52,7 @@ _next_run(0), _lead_angle(0), _xtrack_error(0), _tunnel(false), +_initial_tunnel(false), _curr_alt(0), _prev_alt(0), _until_time(""), From 1114c49165125deefadf25b5c448e246cec74a45 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sat, 29 May 2010 16:32:38 +0200 Subject: [PATCH 4/7] Fix an uninitialized value valgrind warning. --- src/Input/FGMouseInput.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Input/FGMouseInput.cxx b/src/Input/FGMouseInput.cxx index c0b7e3f87..16bb7883e 100644 --- a/src/Input/FGMouseInput.cxx +++ b/src/Input/FGMouseInput.cxx @@ -25,7 +25,7 @@ #include "FGMouseInput.hxx" -void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea ) +void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea ) { // Get the list of hit callbacks. Take the first callback that // accepts the mouse button press and ignore the rest of them @@ -44,7 +44,7 @@ void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea ) } } -void ActivePickCallbacks::update( double dt ) +void ActivePickCallbacks::update( double dt ) { // handle repeatable mouse press events for( iterator mi = begin(); mi != end(); ++mi ) { @@ -202,6 +202,7 @@ FGMouseInput::mouse::mouse () save_y(-1), nModes(1), current_mode(0), + timeout(0), modes(NULL) { } From 721566a6e71c6121b01508997c880da2ef29c66a Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sat, 29 May 2010 17:17:49 +0200 Subject: [PATCH 5/7] Fix some more unitialized value warnings. --- src/ATCDCL/ATC.hxx | 2 ++ src/ATCDCL/atis.cxx | 3 +-- src/Instrumentation/gps.cxx | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ATCDCL/ATC.hxx b/src/ATCDCL/ATC.hxx index e2751460e..2b8a0a933 100644 --- a/src/ATCDCL/ATC.hxx +++ b/src/ATCDCL/ATC.hxx @@ -65,6 +65,8 @@ enum plane_type { // PlaneRec - a structure holding ATC-centric details of planes under control // This might move or change eventually struct PlaneRec { + PlaneRec() : type(UNKNOWN), squawkcode(0) {} + PlaneRec(const std::string& s) : type(UNKNOWN), callsign(s), squawkcode(0) {} plane_type type; std::string callsign; int squawkcode; diff --git a/src/ATCDCL/atis.cxx b/src/ATCDCL/atis.cxx index 67c108f4b..0747903de 100644 --- a/src/ATCDCL/atis.cxx +++ b/src/ATCDCL/atis.cxx @@ -63,10 +63,9 @@ using boost::ref; using boost::tie; FGATIS::FGATIS() : - transmission(""), - trans_ident(""), old_volume(0), atis_failed(false), + msg_OK(0), attention(0), _prev_display(0), refname("atis") diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 1ddb87e08..4b522dfce 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -219,6 +219,7 @@ GPS::GPS ( SGPropertyNode *node) : _mode("init"), _name(node->getStringValue("name", "gps")), _num(node->getIntValue("number", 0)), + _searchResultsCached(false), _computeTurnData(false), _anticipateTurn(false), _inTurn(false) From 917524160ba7f572917be8658f5750a297db5c61 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sat, 29 May 2010 17:25:02 +0200 Subject: [PATCH 6/7] Fix some uninitialized value warnings. --- src/ATCDCL/ATC.hxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ATCDCL/ATC.hxx b/src/ATCDCL/ATC.hxx index 2b8a0a933..e5ddcd0a9 100644 --- a/src/ATCDCL/ATC.hxx +++ b/src/ATCDCL/ATC.hxx @@ -89,6 +89,7 @@ const int ATC_NUM_TYPES = 1 + INVALID; // DCL - new experimental ATC data store struct ATCData { + ATCData() : type(INVALID), cart(0, 0, 0), freq(0), range(0) {} atc_type type; SGGeod geod; SGVec3d cart; @@ -101,6 +102,7 @@ struct ATCData { // perhaps we could use an FGRunway instead of this. // That wouldn't cache the orthopos though. struct RunwayDetails { + RunwayDetails() : end1ortho(0, 0, 0), end2ortho(0, 0, 0), hdg(0), length(-1), width(-1) {} SGGeod threshold_pos; SGVec3d end1ortho; // ortho projection end1 (the threshold ATM) SGVec3d end2ortho; // ortho projection end2 (the take off end in the current hardwired scheme) From 473cea7f1724c27d895aa136d41727ddcf7d2fb2 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 31 May 2010 07:06:55 +0200 Subject: [PATCH 7/7] remove references to osgGA::MatrixManipulator This class has been removed in current OSG sources. --- src/Main/fgviewer.cxx | 17 ++++++++--------- utils/fgviewer/fgviewer.cxx | 16 ++++++++-------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Main/fgviewer.cxx b/src/Main/fgviewer.cxx index b1a399e19..428bc2c32 100644 --- a/src/Main/fgviewer.cxx +++ b/src/Main/fgviewer.cxx @@ -149,15 +149,14 @@ fgviewerMain(int argc, char** argv) osgGA::KeySwitchMatrixManipulator* keyswitchManipulator; keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; - osgGA::MatrixManipulator* mm = new osgGA::TrackballManipulator; - keyswitchManipulator->addMatrixManipulator('1', "Trackball", mm); - mm = new osgGA::FlightManipulator; - keyswitchManipulator->addMatrixManipulator('2', "Flight", mm); - mm = new osgGA::DriveManipulator; - keyswitchManipulator->addMatrixManipulator('3', "Drive", mm); - mm = new osgGA::TerrainManipulator; - keyswitchManipulator->addMatrixManipulator('4', "Terrain", mm); - + keyswitchManipulator->addMatrixManipulator('1', "Trackball", + new osgGA::TrackballManipulator); + keyswitchManipulator->addMatrixManipulator('2', "Flight", + new osgGA::FlightManipulator); + keyswitchManipulator->addMatrixManipulator('3', "Drive", + new osgGA::DriveManipulator); + keyswitchManipulator->addMatrixManipulator('4', "Terrain", + new osgGA::TerrainManipulator); viewer.setCameraManipulator(keyswitchManipulator); // Usefull stats diff --git a/utils/fgviewer/fgviewer.cxx b/utils/fgviewer/fgviewer.cxx index e59a91645..c7a659994 100644 --- a/utils/fgviewer/fgviewer.cxx +++ b/utils/fgviewer/fgviewer.cxx @@ -58,14 +58,14 @@ main(int argc, char** argv) osgGA::KeySwitchMatrixManipulator* keyswitchManipulator; keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; - osgGA::MatrixManipulator* mm = new osgGA::TrackballManipulator; - keyswitchManipulator->addMatrixManipulator('1', "Trackball", mm); - mm = new osgGA::FlightManipulator; - keyswitchManipulator->addMatrixManipulator('2', "Flight", mm); - mm = new osgGA::DriveManipulator; - keyswitchManipulator->addMatrixManipulator('3', "Drive", mm); - mm = new osgGA::TerrainManipulator; - keyswitchManipulator->addMatrixManipulator('4', "Terrain", mm); + keyswitchManipulator->addMatrixManipulator('1', "Trackball", + new osgGA::TrackballManipulator); + keyswitchManipulator->addMatrixManipulator('2', "Flight", + new osgGA::FlightManipulator); + keyswitchManipulator->addMatrixManipulator('3', "Drive", + new osgGA::DriveManipulator); + keyswitchManipulator->addMatrixManipulator('4', "Terrain", + new osgGA::TerrainManipulator); viewer.setCameraManipulator(keyswitchManipulator);