1
0
Fork 0

Improve Generic Instrumentation Implementation

* base heading_indicator_dg, heading_indicator_fg and turn_indicator 
  on AbstractInstrument
* make AbstractInstrument use different electric power paths for 
  multiple instances of one instrument
* create electric attitude indicator (based on AbstractInstrument)
* update README
This commit is contained in:
Benedikt Wolf 2023-04-04 12:28:29 +02:00 committed by James Turner
parent afe7eb15c0
commit 5a08bcf796
60 changed files with 829 additions and 709 deletions

View file

@ -27,7 +27,7 @@ void AbstractInstrument::readConfig(SGPropertyNode* config,
_name = config->getStringValue("name", defaultName.c_str());
_index = config->getIntValue("number", 0);
if (_powerSupplyPath.empty()) {
_powerSupplyPath = "/systems/electrical/outputs/" + defaultName;
_powerSupplyPath = "/systems/electrical/outputs/" + defaultName + "[" + std::to_string(_index) + "]";
}
if (config->hasChild("power-supply")) {

View file

@ -1,21 +1,27 @@
// Copyright (C) 2019 James Turner <james@flightgear.org>
//
// 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.
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2019 (C) James Turner <james@flightgear.org>
*
* AbstractInstrument.hxx
*
* Copyright (C) 2019 James Turner <james@flightgear.org>
*
* 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.
*/
#ifndef FG_ABSTRACT_INSTRUMENT_HXX
#define FG_ABSTRACT_INSTRUMENT_HXX
#pragma once
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
@ -60,5 +66,3 @@ private:
double _minimumSupplyVolts;
SGPropertyNode_ptr _powerSupplyNode;
};
#endif // of FG_ABSTRACT_INSTRUMENT_HXX

View file

@ -6,6 +6,7 @@ set(SOURCES
airspeed_indicator.cxx
altimeter.cxx
attitude_indicator.cxx
attitude_indicator_electric.cxx
clock.cxx
dclgps.cxx
dme.cxx
@ -68,6 +69,7 @@ set(HEADERS
airspeed_indicator.hxx
altimeter.hxx
attitude_indicator.hxx
attitude_indicator_electric.hxx
clock.hxx
dclgps.hxx
dme.hxx

View file

@ -3,12 +3,15 @@ src/Instrumentation/ - gauge and avionics support code
This directory contains code to support gauges, avionics, and other
instruments in FlightGear. The file instrument_mgr.[ch]xx contains a
subsystem group that holds all of the individual instruments. Every
instrument should extend FGSubsystem, and then should be added to the
group in the FGInstrumentMgr constructor.
instrument should extend FGSubsystem (directly or via AbstractInstrument),
and then should be added to the group in the FGInstrumentMgr constructor.
Code is gradually moving into here from other areas, especially the
src/Cockpit/ directory. Eventually, there will be an XML
configuration file to select what instrumentation modules should be
available, so that different aircraft can have appropriate support.
src/Cockpit/ directory.
Aircraft can select which instrumentation modules should be available
using an XML configuration file loaded as
<sim><instrumentation><path>.
An example of such a configuration file can be found in FGData at
Aircraft/Generic/generic-instrumentation.xml

View file

@ -84,7 +84,7 @@ void
ADF::init ()
{
string branch = nodePath();
SGPropertyNode *node = fgGetNode(branch.c_str(), true );
SGPropertyNode *node = fgGetNode(branch, true );
initServicePowerProperties(node);

View file

@ -1,11 +1,14 @@
// adf.hxx - automatic direction finder.
// Written by David Megginson, started 2003.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* adf.hxx - automatic direction finder.
* Written by David Megginson, started 2003.
* Last modified by Eric van den Berg, 24 Nov 2012
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_ADF_HXX
#define __INSTRUMENTS_ADF_HXX 1
#pragma once
#include <string>
@ -82,5 +85,3 @@ private:
SGSharedPtr<SGSampleGroup> _sgr;
};
#endif // __INSTRUMENTS_ADF_HXX

View file

@ -50,10 +50,10 @@ AirspeedIndicator::init ()
std::string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_total_pressure_node = fgGetNode(_total_pressure.c_str(), true);
_static_pressure_node = fgGetNode(_static_pressure.c_str(), true);
_total_pressure_node = fgGetNode(_total_pressure, true);
_static_pressure_node = fgGetNode(_static_pressure, true);
_density_node = fgGetNode("/environment/density-slugft3", true);
_speed_node = node->getChild("indicated-speed-kt", 0, true);
_tas_node = node->getChild("true-speed-kt", 0, true);
@ -78,7 +78,7 @@ AirspeedIndicator::init ()
}
_airspeed_limit = node->getChild("airspeed-limit-kt", 0, true);
_pressure_alt = fgGetNode(_pressure_alt_source.c_str(), true);
_pressure_alt = fgGetNode(_pressure_alt_source, true);
}
_environmentManager = globals->get_subsystem<FGEnvironmentMgr>();

View file

@ -1,12 +1,14 @@
// airspeed_indicator.hxx - a regular VSI tied to the static port.
// Written by David Megginson, started 2002.
//
// Last modified by Eric van den Berg, 24 Nov 2012
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* airspeed_indicator.hxx - a regular ASI tied to the static port.
* Written by David Megginson, started 2002.
* Last modified by Eric van den Berg, 24 Nov 2012
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_AIRSPEED_INDICATOR_HXX
#define __INSTRUMENTS_AIRSPEED_INDICATOR_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
@ -76,5 +78,3 @@ private:
FGEnvironmentMgr* _environmentManager;
};
#endif // __INSTRUMENTS_AIRSPEED_INDICATOR_HXX

View file

@ -77,7 +77,7 @@ Altimeter::setSettingHPa( double value )
void
Altimeter::init ()
{
_pressure_node = fgGetNode(_static_pressure.c_str(), true);
_pressure_node = fgGetNode(_static_pressure, true);
_serviceable_node = _rootNode->getChild("serviceable", 0, true);
_press_alt_node = _rootNode->getChild("pressure-alt-ft", 0, true);
if (_encodeModeC) {

View file

@ -1,12 +1,14 @@
// altimeter.hxx - an altimeter tied to the static port.
// Written by David Megginson, started 2002.
// Updated by John Denker to match changes in altimeter.cxx in 2007
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* altimeter.hxx - an altimeter tied to the static port.
* Written by David Megginson, started 2002.
* Updated by John Denker to match changes in altimeter.cxx in 2007
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_ALTIMETER_HXX
#define __INSTRUMENTS_ALTIMETER_HXX 1
#pragma once
#include <simgear/props/props.hxx>
#include <simgear/props/tiedpropertylist.hxx>
@ -73,5 +75,3 @@ private:
simgear::TiedPropertyList _tiedProperties;
};
#endif // __INSTRUMENTS_ALTIMETER_HXX

View file

@ -45,12 +45,12 @@ AttitudeIndicator::init ()
string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
SGPropertyNode *n;
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
_suction_node = fgGetNode(_suction.c_str(), true);
_suction_node = fgGetNode(_suction, true);
SGPropertyNode *cnode = node->getChild("config", 0, true);
_tumble_flag_node = cnode->getChild("tumble-flag", 0, true);
_caged_node = node->getChild("caged-flag", 0, true);

View file

@ -1,11 +1,12 @@
// attitude_indicator.hxx - a vacuum-powered attitude indicator.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
#ifndef __INSTRUMENTS_ATTITUDE_INDICATOR_HXX
#define __INSTRUMENTS_ATTITUDE_INDICATOR_HXX 1
/*
* SPDX-License-Identifier: CC0-1.0
*
* attitude_indicator.hxx - a vacuum-powered attitude indicator.
* Written by David Megginson, started 2002.
*
* This file is in the Public Domain and comes with no warranty.
*/
#pragma once
#ifndef __cplusplus
# error This library requires C++
@ -74,5 +75,3 @@ private:
double max_roll_error;
double max_pitch_error;
};
#endif // __INSTRUMENTS_ATTITUDE_INDICATOR_HXX

View file

@ -0,0 +1,160 @@
// attitude_indicator_electric.hxx - an electrically-powered attitude indicator.
// Written by David Megginson, started 2002.
// Ported to Electric by Benedikt Wolf 2023
//
// This file is in the Public Domain and comes with no warranty.
// TODO:
// - better spin-up
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <simgear/compiler.h>
#include <iostream>
#include <string>
#include <sstream>
#include <cmath> // fabs()
#include "attitude_indicator_electric.hxx"
#include <Main/fg_props.hxx>
#include <Main/util.hxx>
using std::string;
AttitudeIndicatorElectric::AttitudeIndicatorElectric ( SGPropertyNode *node )
:
spin_thresh(0.8),
max_roll_error(40.0),
max_pitch_error(12.0)
{
readConfig(node, "attitude-indicator-electric");
}
AttitudeIndicatorElectric::~AttitudeIndicatorElectric ()
{
}
void
AttitudeIndicatorElectric::init ()
{
string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch, _num, true );
SGPropertyNode *n;
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
SGPropertyNode *cnode = node->getChild("config", 0, true);
_tumble_flag_node = cnode->getChild("tumble-flag", 0, true);
_caged_node = node->getChild("caged-flag", 0, true);
_tumble_node = node->getChild("tumble-norm", 0, true);
if( ( n = cnode->getChild("spin-thresh", 0, false ) ) != NULL )
spin_thresh = n->getDoubleValue();
if( ( n = cnode->getChild("max-roll-error-deg", 0, false ) ) != NULL )
max_roll_error = n->getDoubleValue();
if( ( n = cnode->getChild("max-pitch-error-deg", 0, false ) ) != NULL )
max_pitch_error = n->getDoubleValue();
_pitch_int_node = node->getChild("internal-pitch-deg", 0, true);
_roll_int_node = node->getChild("internal-roll-deg", 0, true);
_pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
_roll_out_node = node->getChild("indicated-roll-deg", 0, true);
_off_node = node->getChild("off-flag", 0, true);
initServicePowerProperties(node);
reinit();
}
void
AttitudeIndicatorElectric::reinit ()
{
_roll_int_node->setDoubleValue(0.0);
_pitch_int_node->setDoubleValue(0.0);
_gyro.reinit();
}
void
AttitudeIndicatorElectric::update (double dt)
{
// If it's caged, it doesn't indicate
if (_caged_node->getBoolValue()) {
_roll_int_node->setDoubleValue(0.0);
_pitch_int_node->setDoubleValue(0.0);
return;
}
// Get the spin from the gyro
_gyro.set_power_norm(isServiceableAndPowered());
_gyro.update(dt);
double spin = _gyro.get_spin_norm();
_off_node->setBoolValue( ( isServiceableAndPowered() && spin >= 0.25) );
// Calculate the responsiveness
double responsiveness = spin * spin * spin * spin * spin * spin;
// Get the indicated roll and pitch
double roll = _roll_in_node->getDoubleValue();
double pitch = _pitch_in_node->getDoubleValue();
// Calculate the tumble for the
// next pass.
if (_tumble_flag_node->getBoolValue()) {
double tumble = _tumble_node->getDoubleValue();
if (fabs(roll) > 45.0) {
double target = (fabs(roll) - 45.0) / 45.0;
target *= target; // exponential past +-45 degrees
if (roll < 0)
target = -target;
if (fabs(target) > fabs(tumble))
tumble = target;
if (tumble > 1.0)
tumble = 1.0;
else if (tumble < -1.0)
tumble = -1.0;
}
// Reerect in 5 minutes
double step = dt/300.0;
if (tumble < -step)
tumble += step;
else if (tumble > step)
tumble -= step;
roll += tumble * 45;
_tumble_node->setDoubleValue(tumble);
}
roll = fgGetLowPass(_roll_int_node->getDoubleValue(), roll,
responsiveness);
pitch = fgGetLowPass(_pitch_int_node->getDoubleValue(), pitch,
responsiveness);
// Assign the new values
_roll_int_node->setDoubleValue(roll);
_pitch_int_node->setDoubleValue(pitch);
// add in a gyro underspin "error" if gyro is spinning too slowly
double roll_error;
double pitch_error;
if ( spin <= spin_thresh ) {
double roll_error_factor = (spin_thresh - spin) / spin_thresh;
double pitch_error_factor = (spin_thresh - spin) / spin_thresh;
roll_error = roll_error_factor * roll_error_factor * max_roll_error;
pitch_error = pitch_error_factor * pitch_error_factor * max_pitch_error;
} else {
roll_error = 0.0;
pitch_error = 0.0;
}
_roll_out_node->setDoubleValue(roll + roll_error);
_pitch_out_node->setDoubleValue(pitch + pitch_error);
}
// end of attitude_indicator_electric.cxx

View file

@ -0,0 +1,77 @@
/*
* SPDX-License-Identifier: CC0-1.0
*
*
* Written by David Megginson, started 2002.
*
* Last Edited by Benedikt Wolf 2023 - ported to electrically-powered
*
* This file is in the Public Domain and comes with no warranty.
*/
#pragma once
#ifndef __cplusplus
# error This library requires C++
#endif
#include <Instrumentation/AbstractInstrument.hxx>
#include "gyro.hxx"
/**
* Model an electrically-powered attitude indicator.
*
* Input properties:
*
* /instrumentation/"name"/config/tumble-flag
* /instrumentation/"name"/serviceable
* /instrumentation/"name"/caged-flag
* /instrumentation/"name"/tumble-norm
* /orientation/pitch-deg
* /orientation/roll-deg
* /systems/electrical/outputs/attitude-indicator-electric
*
* Output properties:
*
* /instrumentation/"name"/indicated-pitch-deg
* /instrumentation/"name"/indicated-roll-deg
* /instrumentation/"name"/tumble-norm
* /instrumentation/"name"/off-flag
*/
class AttitudeIndicatorElectric : public AbstractInstrument
{
public:
AttitudeIndicatorElectric ( SGPropertyNode *node );
virtual ~AttitudeIndicatorElectric ();
// Subsystem API.
void init() override;
void reinit() override;
void update(double dt) override;
// Subsystem identification.
static const char* staticSubsystemClassId() { return "attitude-indicator-electric"; }
private:
std::string _name;
int _num = 0;
Gyro _gyro;
SGPropertyNode_ptr _tumble_flag_node;
SGPropertyNode_ptr _caged_node;
SGPropertyNode_ptr _tumble_node;
SGPropertyNode_ptr _pitch_in_node;
SGPropertyNode_ptr _roll_in_node;
SGPropertyNode_ptr _pitch_int_node;
SGPropertyNode_ptr _roll_int_node;
SGPropertyNode_ptr _pitch_out_node;
SGPropertyNode_ptr _roll_out_node;
SGPropertyNode_ptr _off_node;
double spin_thresh;
double max_roll_error;
double max_pitch_error;
};

View file

@ -42,7 +42,7 @@ Clock::init ()
std::string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_offset_node = node->getChild("offset-sec", 0, true);
_sec_node = node->getChild("indicated-sec", 0, true);

View file

@ -1,13 +1,15 @@
// clock.hxx.
// Written by Melchior FRANZ, started 2003.
//
// This file is in the Public Domain and comes with no warranty.
//
// $Id$
/*
* SPDX-License-Identifier: CC0-1.0
*
* clock.hxx.
* Written by Melchior FRANZ, started 2003.
*
* This file is in the Public Domain and comes with no warranty.
*
* $Id$
*/
#ifndef __INSTRUMENTS_CLOCK_HXX
#define __INSTRUMENTS_CLOCK_HXX 1
#pragma once
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
@ -65,5 +67,3 @@ private:
SGPropertyNode_ptr _string_node1;
SGPropertyNode_ptr _string_node2;
};
#endif // __INSTRUMENTS_CLOCK_HXX

View file

@ -1,27 +1,31 @@
// commradio.hxx -- class to manage a nav radio instance
//
// Written by Torsten Dreyer, started February 2014
//
// Copyright (C) Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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.
//
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: (C) Curtis L. Olson - http://www.flightgear.org/~curt
*
* commradio.hxx -- class to manage a nav radio instance
*
* Written by Torsten Dreyer, started February 2014
*
* Copyright (C) Curtis L. Olson - http://www.flightgear.org/~curt
*
* 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_INSTRUMENTATION_COMMRADIO_HXX
#define _FG_INSTRUMENTATION_COMMRADIO_HXX
#pragma once
#include <simgear/props/props.hxx>
#include <Instrumentation/AbstractInstrument.hxx>
@ -48,4 +52,3 @@ public:
}
#endif // _FG_INSTRUMENTATION_COMMRADIO_HXX

View file

@ -1,30 +1,34 @@
// dclgps.hxx - a class to extend the operation of FG's current GPS
// code, and provide support for a KLN89-specific instrument. It
// is envisioned that eventually this file and class will be split
// up between current FG code and new KLN89-specific code and removed.
//
// Written by David Luff, started 2005.
//
// Copyright (C) 2005 - David C Luff: daveluff --AT-- ntlworld --D0T-- com
//
// 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$
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2005 (C) David C Luff: daveluff --AT-- ntlworld --D0T-- com
*
* dclgps.hxx - a class to extend the operation of FG's current GPS
* code, and provide support for a KLN89-specific instrument. It
* is envisioned that eventually this file and class will be split
* up between current FG code and new KLN89-specific code and removed
*
* Written by David Luff, started 2005.
*
* Copyright (C) 2005 - David C Luff: daveluff --AT-- ntlworld --D0T-- com
*
* 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 _DCLGPS_HXX
#define _DCLGPS_HXX
#pragma once
#include <Cockpit/render_area_2d.hxx>
@ -496,5 +500,3 @@ protected:
private:
simgear::TiedPropertyList _tiedProperties;
};
#endif // _DCLGPS_HXX

View file

@ -150,7 +150,7 @@ DME::update (double delta_time_sec)
if (source.empty()) {
std::string branch;
branch = "/instrumentation/" + name() + "/frequencies/selected-mhz";
_source_node->setStringValue(branch.c_str());
_source_node->setStringValue(branch);
source = _source_node->getStringValue();
}
// Get the frequency

View file

@ -1,11 +1,13 @@
// dme.hxx - distance-measuring equipment.
// Written by David Megginson, started 2003.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* dme.hxx - distance-measuring equipment.
* Written by David Megginson, started 2003.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_DME_HXX
#define __INSTRUMENTS_DME_HXX 1
#pragma once
#include <Instrumentation/AbstractInstrument.hxx>
@ -71,5 +73,3 @@ private:
class AudioIdent * _audioIdent;
};
#endif // __INSTRUMENTS_DME_HXX

View file

@ -1,5 +1,4 @@
#ifndef __FREQUENCY_FORMATTER_HXX
#define __FREQUENCY_FORMATTER_HXX
#pragma once
/* ------------- A NAV/COMM Frequency formatter ---------------------- */
class FrequencyFormatterBase : public SGReferenced {
@ -57,6 +56,3 @@ private:
double _min;
double _max;
};
#endif //__FREQUENCY_FORMATTER_HXX

View file

@ -118,7 +118,7 @@ GPS::GPS ( SGPropertyNode *node, bool defaultGPSMode) :
fgGetNode("/autopilot/route-manager/active", true)))
{
string branch = "/instrumentation/" + _name;
_gpsNode = fgGetNode(branch.c_str(), _num, true );
_gpsNode = fgGetNode(branch, _num, true );
_scratchNode = _gpsNode->getChild("scratch", 0, true);
SGPropertyNode *wp_node = _gpsNode->getChild("wp", 0, true);

View file

@ -1,11 +1,13 @@
// gps.hxx - distance-measuring equipment.
// Written by David Megginson, started 2003.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* gps.hxx - distance-measuring equipment.
* Written by David Megginson, started 2003.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_GPS_HXX
#define __INSTRUMENTS_GPS_HXX 1
#pragma once
#include <cassert>
#include <memory>
@ -435,5 +437,3 @@ private:
SGPropertyChangeCallback<GPS> _callbackFlightPlanChanged;
SGPropertyChangeCallback<GPS> _callbackRouteActivated;
};
#endif // __INSTRUMENTS_GPS_HXX

View file

@ -51,7 +51,7 @@ void GSDI::init()
{
std::string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *n = fgGetNode(branch.c_str(), _num, true);
SGPropertyNode *n = fgGetNode(branch, _num, true);
_serviceableN = n->getNode("serviceable", true);
// input

View file

@ -1,24 +1,28 @@
// gsdi.cxx - Ground Speed Drift Angle Indicator (known as GSDI or GSDA)
// Written by Melchior FRANZ, started 2006.
//
// Copyright (C) 2006 Melchior FRANZ - mfranz#aon:at
//
// 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.
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2006 (C) Melchior FRANZ - mfranz#aon:at
*
* gsdi.cxx - Ground Speed Drift Angle Indicator (known as GSDI or GSDA)
* Written by Melchior FRANZ, started 2006.
*
* Copyright (C) 2006 Melchior FRANZ - mfranz#aon:at
*
* 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.
*/
#ifndef __INSTRUMENTS_GSDI_HXX
#define __INSTRUMENTS_GSDI_HXX 1
#pragma once
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
@ -69,5 +73,3 @@ private:
SGPropertyNode_ptr _drift_speedN;
SGPropertyNode_ptr _drift_angleN;
};
#endif // _INSTRUMENTS_GSDI_HXX

View file

@ -1,7 +1,6 @@
// gyro.hxx - simple model of a spinning gyro.
#ifndef __INSTRUMENTATION_GYRO_HXX
#define __INSTRUMENTATION_GYRO_HXX 1
#pragma once
/**
* Simple model of a spinning gyro.
@ -87,5 +86,3 @@ private:
double _spin_norm;
};
#endif // __INSTRUMENTATION_GYRO_HXX

View file

@ -36,13 +36,13 @@ HeadingIndicator::init ()
std::string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
if( NULL == (_offset_node = node->getChild("offset-deg", 0, false)) ) {
_offset_node = node->getChild("offset-deg", 0, true);
_offset_node->setDoubleValue( -fgGetDouble("/environment/magnetic-variation-deg") );
}
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
_suction_node = fgGetNode(_suction.c_str(), true);
_suction_node = fgGetNode(_suction, true);
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_heading_bug_error_node = node->getChild("heading-bug-error-deg", 0, true);
_heading_bug_node = node->getChild("heading-bug-deg", 0, true);

View file

@ -1,11 +1,13 @@
// heading_indicator.hxx - a vacuum-powered heading indicator.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* heading_indicator.hxx - a vacuum-powered heading indicator.
* Written by David Megginson, started 2002.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_HEADING_INDICATOR_HXX
#define __INSTRUMENTS_HEADING_INDICATOR_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
@ -64,5 +66,3 @@ private:
SGPropertyNode_ptr _heading_bug_error_node;
SGPropertyNode_ptr _heading_bug_node;
};
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX

View file

@ -26,25 +26,11 @@
#define POW6(x) (x*x*x*x*x*x)
HeadingIndicatorDG::HeadingIndicatorDG ( SGPropertyNode *node ) :
name("heading-indicator-dg"),
num(0)
_last_heading_deg(0),
_last_indicated_heading_dg(0)
{
int i;
for ( i = 0; i < node->nChildren(); ++i ) {
SGPropertyNode *child = node->getChild(i);
std::string cname = child->getNameString();
std::string cval = child->getStringValue();
if ( cname == "name" ) {
name = cval;
} else if ( cname == "number" ) {
num = child->getIntValue();
} else {
SG_LOG( SG_INSTR, SG_WARN, "Error in DG heading-indicator config logic" );
if ( name.length() ) {
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
}
}
}
_powerSupplyPath = "/systems/electrical/outputs/DG[" + std::to_string( node->getIntValue("number", 0) ) + "]";
readConfig(node, "heading-indicator-dg");
}
HeadingIndicatorDG::~HeadingIndicatorDG ()
@ -54,53 +40,25 @@ HeadingIndicatorDG::~HeadingIndicatorDG ()
void
HeadingIndicatorDG::init ()
{
std::string branch;
branch = "/instrumentation/" + name;
string branch = nodePath();
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
_yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true);
_g_node = fgGetNode("/accelerations/pilot-g", true);
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
SGPropertyNode *node = fgGetNode(branch, true );
_offset_node = node->getChild("offset-deg", 0, true);
_serviceable_node = node->getChild("serviceable", 0, true);
_heading_bug_error_node = node->getChild("heading-bug-error-deg", 0, true);
_error_node = node->getChild("error-deg", 0, true);
_nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_align_node = node->getChild("align-deg", 0, true);
_electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
initServicePowerProperties(node);
reinit();
}
void
HeadingIndicatorDG::bind ()
{
std::ostringstream temp;
std::string branch;
temp << num;
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
fgTie((branch + "/spin").c_str(),
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
}
void
HeadingIndicatorDG::unbind ()
{
std::ostringstream temp;
std::string branch;
temp << num;
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/spin").c_str());
}
void
HeadingIndicatorDG::reinit (void)
{
@ -119,7 +77,7 @@ void
HeadingIndicatorDG::update (double dt)
{
// Get the spin from the gyro
_gyro.set_power_norm(_electrical_node->getDoubleValue());
_gyro.set_power_norm(isServiceableAndPowered());
_gyro.update(dt);
@ -204,12 +162,4 @@ HeadingIndicatorDG::update (double dt)
}
}
// Register the subsystem.
#if 0
SGSubsystemMgr::InstancedRegistrant<HeadingIndicatorDG> registrantHeadingIndicatorDG(
SGSubsystemMgr::FDM,
{{"instrumentation", SGSubsystemMgr::Dependency::HARD}});
#endif
// end of heading_indicator_dg.cxx

View file

@ -1,15 +1,17 @@
// heading_indicator.hxx - a vacuum-powered heading indicator.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* heading_indicator_dg.hxx - an electrically-powered heading indicator
* Written by David Megginson, started 2002.
*
* This file is in the Public Domain and comes with no warranty.
*/
#pragma once
#ifndef __INSTRUMENTS_HEADING_INDICATOR_ELEC_HXX
#define __INSTRUMENTS_HEADING_INDICATOR_ELEC_HXX 1
#include <Instrumentation/AbstractInstrument.hxx>
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/math/sg_random.hxx>
#include "gyro.hxx"
@ -30,7 +32,7 @@
*
* /instrumentation/"name"/indicated-heading-deg
*/
class HeadingIndicatorDG : public SGSubsystem
class HeadingIndicatorDG : public AbstractInstrument
{
public:
HeadingIndicatorDG ( SGPropertyNode *node );
@ -38,10 +40,8 @@ public:
virtual ~HeadingIndicatorDG ();
// Subsystem API.
void bind() override;
void init() override;
void reinit() override;
void unbind() override;
void update(double dt) override;
// Subsystem identification.
@ -51,8 +51,7 @@ private:
Gyro _gyro;
double _last_heading_deg, _last_indicated_heading_dg;
std::string name;
int num;
std::string _powerSupplyPath;
SGPropertyNode_ptr _offset_node;
SGPropertyNode_ptr _heading_in_node;
@ -66,5 +65,3 @@ private:
SGPropertyNode_ptr _heading_bug_error_node;
SGPropertyNode_ptr _g_node;
};
#endif // __INSTRUMENTS_HEADING_INDICATOR_ELEC_HXX

View file

@ -25,25 +25,9 @@ using std::string;
HeadingIndicatorFG::HeadingIndicatorFG ( SGPropertyNode *node )
:
name("heading-indicator-fg"),
num(0)
_last_heading_deg(0)
{
int i;
for ( i = 0; i < node->nChildren(); ++i ) {
SGPropertyNode *child = node->getChild(i);
string cname = child->getNameString();
string cval = child->getStringValue();
if ( cname == "name" ) {
name = cval;
} else if ( cname == "number" ) {
num = child->getIntValue();
} else {
SG_LOG( SG_INSTR, SG_WARN, "Error in flux-gate heading-indicator config logic" );
if ( name.length() ) {
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
}
}
}
readConfig(node, "heading-indicator-fg");
}
HeadingIndicatorFG::HeadingIndicatorFG ()
@ -57,23 +41,21 @@ HeadingIndicatorFG::~HeadingIndicatorFG ()
void
HeadingIndicatorFG::init ()
{
string branch;
branch = "/instrumentation/" + name;
string branch = nodePath();
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
SGPropertyNode *node = fgGetNode(branch, true );
if( NULL == (_offset_node = node->getChild("offset-deg", 0, false)) ) {
_offset_node = node->getChild("offset-deg", 0, true);
_offset_node->setDoubleValue( -fgGetDouble("/environment/magnetic-variation-deg") );
}
_serviceable_node = node->getChild("serviceable", 0, true);
_error_node = node->getChild("heading-bug-error-deg", 0, true);
_nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_off_node = node->getChild("off-flag", 0, true);
_electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
initServicePowerProperties(node);
reinit();
}
@ -86,41 +68,15 @@ HeadingIndicatorFG::reinit ()
_gyro.reinit();
}
void
HeadingIndicatorFG::bind ()
{
std::ostringstream temp;
string branch;
temp << num;
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
fgTie((branch + "/spin").c_str(),
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
}
void
HeadingIndicatorFG::unbind ()
{
std::ostringstream temp;
string branch;
temp << num;
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/spin").c_str());
}
void
HeadingIndicatorFG::update (double dt)
{
// Get the spin from the gyro
_gyro.set_power_norm(_electrical_node->getDoubleValue());
_gyro.set_power_norm(isServiceableAndPowered());
_gyro.update(dt);
double spin = _gyro.get_spin_norm();
if ( _electrical_node->getDoubleValue() > 0 && spin >= 0.25) {
if ( isServiceableAndPowered() && spin >= 0.25) {
_off_node->setBoolValue(false);
} else {
_off_node->setBoolValue(true);

View file

@ -1,24 +1,27 @@
// heading_indicator.hxx - a vacuum-powered heading indicator.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* heading_indicator_fg.hxx - an electrically-powered fluxgate compass.
* Written by David Megginson, started 2002.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_HEADING_INDICATOR_FG_HXX
#define __INSTRUMENTS_HEADING_INDICATOR_FG_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
#endif
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
#include <Instrumentation/AbstractInstrument.hxx>
#include "gyro.hxx"
/**
* Model an electically-powered fluxgate compass
* Model an electrically-powered fluxgate compass
*
* Input properties:
*
@ -26,13 +29,13 @@
* /instrumentation/"name"/spin
* /instrumentation/"name"/offset-deg
* /orientation/heading-deg
* /systems/electrical/outputs/DG
* /systems/electrical/outputs/"name"["number"]
*
* Output properties:
*
* /instrumentation/"name"/indicated-heading-deg
*/
class HeadingIndicatorFG : public SGSubsystem
class HeadingIndicatorFG : public AbstractInstrument
{
public:
HeadingIndicatorFG ( SGPropertyNode *node );
@ -40,10 +43,10 @@ public:
virtual ~HeadingIndicatorFG ();
// Subsystem API.
void bind() override;
//void bind() override;
void init() override;
void reinit() override;
void unbind() override;
//void unbind() override;
void update(double dt) override;
// Subsystem identification.
@ -53,9 +56,6 @@ private:
Gyro _gyro;
double _last_heading_deg;
std::string name;
int num;
SGPropertyNode_ptr _offset_node;
SGPropertyNode_ptr _heading_in_node;
SGPropertyNode_ptr _serviceable_node;
@ -65,5 +65,3 @@ private:
SGPropertyNode_ptr _nav1_error_node;
SGPropertyNode_ptr _off_node;
};
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX

View file

@ -1,26 +1,27 @@
// inst_vertical_speed_indicator.hxx -- Instantaneous VSI (emulation calibrated to standard atmosphere).
//
// Started September 2004.
//
// Copyright (C) 2004
//
// 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.
//
/*
* SPDX-License-Identifier: GPL-2.0+
*
* inst_vertical_speed_indicator.hxx -- Instantaneous VSI (emulation calibrated to standard atmosphere).
* Started September 2004.
*
* Copyright (C) 2004
*
* 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.
*/
#ifndef __INST_VERTICAL_SPEED_INDICATOR_HXX
#define __INST_VERTICAL_SPEED_INDICATOR_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
@ -82,5 +83,3 @@ private:
SGInterpTable * _pressure_table;
SGInterpTable * _altitude_table;
};
#endif // __INST_VERTICAL_SPEED_INDICATOR_HXX

View file

@ -24,6 +24,7 @@
#include "airspeed_indicator.hxx"
#include "altimeter.hxx"
#include "attitude_indicator.hxx"
#include "attitude_indicator_electric.hxx"
#include "clock.hxx"
#include "dme.hxx"
#include "gps.hxx"

View file

@ -1,11 +1,13 @@
// instrument_mgr.hxx - manage aircraft instruments.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* instrument_mgr.hxx - manage aircraft instruments.
* Written by David Megginson, started 2002.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENT_MGR_HXX
#define __INSTRUMENT_MGR_HXX 1
#pragma once
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
@ -37,5 +39,3 @@ private:
std::vector<std::string> _instruments;
};
#endif // __INSTRUMENT_MGR_HXX

View file

@ -1,28 +1,31 @@
// kr-87.hxx -- class to impliment the King KR 87 Digital ADF
//
// Written by Curtis Olson, started June 2002.
//
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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$
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2002 (C) Curtis L. Olson - http://www.flightgear.org/~curt
*
* kr-87.hxx -- class to impliment the King KR 87 Digital ADF
* Written by Curtis Olson, started June 2002.
*
* Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
*
* 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_KR_87_HXX
#define _FG_KR_87_HXX
#pragma once
#include <Main/fg_props.hxx>
@ -188,5 +191,3 @@ public:
inline bool get_flt_ann() const { return flt_ann; }
inline bool get_et_ann() const { return et_ann; }
};
#endif // _FG_KR_87_HXX

View file

@ -46,7 +46,7 @@ MagCompass::init ()
std::string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_pitch_offset_node = node->getChild("pitch-offset-deg", 0, true);
_roll_node = fgGetNode("/orientation/roll-deg", true);

View file

@ -1,11 +1,13 @@
// mag_compass.hxx - an altimeter tied to the static port.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* mag_compass.hxx - models a magnetic compass
* Written by David Megginson, started 2002.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_MAG_COMPASS_HXX
#define __INSTRUMENTS_MAG_COMPASS_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
@ -73,5 +75,3 @@ private:
SGPropertyNode_ptr _z_accel_node;
SGPropertyNode_ptr _out_node;
};
#endif // __INSTRUMENTS_MAG_COMPASS_HXX

View file

@ -1,28 +1,30 @@
// marker_beacon.hxx -- class to manage the marker beacons
//
// Written by Curtis Olson, started April 2000.
//
// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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$
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2000 (C) Curtis L. Olson - http://www.flightgear.org/~curt
*
* marker_beacon.hxx -- class to manage the marker beacons
* Written by Curtis Olson, started April 2000.
*
* Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
*
* 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_MARKER_BEACON_HXX
#define _FG_MARKER_BEACON_HXX
#pragma once
#include <simgear/compiler.h>
@ -96,6 +98,3 @@ private:
FGBeacon::BeaconTiming _beaconTiming;
};
#endif // _FG_MARKER_BEACON_HXX

View file

@ -179,7 +179,7 @@ MK_VIII::PropertiesHandler::init ()
mk_node(nav0_in_range) = fgGetNode("/instrumentation/nav/in-range", true);
mk_node(nav0_nav_loc) = fgGetNode("/instrumentation/nav/nav-loc", true);
mk_node(nav0_serviceable) = fgGetNode("/instrumentation/nav/serviceable", true);
mk_node(power) = fgGetNode(("/systems/electrical/outputs/" + mk->name).c_str(), mk->num, true);
mk_node(power) = fgGetNode(("/systems/electrical/outputs/" + mk->name), mk->num, true);
mk_node(replay_state) = fgGetNode("/sim/freeze/replay-state", true);
mk_node(vs) = fgGetNode("/velocities/vertical-speed-fps", true);
}
@ -1878,7 +1878,7 @@ MK_VIII::IOHandler::tie_output (SGPropertyNode *node,
const char *name,
bool *output)
{
SGPropertyNode *child = node->getNode((string("outputs/discretes/") + name).c_str(), true);
SGPropertyNode *child = node->getNode((string("outputs/discretes/") + name), true);
mk->properties_handler.tie(child, SGRawValuePointer<bool>(output));
child->setAttribute(SGPropertyNode::WRITE, false);
@ -1889,7 +1889,7 @@ MK_VIII::IOHandler::tie_output (SGPropertyNode *node,
const char *name,
int *output)
{
SGPropertyNode *child = node->getNode((string("outputs/arinc429/") + name).c_str(), true);
SGPropertyNode *child = node->getNode((string("outputs/arinc429/") + name), true);
mk->properties_handler.tie(child, SGRawValuePointer<int>(output));
child->setAttribute(SGPropertyNode::WRITE, false);
@ -4649,7 +4649,7 @@ MK_VIII::init ()
void
MK_VIII::bind ()
{
SGPropertyNode *node = fgGetNode(("/instrumentation/" + name).c_str(), num, true);
SGPropertyNode *node = fgGetNode(("/instrumentation/" + name), num, true);
configuration_module.bind(node);
power_handler.bind(node);

View file

@ -1,22 +1,26 @@
// mk_viii.hxx -- Honeywell MK VIII EGPWS emulation
//
// Written by Jean-Yves Lefort, started September 2005.
//
// Copyright (C) 2005, 2006 Jean-Yves Lefort - jylefort@FreeBSD.org
//
// 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2005,2006 (C) Jean-Yves Lefort - jylefort@FreeBSD.org
*
* mk_viii.hxx -- Honeywell MK VIII EGPWS emulation
* Written by Jean-Yves Lefort, started September 2005.
*
* Copyright (C) 2005, 2006 Jean-Yves Lefort - jylefort@FreeBSD.org
*
* 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.
*/
#pragma once

View file

@ -56,7 +56,7 @@ MasterReferenceGyro::init ()
_electrical_node = fgGetNode("/systems/electrical/outputs/MRG", true);
_hdg_mag_in_node = fgGetNode("/orientation/heading-magnetic-deg", true);
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
_off_node = node->getChild("off-flag", 0, true);
_pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
_roll_out_node = node->getChild("indicated-roll-deg", 0, true);

View file

@ -1,11 +1,13 @@
// attitude_indicator.hxx - a vacuum-powered attitude indicator.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* mrg.hxx - an electrically-powered master reference gyro
* Written by David Megginson, started 2002.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_MRG_HXX
#define __INSTRUMENTS_MRG_HXX 1
#pragma once
#include <simgear/props/props.hxx>
@ -102,5 +104,3 @@ private:
SGPropertyNode_ptr _hdg_input_source_node;
SGPropertyNode_ptr _fast_erect_node;
};
#endif // __INSTRUMENTS_MRG_HXX

View file

@ -145,7 +145,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
}
string branch = nodePath();
_radio_node = fgGetNode(branch.c_str(), true);
_radio_node = fgGetNode(branch, true);
}

View file

@ -1,28 +1,30 @@
// navradio.hxx -- class to manage a nav radio instance
//
// Written by Curtis Olson, started April 2000.
//
// Copyright (C) 2000 - 2002 Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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$
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2000 - 2002 (C) Curtis L. Olson - http://www.flightgear.org/~curt
*
* navradio.hxx -- class to manage a nav radio instance
* Written by Curtis Olson, started April 2000.
*
* Copyright (C) 2000 - 2002 Curtis L. Olson - http://www.flightgear.org/~curt
*
* 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_NAVRADIO_HXX
#define _FG_NAVRADIO_HXX
#pragma once
#include <Navaids/navaids_fwd.hxx>
#include <Main/fg_props.hxx>
@ -189,5 +191,3 @@ public:
void search ();
void updateNav();
};
#endif // _FG_NAVRADIO_HXX

View file

@ -1,27 +1,28 @@
// navradio.hxx -- class to manage a nav radio instance
//
// Written by Torsten Dreyer, started August 2011
//
// Copyright (C) 2000 - 2011 Curtis L. Olson - http://www.flightgear.org/~curt
//
// 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.
//
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2000 - 2011 (C) Curtis L. Olson - http://www.flightgear.org/~curt
*
* navradio.hxx -- class to manage a nav radio instance
* Written by Torsten Dreyer, started August 2011
*
* Copyright (C) 2000 - 2011 Curtis L. Olson - http://www.flightgear.org/~curt
*
* 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.
*/
#ifndef _FG_INSTRUMENTATION_NAVRADIO_HXX
#define _FG_INSTRUMENTATION_NAVRADIO_HXX
#pragma once
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
@ -38,5 +39,3 @@ public:
};
}
#endif // _FG_INSTRUMENTATION_NAVRADIO_HXX

View file

@ -52,7 +52,7 @@ RadarAltimeter::init ()
{
std::string branch = "/instrumentation/" + _name;
_Instrument = fgGetNode(branch.c_str(), _num, true);
_Instrument = fgGetNode(branch, _num, true);
_sceneryLoaded = fgGetNode("/sim/sceneryloaded", true);
_serviceable_node = _Instrument->getNode("serviceable", true);

View file

@ -1,28 +1,28 @@
// Radar Altimeter
//
// Written by Vivian MEAZZA, started Feb 2008.
//
//
// Copyright (C) 2008 Vivain MEAZZA - vivian.meazza@lineone.net
//
// 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.
//
//
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2008 (C) Vivain MEAZZA - vivian.meazza@lineone.net
*
* Radar Altimeter
* Written by Vivian MEAZZA, started Feb 2008.
*
* Copyright (C) 2008 Vivain MEAZZA - vivian.meazza@lineone.net
*
* 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.
*/
#ifndef _INST_RADALT_HXX
#define _INST_RADALT_HXX
#pragma once
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/props.hxx>
@ -65,5 +65,3 @@ private:
double _min_radalt;
};
#endif // _INST_AGRADAR_HXX

View file

@ -1,24 +1,28 @@
// rnav_waypt_controller.hxx - Waypoint-specific behaviours for RNAV systems
// Written by James Turner, started 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.
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2009 (C) Curtis L. Olson
*
* rnav_waypt_controller.hxx - Waypoint-specific behaviours for RNAV systems
* Written by James Turner, started 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.
*/
#ifndef FG_WAYPT_CONTROLLER_HXX
#define FG_WAYPT_CONTROLLER_HXX
#pragma once
#include <Navaids/waypoint.hxx>
#include <simgear/misc/simgear_optional.hxx>
@ -340,5 +344,3 @@ public:
};
} // of namespace flightgear
#endif

View file

@ -30,7 +30,7 @@ SlipSkidBall::init ()
string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);

View file

@ -1,11 +1,13 @@
// slip_skid_ball.hxx - an slip-skid ball.
// Written by David Megginson, started 2003.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* slip_skid_ball.hxx - an slip-skid ball.
* Written by David Megginson, started 2003.
*
* This file is in the Public Domain and comes with no warranty.
*/
#ifndef __INSTRUMENTS_SLIP_SKID_BALL_HXX
#define __INSTRUMENTS_SLIP_SKID_BALL_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
@ -52,5 +54,3 @@ private:
SGPropertyNode_ptr _out_node;
SGPropertyNode_ptr _override_node;
};
#endif // __INSTRUMENTS_SLIP_SKID_BALL_HXX

View file

@ -71,7 +71,7 @@ void TACAN::init()
{
std::string branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_ident_node = node->getChild("ident", 0, true);

View file

@ -1,11 +1,16 @@
// dme.hxx - distance-measuring equipment.
// Written by David Megginson, started 2003.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* tacan.hxx - Models a TACAN (Tactical Air Navigation) Radio
* Written by David Megginson, started 2003.
*
* This file is in the Public Domain and comes with no warranty.
*
*/
#ifndef __INSTRUMENTS_TACAN_HXX
#define __INSTRUMENTS_TACAN_HXX 1
#pragma once
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
@ -90,5 +95,3 @@ private:
int _listener_active;
};
#endif // __INSTRUMENTS_TACAN_HXX

View file

@ -1245,7 +1245,7 @@ TCAS::reinit(void)
void
TCAS::bind(void)
{
SGPropertyNode* node = fgGetNode(("/instrumentation/" + name).c_str(), num, true);
SGPropertyNode* node = fgGetNode(("/instrumentation/" + name), num, true);
nodeServiceable = node->getNode("serviceable", true);

View file

@ -1,22 +1,26 @@
// tcas.hxx -- Traffic Alert and Collision Avoidance System (TCAS)
//
// Written by Thorsten Brehm, started December 2010.
//
// Copyright (C) 2010 Thorsten Brehm - brehmt (at) gmail com
//
// 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2010 (C) Thorsten Brehm - brehmt (at) gmail com
*
* tcas.hxx -- Traffic Alert and Collision Avoidance System (TCAS)
* Written by Thorsten Brehm, started December 2010.
*
* Copyright (C) 2010 Thorsten Brehm - brehmt (at) gmail com
*
* 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.
*/
#pragma once

View file

@ -1,26 +1,30 @@
// transponder.hxx -- class to impliment a transponder
//
// Written by Roy Vegard Ovesen, started September 2004.
//
// Copyright (C) 2004 Roy Vegard Ovesen - rvovesen@tiscali.no
// Copyright (C) 2013 Clement de l'Hamaide - clemaez@hotmail.fr
//
// 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.
/*
* SPDX-License-Identifier: GPL-2.0+
* SPDX-FileCopyrightText: 2004 (C) Roy Vegard Ovesen - rvovesen@tiscali.no
* SPDX-FileCopyrightText: 2013 (C) Clement de l'Hamaide - clemaez@hotmail.fr
*
* transponder.hxx -- class to impliment a transponder
* Written by Roy Vegard Ovesen, started September 2004.
*
* Copyright (C) 2004 Roy Vegard Ovesen - rvovesen@tiscali.no
* Copyright (C) 2013 Clement de l'Hamaide - clemaez@hotmail.fr
*
* 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.
*/
#ifndef TRANSPONDER_HXX
#define TRANSPONDER_HXX 1
#pragma once
#include <Instrumentation/AbstractInstrument.hxx>
@ -112,5 +116,3 @@ private:
int setMinMax(int val);
};
#endif // TRANSPONDER_HXX

View file

@ -24,11 +24,9 @@ using std::string;
TurnIndicator::TurnIndicator ( SGPropertyNode *node) :
_last_rate(0),
_name(node->getStringValue("name", "turn-indicator")),
_num(node->getIntValue("number", 0)),
_electrical(node->getIntValue("electrical", 0))
_last_rate(0)
{
readConfig(node, "turn-indicator");
}
TurnIndicator::~TurnIndicator ()
@ -38,16 +36,15 @@ TurnIndicator::~TurnIndicator ()
void
TurnIndicator::init ()
{
string branch;
branch = "/instrumentation/" + _name;
string branch = nodePath();
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, true );
_roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true);
_yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true);
_electric_current_node =
fgGetNode("/systems/electrical/outputs/turn-coordinator", _electrical, true);
_rate_out_node = node->getChild("indicated-turn-rate", 0, true);
initServicePowerProperties(node);
reinit();
}
@ -58,38 +55,11 @@ TurnIndicator::reinit ()
_gyro.reinit();
}
void
TurnIndicator::bind ()
{
std::ostringstream temp;
string branch;
temp << _num;
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
fgTie((branch + "/spin").c_str(),
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
}
void
TurnIndicator::unbind ()
{
std::ostringstream temp;
string branch;
temp << _num;
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/serviceable").c_str());
}
void
TurnIndicator::update (double dt)
{
// Get the spin from the gyro
double power = _electric_current_node->getDoubleValue() / 12.0;
_gyro.set_power_norm(power);
_gyro.set_power_norm(isServiceableAndPowered());
_gyro.update(dt);
double spin = _gyro.get_spin_norm();
@ -113,12 +83,4 @@ TurnIndicator::update (double dt)
_rate_out_node->setDoubleValue(rate);
}
// Register the subsystem.
#if 0
SGSubsystemMgr::InstancedRegistrant<TurnIndicator> registrantTurnIndicator(
SGSubsystemMgr::FDM,
{{"instrumentation", SGSubsystemMgr::Dependency::HARD}});
#endif
// end of turn_indicator.cxx

View file

@ -1,18 +1,21 @@
// turn_indicator.hxx - an electric-powered turn indicator.
// Written by David Megginson, started 2003.
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* turn_indicator.hxx - an electric-powered turn indicator.
* Written by David Megginson, started 2003.
*
* This file is in the Public Domain and comes with no warranty.
*
*/
#ifndef __INSTRUMENTS_TURN_INDICATOR_HXX
#define __INSTRUMENTS_TURN_INDICATOR_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
#endif
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
#include <Instrumentation/AbstractInstrument.hxx>
#include "gyro.hxx"
@ -35,17 +38,17 @@
*
* /instrumentation/"name"/indicated-turn-rate
*/
class TurnIndicator : public SGSubsystem
class TurnIndicator : public AbstractInstrument
{
public:
TurnIndicator ( SGPropertyNode *node );
virtual ~TurnIndicator ();
// Subsystem API.
void bind() override;
//void bind() override;
void init() override;
void reinit() override;
void unbind() override;
//void unbind() override;
void update(double dt) override;
// Subsystem identification.
@ -55,13 +58,7 @@ private:
Gyro _gyro;
double _last_rate;
std::string _name;
int _num, _electrical;
SGPropertyNode_ptr _roll_rate_node;
SGPropertyNode_ptr _yaw_rate_node;
SGPropertyNode_ptr _electric_current_node;
SGPropertyNode_ptr _rate_out_node;
};
#endif // __INSTRUMENTS_TURN_INDICATOR_HXX

View file

@ -43,10 +43,10 @@ VerticalSpeedIndicator::init ()
string branch;
branch = "/instrumentation/" + _name;
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
SGPropertyNode *node = fgGetNode(branch, _num, true );
_serviceable_node = node->getChild("serviceable", 0, true);
_pressure_node = fgGetNode(_static_pressure.c_str(), true);
_temperature_node = fgGetNode(_static_temperature.c_str(), true);
_pressure_node = fgGetNode(_static_pressure, true);
_temperature_node = fgGetNode(_static_temperature, true);
_speed_fpm_node = node->getChild("indicated-speed-fpm", 0, true);
_speed_mps_node = node->getChild("indicated-speed-mps", 0, true);
_speed_kts_node = node->getChild("indicated-speed-kts", 0, true);

View file

@ -1,13 +1,17 @@
// vertical_speed_indicator.hxx - a regular VSI tied to the static port.
// Written by David Megginson, started 2002.
//
// Last change by E. van den Berg, 17.02.1013
//
// This file is in the Public Domain and comes with no warranty.
/*
* SPDX-License-Identifier: CC0-1.0
*
* vertical_speed_indicator.hxx - a regular VSI tied to the static port.
* Written by David Megginson, started 2002.
*
* Last change by E. van den Berg, 17.02.1013
*
* This file is in the Public Domain and comes with no warranty.
*
*/
#ifndef __INSTRUMENTS_VERTICAL_SPEED_INDICATOR_HXX
#define __INSTRUMENTS_VERTICAL_SPEED_INDICATOR_HXX 1
#pragma once
#ifndef __cplusplus
# error This library requires C++
@ -63,5 +67,3 @@ private:
SGPropertyNode_ptr _speed_mps_node;
SGPropertyNode_ptr _speed_kts_node;
};
#endif // __INSTRUMENTS_VERTICAL_SPEED_INDICATOR_HXX