From 0b5594d50d0a5c56fa698fe5a21a63c09f6aa163 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 15 Dec 2001 03:30:45 +0000 Subject: [PATCH] The latest updates from John Wojnaroski. --- src/Network/native_fdm.cxx | 6 +-- src/Network/opengc.cxx | 22 +++++---- src/Network/opengc.hxx | 8 +++- src/Network/opengc_data.hxx | 96 ++++++++++++++++++++++++------------- 4 files changed, 86 insertions(+), 46 deletions(-) diff --git a/src/Network/native_fdm.cxx b/src/Network/native_fdm.cxx index 1ffe850c1..7d5ac289e 100644 --- a/src/Network/native_fdm.cxx +++ b/src/Network/native_fdm.cxx @@ -80,9 +80,9 @@ static void raw2global( const FGRawFDM *raw, FGInterface *global ) { // cout << "pos = " << raw->longitude << " " << raw->latitude << endl; // cout << "sea level rad = " << cur_fdm_state->get_Sea_level_radius() << endl; cur_fdm_state->_updateGeodeticPosition( raw->latitude, - raw->longitude, - raw->altitude - * SG_METER_TO_FEET ); + raw->longitude, + raw->altitude + * SG_METER_TO_FEET ); cur_fdm_state->_set_Euler_Angles( raw->phi, raw->theta, raw->psi ); diff --git a/src/Network/opengc.cxx b/src/Network/opengc.cxx index c2524b49a..bd3714f24 100644 --- a/src/Network/opengc.cxx +++ b/src/Network/opengc.cxx @@ -1,4 +1,8 @@ -// opengc.cxx -- +// opengc.cxx - Network interface program to send sim data onto a LAN +// +// Created by: J. Wojnaroski -- castle@mminternet.com +// Date: 21 Nov 2001 +// // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -60,6 +64,9 @@ static void collect_data( const FGInterface *fdm, ogcFGData *data ) { FGEngInterface *p_engine[4]; // four is enough unless you're a BUF p_engine[0] = cur_fdm_state->get_engine(0); + p_engine[1] = cur_fdm_state->get_engine(1); + + data->version_id = 0x0011; data->latitude = fdm->get_Longitude_deg(); data->longitude = cur_fdm_state->get_Latitude_deg(); @@ -73,25 +80,23 @@ static void collect_data( const FGInterface *fdm, ogcFGData *data ) { data->magvar = globals->get_mag()->get_magvar(); -// engine data, for now set the 2nd engine equal to the first - data->rpm[0] = p_engine[0]->get_RPM(); - data->rpm[1] = p_engine[0]->get_RPM(); + data->rpm[1] = p_engine[1]->get_RPM(); data->epr[0] = p_engine[0]->get_Manifold_Pressure(); - data->epr[1] = p_engine[0]->get_Manifold_Pressure(); + data->epr[1] = p_engine[1]->get_Manifold_Pressure(); data->egt[0] = p_engine[0]->get_EGT(); - data->egt[1] = p_engine[0]->get_EGT(); + data->egt[1] = p_engine[1]->get_EGT(); data->oil_pressure[0] = p_engine[0]->get_Oil_Pressure(); - data->oil_pressure[1] = p_engine[0]->get_Oil_Pressure(); + data->oil_pressure[1] = p_engine[1]->get_Oil_Pressure(); // navigation data // Once OPenGC develops a comparable navaids database some of this will not be required -//data->nav1_ident = current_radiostack->get_nav1_ident(); + //data->nav1_ident = current_radiostack->get_nav1_ident(); data->nav1_freq = current_radiostack->get_nav1_freq(); data->nav1_radial = current_radiostack->get_nav1_sel_radial(); data->nav1_course_dev = current_radiostack->get_nav1_heading_needle_deflection(); @@ -150,3 +155,4 @@ bool FGOpenGC::close() { return true; } + diff --git a/src/Network/opengc.hxx b/src/Network/opengc.hxx index 33266cc6d..fc065394f 100644 --- a/src/Network/opengc.hxx +++ b/src/Network/opengc.hxx @@ -1,5 +1,10 @@ -// opengc.hxx -- + +//// opengc.cxx - Network interface program to send sim data onto a LAN // +// Created by: J. Wojnaroski -- castle@mminternet.com +// Date: 21 Nov 2001 +// + // 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 @@ -53,3 +58,4 @@ public: #endif // _FG_OPENGC_HXX + diff --git a/src/Network/opengc_data.hxx b/src/Network/opengc_data.hxx index f057139ac..397c03b28 100644 --- a/src/Network/opengc_data.hxx +++ b/src/Network/opengc_data.hxx @@ -1,8 +1,14 @@ -// opengc.hxx -- define shared flight model parameters +// opengc.hxx -- Define structure of OpenGC/FG interface parameters +// +// Version by J. Wojnaroski for interface to Open Glass Displays +// +// Modified 02/12/01 - Update engine structure for multi-engine models +// - Added data preamble to id msg types +// +// This file defines the class/structure of the UDP packet that sends +// the simulation data created by FlightGear to the glass displays. It +// is required to "sync" the data types contained in the packet // -// Version 1.0 by J. Wojnaroski for interface to Open Glass Displays -// Date: Nov 18,2001 - // 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 @@ -18,53 +24,75 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#ifndef _OPENGC_HXX -#define _OPENGC_HXX +#ifndef _OPENGC_DATA_HXX +#define _OPENGC_DATA_HXX #ifndef __cplusplus # error This library requires C++ #endif +#include + class ogcFGData { public: - // flight parameters + // defines msg types and contents. typedefs & classes are TBS + unsigned int version_id; + unsigned int msg_id; + unsigned int msg_content; + unsigned short autopilot_mode; + unsigned short afds_armed_mode; + + // flight parameters - double pitch; - double bank; - double heading; - double altitude; - double altitude_agl; - double v_kcas; - double groundspeed; - double vvi; + double pitch; + double bank; + double heading; + double altitude; + double altitude_agl; // this can also be the radar altimeter + double v_kcas; + double groundspeed; + double vvi; + double mach; - // position + // position - double latitude; - double longitude; - double magvar; + double latitude; + double longitude; + double magvar; - // engine data + // engine data - double rpm[4]; - double epr[4]; - double egt[4]; - double fuel_flow[4]; - double oil_pressure[4]; + double rpm[4]; + double epr[4]; + double egt[4]; + double fuel_flow[4]; + double oil_pressure[4]; - // navigation data + double n1_turbine[4]; + double n2_turbine[4]; + + // navigation data + // This will require a lot of related work to build the nav + // database for the ND and some msg traffic both ways to display + // and configure nav aids, freqs, courses, etc etc. OpenGC will + // most likely define an FMC to hold the database and do nav stuff + double nav1_freq; + double nav1_radial; + double nav1_course_dev; + double nav1_gs_dev; + double nav1_dme; - double nav1_freq; - double nav1_radial; - double nav1_course_dev; + double nav2_freq; + double nav2_radial; + double nav2_course_dev; + double nav2_gs_dev; + double nav2_dme; - double nav2_freq; - double nav2_radial; - double nav2_course_dev; - - // some other locations to add stuff in + // some other locations serving as place holders for user defined + // variables reduces the need to update FG or OpenGC code + double d_ogcdata[16]; float f_ogcdata[16]; int i_ogcdata[16];