Integrate a large part of John Wojnaroski's 747 cockpit project.
Erik Hofman: This patch contains an update to net_ctrls.hxx that adds an extra 100 bytes (or an equivalent of 25 (u)int32_t types) of reserved space. This could be used to make the protocol forward and backward compatibel within a certain scope. Be sure to read the instructions at the begining of the header file when addinf new variables.
This commit is contained in:
parent
0b1e386ade
commit
619226e9d0
16 changed files with 488 additions and 108 deletions
|
@ -118,6 +118,14 @@ fi
|
||||||
AC_CHECK_HEADER(pthread.h)
|
AC_CHECK_HEADER(pthread.h)
|
||||||
AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
|
AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
|
||||||
|
|
||||||
|
dnl Festival related checks
|
||||||
|
# defaults to yes
|
||||||
|
AC_ARG_WITH(festival, [ --with-festival Use festival speech software [default=no]], [], [with_festival=no])
|
||||||
|
if test "x$with_festival" = "xyes"; then
|
||||||
|
AC_DEFINE([USE_FESTIVAL], 1, [Define to enable festival speech software])
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL(USE_FESTIVAL, test "x$with_festival" = "xyes")
|
||||||
|
|
||||||
dnl Used by JSBSim to conditionally compile in fgfs interface code
|
dnl Used by JSBSim to conditionally compile in fgfs interface code
|
||||||
AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
|
AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,11 @@
|
||||||
|
|
||||||
#include "ATC.hxx"
|
#include "ATC.hxx"
|
||||||
#include "ATCdisplay.hxx"
|
#include "ATCdisplay.hxx"
|
||||||
|
#include "voice.hxx"
|
||||||
|
|
||||||
|
#ifdef USE_FESTIVAL
|
||||||
|
FGVoice *p_Voice = new FGVoice();
|
||||||
|
#endif
|
||||||
|
|
||||||
FGATC::FGATC() {
|
FGATC::FGATC() {
|
||||||
freqClear = true;
|
freqClear = true;
|
||||||
|
@ -234,8 +239,14 @@ void FGATC::Render(string& msg, const string& refname, bool repeating) {
|
||||||
globals->get_soundmgr()->add(simple, refname);
|
globals->get_soundmgr()->add(simple, refname);
|
||||||
if(repeating) {
|
if(repeating) {
|
||||||
globals->get_soundmgr()->play_looped(refname);
|
globals->get_soundmgr()->play_looped(refname);
|
||||||
|
#ifdef USE_FESTIVAL
|
||||||
|
p_Voice->send_transcript( msg , refname, 1 );
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
globals->get_soundmgr()->play_once(refname);
|
globals->get_soundmgr()->play_once(refname);
|
||||||
|
#ifdef USE_FESTIVAL
|
||||||
|
p_Voice->send_transcript( msg , refname, 0 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
|
@ -250,8 +261,14 @@ void FGATC::Render(string& msg, const string& refname, bool repeating) {
|
||||||
}
|
}
|
||||||
if(repeating) {
|
if(repeating) {
|
||||||
globals->get_ATC_display()->RegisterRepeatingMessage(msg);
|
globals->get_ATC_display()->RegisterRepeatingMessage(msg);
|
||||||
|
#ifdef USE_FESTIVAL
|
||||||
|
p_Voice->send_transcript( msg , refname, 1 );
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
globals->get_ATC_display()->RegisterSingleMessage(msg);
|
globals->get_ATC_display()->RegisterSingleMessage(msg);
|
||||||
|
#ifdef USE_FESTIVAL
|
||||||
|
p_Voice->send_transcript( msg, refname, 0 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_playing = true;
|
_playing = true;
|
||||||
|
@ -262,10 +279,13 @@ void FGATC::Render(string& msg, const string& refname, bool repeating) {
|
||||||
void FGATC::NoRender(const string& refname) {
|
void FGATC::NoRender(const string& refname) {
|
||||||
if(_playing) {
|
if(_playing) {
|
||||||
if(_voice) {
|
if(_voice) {
|
||||||
#ifdef ENABLE_AUDIO_SUPPORT
|
#ifdef ENABLE_AUDIO_SUPPORT
|
||||||
globals->get_soundmgr()->stop(refname);
|
globals->get_soundmgr()->stop(refname);
|
||||||
globals->get_soundmgr()->remove(refname);
|
globals->get_soundmgr()->remove(refname);
|
||||||
#endif
|
# ifdef USE_FESTIVAL
|
||||||
|
p_Voice->send_transcript( "--", refname, 2);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
globals->get_ATC_display()->CancelRepeatingMessage();
|
globals->get_ATC_display()->CancelRepeatingMessage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
noinst_LIBRARIES = libATC.a
|
noinst_LIBRARIES = libATC.a
|
||||||
|
|
||||||
|
if USE_FESTIVAL
|
||||||
|
VOICE_SRC = voice.cxx voice.hxx
|
||||||
|
else
|
||||||
|
VOICE_SRC =
|
||||||
|
endif
|
||||||
|
|
||||||
libATC_a_SOURCES = \
|
libATC_a_SOURCES = \
|
||||||
ATC.hxx ATC.cxx \
|
ATC.hxx ATC.cxx \
|
||||||
atis.hxx atis.cxx \
|
atis.hxx atis.cxx \
|
||||||
|
@ -18,6 +24,8 @@ libATC_a_SOURCES = \
|
||||||
AIPlane.hxx AIPlane.cxx \
|
AIPlane.hxx AIPlane.cxx \
|
||||||
AILocalTraffic.hxx AILocalTraffic.cxx \
|
AILocalTraffic.hxx AILocalTraffic.cxx \
|
||||||
AIGAVFRTraffic.hxx AIGAVFRTraffic.cxx \
|
AIGAVFRTraffic.hxx AIGAVFRTraffic.cxx \
|
||||||
transmission.hxx transmission.cxx transmissionlist.hxx transmissionlist.cxx
|
transmission.hxx transmission.cxx \
|
||||||
|
transmissionlist.hxx transmissionlist.cxx \
|
||||||
|
$(VOICE_SRC)
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
||||||
|
|
|
@ -711,7 +711,7 @@ void FGTower::ProcessRunwayVacatedReport(TowerPlaneRec* t) {
|
||||||
if(!t->isUser) t->planePtr->RegisterTransmission(5);
|
if(!t->isUser) t->planePtr->RegisterTransmission(5);
|
||||||
} else {
|
} else {
|
||||||
// Cop-out!!
|
// Cop-out!!
|
||||||
trns += " cleared for taxi to the GA parking";
|
trns += " cleared for taxi to general aviation parking";
|
||||||
if(!t->isUser) t->planePtr->RegisterTransmission(6); // TODO - this is a mega-hack!!
|
if(!t->isUser) t->planePtr->RegisterTransmission(6); // TODO - this is a mega-hack!!
|
||||||
}
|
}
|
||||||
//cout << "trns = " << trns << '\n';
|
//cout << "trns = " << trns << '\n';
|
||||||
|
|
83
src/ATC/voice.cxx
Normal file
83
src/ATC/voice.cxx
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
|
||||||
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include STL_IOSTREAM
|
||||||
|
SG_USING_STD(cout);
|
||||||
|
SG_USING_STD(endl);
|
||||||
|
|
||||||
|
#define ATC_SERVER_ADDRESS "192.168.2.15" // adddress of machine running festival server
|
||||||
|
|
||||||
|
#include "voice.hxx"
|
||||||
|
|
||||||
|
int atc_sockfd = 0;
|
||||||
|
int result, servlen;
|
||||||
|
struct sockaddr_in atc_serv_addr, atc_cli_add;
|
||||||
|
|
||||||
|
//FGVoice *p_voice;
|
||||||
|
|
||||||
|
bool FGVoice::send_transcript( string trans, string refname, short repeat )
|
||||||
|
{
|
||||||
|
string msg;
|
||||||
|
|
||||||
|
switch ( repeat ) {
|
||||||
|
case 0: msg = "S " + refname + ">" + trans;
|
||||||
|
break;
|
||||||
|
case 1: msg = "R " + refname + ">" + trans;
|
||||||
|
break;
|
||||||
|
case 2: msg = "X " + refname;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// strip out some characters
|
||||||
|
for(unsigned int i = 0; i < msg.length(); ++i) {
|
||||||
|
if((msg.substr(i,1) == "_") || (msg.substr(i,1) == "/")) {
|
||||||
|
msg[i] = ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int len = msg.length();
|
||||||
|
if (sendto(atc_sockfd, (char *) msg.c_str(), len, 0, (struct sockaddr *) &atc_serv_addr, servlen ) != len) {
|
||||||
|
cout << "network write failed for " << len << " chars" << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
printf("Transmit: %s of %d chars\n", msg.c_str(), len );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FGVoice::FGVoice()
|
||||||
|
{
|
||||||
|
string mesg = "Welcome to the FlightGear voice synthesizer";
|
||||||
|
string welcome = "welcome ";
|
||||||
|
// Init the network stuff here
|
||||||
|
printf( "FGVoice created. Connecting to atc sim\n");
|
||||||
|
servlen = sizeof( atc_serv_addr );
|
||||||
|
bzero((char *) &atc_serv_addr, servlen);
|
||||||
|
atc_serv_addr.sin_family = AF_INET;
|
||||||
|
atc_serv_addr.sin_addr.s_addr = inet_addr(ATC_SERVER_ADDRESS);
|
||||||
|
atc_serv_addr.sin_port = htons(7100);
|
||||||
|
|
||||||
|
if ((atc_sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||||
|
{
|
||||||
|
printf("Failed to obtain a socket\n");
|
||||||
|
// return( 0 );
|
||||||
|
}
|
||||||
|
else send_transcript( mesg, welcome, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
FGVoice::~FGVoice()
|
||||||
|
{
|
||||||
|
close( atc_sockfd );
|
||||||
|
}
|
18
src/ATC/voice.hxx
Normal file
18
src/ATC/voice.hxx
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// atc_voice.hxx
|
||||||
|
#include <simgear/constants.h>
|
||||||
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
|
#include STL_STRING
|
||||||
|
SG_USING_STD(string);
|
||||||
|
|
||||||
|
class FGVoice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FGVoice();
|
||||||
|
~FGVoice();
|
||||||
|
|
||||||
|
bool send_transcript( string trans, string refname, short repeat );
|
||||||
|
|
||||||
|
};
|
||||||
|
extern FGVoice *p_Voice;
|
||||||
|
|
|
@ -198,6 +198,7 @@ FGControls::init ()
|
||||||
fuel_pump[engine] = false;
|
fuel_pump[engine] = false;
|
||||||
prop_advance[engine] = 1.0;
|
prop_advance[engine] = 1.0;
|
||||||
magnetos[engine] = 0;
|
magnetos[engine] = 0;
|
||||||
|
feed_tank[engine] = -1; // set to -1 to turn off all tanks 0 feeds all engines from center body tank
|
||||||
starter[engine] = false;
|
starter[engine] = false;
|
||||||
ignition[engine] = false;
|
ignition[engine] = false;
|
||||||
fire_switch[engine] = false;
|
fire_switch[engine] = false;
|
||||||
|
@ -342,6 +343,13 @@ FGControls::bind ()
|
||||||
fgTie(name, this, index,
|
fgTie(name, this, index,
|
||||||
&FGControls::get_magnetos, &FGControls::set_magnetos);
|
&FGControls::get_magnetos, &FGControls::set_magnetos);
|
||||||
fgSetArchivable(name);
|
fgSetArchivable(name);
|
||||||
|
|
||||||
|
snprintf(name, MAX_NAME_LEN,
|
||||||
|
"/controls/engines/engine[%d]/feed_tank", index);
|
||||||
|
fgTie(name, this, index,
|
||||||
|
&FGControls::get_feed_tank, &FGControls::set_feed_tank);
|
||||||
|
fgSetArchivable(name);
|
||||||
|
|
||||||
|
|
||||||
snprintf(name, MAX_NAME_LEN, "/controls/engines/engine[%d]/WEP", index);
|
snprintf(name, MAX_NAME_LEN, "/controls/engines/engine[%d]/WEP", index);
|
||||||
fgTie(name, this, index,
|
fgTie(name, this, index,
|
||||||
|
@ -835,6 +843,9 @@ void FGControls::unbind ()
|
||||||
snprintf(name, MAX_NAME_LEN,
|
snprintf(name, MAX_NAME_LEN,
|
||||||
"/controls/engines/engine[%d]/throttle", index);
|
"/controls/engines/engine[%d]/throttle", index);
|
||||||
fgUntie(name);
|
fgUntie(name);
|
||||||
|
snprintf(name, MAX_NAME_LEN,
|
||||||
|
"/controls/engines/engine[%d]/feed_tank", index);
|
||||||
|
fgUntie(name);
|
||||||
snprintf(name, MAX_NAME_LEN,
|
snprintf(name, MAX_NAME_LEN,
|
||||||
"/controls/engines/engine[%d]/starter", index);
|
"/controls/engines/engine[%d]/starter", index);
|
||||||
fgUntie(name);
|
fgUntie(name);
|
||||||
|
@ -1330,6 +1341,23 @@ FGControls::set_cutoff( int engine, bool val )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGControls::set_feed_tank( int engine, int tank )
|
||||||
|
{
|
||||||
|
if ( engine == ALL_ENGINES ) {
|
||||||
|
for ( int i = 0; i < MAX_ENGINES; i++ ) {
|
||||||
|
feed_tank[i] = tank;
|
||||||
|
CLAMP( &feed_tank[i], -1, 4 );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
|
||||||
|
feed_tank[engine] = tank;
|
||||||
|
CLAMP( &feed_tank[engine], -1, 4 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// feed_tank[engine] = engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FGControls::set_mixture( int engine, double pos )
|
FGControls::set_mixture( int engine, double pos )
|
||||||
|
|
|
@ -133,6 +133,7 @@ private:
|
||||||
double mixture[MAX_ENGINES];
|
double mixture[MAX_ENGINES];
|
||||||
double prop_advance[MAX_ENGINES];
|
double prop_advance[MAX_ENGINES];
|
||||||
int magnetos[MAX_ENGINES];
|
int magnetos[MAX_ENGINES];
|
||||||
|
int feed_tank[MAX_ENGINES];
|
||||||
bool nitrous_injection[MAX_ENGINES]; // War Emergency Power
|
bool nitrous_injection[MAX_ENGINES]; // War Emergency Power
|
||||||
double cowl_flaps_norm[MAX_ENGINES];
|
double cowl_flaps_norm[MAX_ENGINES];
|
||||||
bool feather[MAX_ENGINES];
|
bool feather[MAX_ENGINES];
|
||||||
|
@ -307,6 +308,7 @@ public:
|
||||||
return prop_advance[engine];
|
return prop_advance[engine];
|
||||||
}
|
}
|
||||||
inline int get_magnetos(int engine) const { return magnetos[engine]; }
|
inline int get_magnetos(int engine) const { return magnetos[engine]; }
|
||||||
|
inline int get_feed_tank(int engine) const { return feed_tank[engine]; }
|
||||||
inline bool get_nitrous_injection(int engine) const {
|
inline bool get_nitrous_injection(int engine) const {
|
||||||
return nitrous_injection[engine];
|
return nitrous_injection[engine];
|
||||||
}
|
}
|
||||||
|
@ -499,6 +501,7 @@ public:
|
||||||
void move_prop_advance( int engine, double amt );
|
void move_prop_advance( int engine, double amt );
|
||||||
void set_magnetos( int engine, int pos );
|
void set_magnetos( int engine, int pos );
|
||||||
void move_magnetos( int engine, int amt );
|
void move_magnetos( int engine, int amt );
|
||||||
|
void set_feed_tank( int engine, int tank );
|
||||||
void set_nitrous_injection( int engine, bool val );
|
void set_nitrous_injection( int engine, bool val );
|
||||||
void set_cowl_flaps_norm( int engine, double pos );
|
void set_cowl_flaps_norm( int engine, double pos );
|
||||||
void move_cowl_flaps_norm( int engine, double amt );
|
void move_cowl_flaps_norm( int engine, double amt );
|
||||||
|
|
|
@ -369,11 +369,10 @@ public:
|
||||||
inline void _set_Density( double d ) { density = d; }
|
inline void _set_Density( double d ) { density = d; }
|
||||||
inline void _set_Mach_number( double m ) { mach_number = m; }
|
inline void _set_Mach_number( double m ) { mach_number = m; }
|
||||||
inline void _set_Static_pressure( double sp ) { static_pressure = sp; }
|
inline void _set_Static_pressure( double sp ) { static_pressure = sp; }
|
||||||
inline void _set_Static_temperature( double t ) { static_temperature = t; }
|
inline void _set_Static_temperature( double t ) { static_temperature = t; }
|
||||||
|
inline void _set_Total_temperature( double tat ) { total_temperature = tat; } //JW
|
||||||
inline void _set_Sea_level_radius( double r ) { sea_level_radius = r; }
|
inline void _set_Sea_level_radius( double r ) { sea_level_radius = r; }
|
||||||
inline void _set_Earth_position_angle(double a) {
|
inline void _set_Earth_position_angle(double a) { earth_position_angle = a; }
|
||||||
earth_position_angle = a;
|
|
||||||
}
|
|
||||||
inline void _set_Runway_altitude( double alt ) { runway_altitude = alt; }
|
inline void _set_Runway_altitude( double alt ) { runway_altitude = alt; }
|
||||||
inline void _set_Climb_Rate(double rate) { climb_rate = rate; }
|
inline void _set_Climb_Rate(double rate) { climb_rate = rate; }
|
||||||
inline void _set_sin_lat_geocentric(double parm) {
|
inline void _set_sin_lat_geocentric(double parm) {
|
||||||
|
|
|
@ -376,6 +376,12 @@ void fgHiResDump()
|
||||||
bool do_panel = fgPanelVisible();
|
bool do_panel = fgPanelVisible();
|
||||||
GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
|
GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
|
||||||
GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
|
GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
|
||||||
|
|
||||||
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||||
|
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||||
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
|
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
|
||||||
|
glHint(GL_FOG_HINT, GL_NICEST);
|
||||||
|
|
||||||
/* Draw tiles */
|
/* Draw tiles */
|
||||||
int more = 1;
|
int more = 1;
|
||||||
|
@ -383,6 +389,7 @@ void fgHiResDump()
|
||||||
trBeginTile(tr);
|
trBeginTile(tr);
|
||||||
int curColumn = trGet(tr, TR_CURRENT_COLUMN);
|
int curColumn = trGet(tr, TR_CURRENT_COLUMN);
|
||||||
int curRow = trGet(tr, TR_CURRENT_ROW);
|
int curRow = trGet(tr, TR_CURRENT_ROW);
|
||||||
|
|
||||||
renderer->update( false );
|
renderer->update( false );
|
||||||
if ( do_hud )
|
if ( do_hud )
|
||||||
fgUpdateHUD( curColumn*hud_col_step, curRow*hud_row_step,
|
fgUpdateHUD( curColumn*hud_col_step, curRow*hud_row_step,
|
||||||
|
@ -424,6 +431,18 @@ void fgHiResDump()
|
||||||
|
|
||||||
trDelete(tr);
|
trDelete(tr);
|
||||||
|
|
||||||
|
glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE);
|
||||||
|
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
||||||
|
glHint(GL_POINT_SMOOTH_HINT, GL_DONT_CARE);
|
||||||
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
||||||
|
if ( (!strcmp(fgGetString("/sim/rendering/fog"), "disabled")) ||
|
||||||
|
(!fgGetBool("/sim/rendering/shading"))) {
|
||||||
|
// if fastest fog requested, or if flat shading force fastest
|
||||||
|
glHint ( GL_FOG_HINT, GL_FASTEST );
|
||||||
|
} else if ( !strcmp(fgGetString("/sim/rendering/fog"), "nicest") ) {
|
||||||
|
glHint ( GL_FOG_HINT, GL_DONT_CARE );
|
||||||
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
message = "Snapshot saved to \"";
|
message = "Snapshot saved to \"";
|
||||||
|
|
|
@ -19,6 +19,12 @@ else
|
||||||
THREAD_LIBS =
|
THREAD_LIBS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if USE_FESTIVAL
|
||||||
|
VOICE_LIBS = $(top_builddir)/src/Voice/libVoice.a
|
||||||
|
else
|
||||||
|
VOICE_LIBS =
|
||||||
|
endif
|
||||||
|
|
||||||
if USE_SDL
|
if USE_SDL
|
||||||
GFX_CODE = fg_os_sdl.cxx fg_os.hxx
|
GFX_CODE = fg_os_sdl.cxx fg_os.hxx
|
||||||
else
|
else
|
||||||
|
@ -92,6 +98,7 @@ fgfs_LDADD = \
|
||||||
$(top_builddir)/src/Sound/libSound.a \
|
$(top_builddir)/src/Sound/libSound.a \
|
||||||
$(top_builddir)/src/Airports/libAirports.a \
|
$(top_builddir)/src/Airports/libAirports.a \
|
||||||
$(MPLAYER_LIBS) \
|
$(MPLAYER_LIBS) \
|
||||||
|
$(VOICE_LIBS) \
|
||||||
$(top_builddir)/src/Systems/libSystems.a \
|
$(top_builddir)/src/Systems/libSystems.a \
|
||||||
$(top_builddir)/src/Time/libTime.a \
|
$(top_builddir)/src/Time/libTime.a \
|
||||||
$(top_builddir)/src/Traffic/libTraffic.a \
|
$(top_builddir)/src/Traffic/libTraffic.a \
|
||||||
|
|
|
@ -293,7 +293,7 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
SGPropertyNode * node;
|
SGPropertyNode * node;
|
||||||
|
/***************
|
||||||
if ( net_byte_order ) {
|
if ( net_byte_order ) {
|
||||||
// convert from network byte order
|
// convert from network byte order
|
||||||
net->version = htonl(net->version);
|
net->version = htonl(net->version);
|
||||||
|
@ -350,7 +350,7 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
net->speedup = htonl(net->speedup);
|
net->speedup = htonl(net->speedup);
|
||||||
net->freeze = htonl(net->freeze);
|
net->freeze = htonl(net->freeze);
|
||||||
}
|
}
|
||||||
|
*************/
|
||||||
if ( net->version != FG_NET_CTRLS_VERSION ) {
|
if ( net->version != FG_NET_CTRLS_VERSION ) {
|
||||||
SG_LOG( SG_IO, SG_ALERT,
|
SG_LOG( SG_IO, SG_ALERT,
|
||||||
"Version mismatch with raw controls packet format." );
|
"Version mismatch with raw controls packet format." );
|
||||||
|
@ -366,6 +366,10 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
node->setDoubleValue( "elevator-trim", net->elevator_trim );
|
node->setDoubleValue( "elevator-trim", net->elevator_trim );
|
||||||
node->setDoubleValue( "rudder-trim", net->rudder_trim );
|
node->setDoubleValue( "rudder-trim", net->rudder_trim );
|
||||||
node->setDoubleValue( "flaps", net->flaps );
|
node->setDoubleValue( "flaps", net->flaps );
|
||||||
|
node->setDoubleValue( "speedbrake", net->speedbrake ); //JWW
|
||||||
|
// or
|
||||||
|
node->setDoubleValue( "spoilers", net->spoilers ); //JWW
|
||||||
|
// cout << "NET->Spoilers: " << net->spoilers << endl;
|
||||||
fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power );
|
fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power );
|
||||||
node->setBoolValue( "flaps-serviceable", net->flap_motor_ok );
|
node->setBoolValue( "flaps-serviceable", net->flap_motor_ok );
|
||||||
|
|
||||||
|
@ -380,7 +384,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
->setDoubleValue( net->condition[i] );
|
->setDoubleValue( net->condition[i] );
|
||||||
node->getChild( "magnetos" )->setDoubleValue( net->magnetos[i] );
|
node->getChild( "magnetos" )->setDoubleValue( net->magnetos[i] );
|
||||||
node->getChild( "starter" )->setDoubleValue( net->starter_power[i] );
|
node->getChild( "starter" )->setDoubleValue( net->starter_power[i] );
|
||||||
|
node->getChild( "feed_tank" )->setIntValue( net->feed_tank_to[i] );
|
||||||
|
node->getChild( "reverser" )->setBoolValue( net->reverse[i] );
|
||||||
// Faults
|
// Faults
|
||||||
SGPropertyNode *faults = node->getNode( "faults", true );
|
SGPropertyNode *faults = node->getNode( "faults", true );
|
||||||
faults->setBoolValue( "serviceable", net->engine_ok[i] );
|
faults->setBoolValue( "serviceable", net->engine_ok[i] );
|
||||||
|
@ -401,6 +406,7 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
node = fgGetNode( "/controls/fuel/tank", i );
|
node = fgGetNode( "/controls/fuel/tank", i );
|
||||||
node->getChild( "fuel_selector" )
|
node->getChild( "fuel_selector" )
|
||||||
->setBoolValue( net->fuel_selector[i] );
|
->setBoolValue( net->fuel_selector[i] );
|
||||||
|
// node->getChild( "to_tank" )->xfer_tank( i, net->xfer_to[i] );
|
||||||
}
|
}
|
||||||
node = fgGetNode( "/controls/gear" );
|
node = fgGetNode( "/controls/gear" );
|
||||||
if ( node != NULL ) {
|
if ( node != NULL ) {
|
||||||
|
@ -415,6 +421,9 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
|
|
||||||
node = fgGetNode( "/controls/gear", true );
|
node = fgGetNode( "/controls/gear", true );
|
||||||
node->setBoolValue( "gear-down", net->gear_handle );
|
node->setBoolValue( "gear-down", net->gear_handle );
|
||||||
|
// node->setDoubleValue( "brake-parking", net->brake_parking );
|
||||||
|
// node->setDoubleValue( net->brake_left );
|
||||||
|
// node->setDoubleValue( net->brake_right );
|
||||||
|
|
||||||
node = fgGetNode( "/controls/switches", true );
|
node = fgGetNode( "/controls/switches", true );
|
||||||
node->setBoolValue( "master-bat", net->master_bat );
|
node->setBoolValue( "master-bat", net->master_bat );
|
||||||
|
@ -435,6 +444,11 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
||||||
// ground elevation ???
|
// ground elevation ???
|
||||||
|
|
||||||
fgSetDouble("/hazards/icing/wing", net->icing);
|
fgSetDouble("/hazards/icing/wing", net->icing);
|
||||||
|
|
||||||
|
node = fgGetNode( "/radios", true );
|
||||||
|
node->setDoubleValue( "comm/frequencies/selected-mhz[0]", net->comm_1 );
|
||||||
|
node->setDoubleValue( "nav/frequencies/selected-mhz[0]", net->nav_1 );
|
||||||
|
node->setDoubleValue( "nav[1]/frequencies/selected-mhz[0]", net->nav_2 );
|
||||||
|
|
||||||
fgSetInt( "/sim/speed-up", net->speedup );
|
fgSetInt( "/sim/speed-up", net->speedup );
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,18 @@
|
||||||
// I am not aware of any platforms that don't use 4 bytes for float
|
// I am not aware of any platforms that don't use 4 bytes for float
|
||||||
// and 8 bytes for double.
|
// and 8 bytes for double.
|
||||||
|
|
||||||
const uint32_t FG_NET_CTRLS_VERSION = 26;
|
// !!! IMPORTANT !!!
|
||||||
|
/* There is some space reserved in the protocol for future use.
|
||||||
|
* When adding a new type, add it just before the "reserved" definition
|
||||||
|
* and subtract the size of this new type from the RESERVED_SPACE definition
|
||||||
|
* (1 for (u)int32_t or float and 2 for double).
|
||||||
|
*
|
||||||
|
* This way the protocol will be forward and backward compatible until
|
||||||
|
* RESERVED_SPACE becomes zero.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define RESERVED_SPACE 25
|
||||||
|
const uint32_t FG_NET_CTRLS_VERSION = 27;
|
||||||
|
|
||||||
|
|
||||||
// Define a structure containing the control parameters
|
// Define a structure containing the control parameters
|
||||||
|
@ -32,7 +43,7 @@ public:
|
||||||
enum {
|
enum {
|
||||||
FG_MAX_ENGINES = 4,
|
FG_MAX_ENGINES = 4,
|
||||||
FG_MAX_WHEELS = 16,
|
FG_MAX_WHEELS = 16,
|
||||||
FG_MAX_TANKS = 6
|
FG_MAX_TANKS = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t version; // increment when data values change
|
uint32_t version; // increment when data values change
|
||||||
|
@ -45,6 +56,8 @@ public:
|
||||||
double elevator_trim; // -1 ... 1
|
double elevator_trim; // -1 ... 1
|
||||||
double rudder_trim; // -1 ... 1
|
double rudder_trim; // -1 ... 1
|
||||||
double flaps; // 0 ... 1
|
double flaps; // 0 ... 1
|
||||||
|
double spoilers;
|
||||||
|
double speedbrake;
|
||||||
|
|
||||||
// Aero control faults
|
// Aero control faults
|
||||||
uint32_t flaps_power; // true = power available
|
uint32_t flaps_power; // true = power available
|
||||||
|
@ -61,6 +74,9 @@ public:
|
||||||
double condition[FG_MAX_ENGINES]; // 0 ... 1
|
double condition[FG_MAX_ENGINES]; // 0 ... 1
|
||||||
uint32_t fuel_pump_power[FG_MAX_ENGINES];// true = on
|
uint32_t fuel_pump_power[FG_MAX_ENGINES];// true = on
|
||||||
double prop_advance[FG_MAX_ENGINES]; // 0 ... 1
|
double prop_advance[FG_MAX_ENGINES]; // 0 ... 1
|
||||||
|
uint32_t feed_tank_to[4];
|
||||||
|
uint32_t reverse[4];
|
||||||
|
|
||||||
|
|
||||||
// Engine faults
|
// Engine faults
|
||||||
uint32_t engine_ok[FG_MAX_ENGINES];
|
uint32_t engine_ok[FG_MAX_ENGINES];
|
||||||
|
@ -73,6 +89,9 @@ public:
|
||||||
// Fuel management
|
// Fuel management
|
||||||
uint32_t num_tanks; // number of valid tanks
|
uint32_t num_tanks; // number of valid tanks
|
||||||
uint32_t fuel_selector[FG_MAX_TANKS]; // false = off, true = on
|
uint32_t fuel_selector[FG_MAX_TANKS]; // false = off, true = on
|
||||||
|
uint32_t xfer_pump[5]; // specifies transfer from array
|
||||||
|
// value tank to tank specified by
|
||||||
|
// int value
|
||||||
uint32_t cross_feed; // false = off, true = on
|
uint32_t cross_feed; // false = off, true = on
|
||||||
|
|
||||||
// Brake controls
|
// Brake controls
|
||||||
|
@ -87,6 +106,12 @@ public:
|
||||||
|
|
||||||
// Switches
|
// Switches
|
||||||
uint32_t master_avionics;
|
uint32_t master_avionics;
|
||||||
|
|
||||||
|
// nav and Comm
|
||||||
|
double comm_1;
|
||||||
|
double comm_2;
|
||||||
|
double nav_1;
|
||||||
|
double nav_2;
|
||||||
|
|
||||||
// wind and turbulance
|
// wind and turbulance
|
||||||
double wind_speed_kt;
|
double wind_speed_kt;
|
||||||
|
@ -112,6 +137,12 @@ public:
|
||||||
// 0x01=master
|
// 0x01=master
|
||||||
// 0x02=position
|
// 0x02=position
|
||||||
// 0x04=fuel
|
// 0x04=fuel
|
||||||
|
|
||||||
|
// --- New since FlightGear 0.9.10 (FG_NET_CTRLS_VERSION = 27)
|
||||||
|
|
||||||
|
// --- Add new variables just before this line.
|
||||||
|
|
||||||
|
uint32_t reserved[RESERVED_SPACE]; // 100 bytes reserved for future use.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,29 +41,61 @@
|
||||||
SG_USING_STD(vector);
|
SG_USING_STD(vector);
|
||||||
|
|
||||||
FGOpenGC::FGOpenGC() :
|
FGOpenGC::FGOpenGC() :
|
||||||
press_node(fgGetNode("/environment/pressure-inhg", true)),
|
press_node(fgGetNode("/environment/pressure-inhg[0]", true)),
|
||||||
temp_node(fgGetNode("/environment/temperature-degc", true)),
|
temp_node(fgGetNode("/environment/temperature-degc[0]", true)),
|
||||||
wind_dir_node(fgGetNode("/environment/wind-from-heading-deg", true)),
|
wind_dir_node(fgGetNode("/environment/wind-from-heading-deg[0]", true)),
|
||||||
wind_speed_node(fgGetNode("/environment/wind-speed-kt", true)),
|
wind_speed_node(fgGetNode("/environment/wind-speed-kt[0]", true)),
|
||||||
mag_var_node(fgGetNode("/environment/magnetic-variation-deg", true)),
|
magvar_node(fgGetNode("/environment/magnetic-variation-deg[0]", true)),
|
||||||
p_latitude(fgGetNode("/position/latitude-deg", true)),
|
|
||||||
p_longitude(fgGetNode("/position/longitude-deg", true)),
|
|
||||||
p_alt_node(fgGetNode("/position/altitude-ft", true)),
|
|
||||||
p_altitude(fgGetNode("/steam/altitude-ft", true)),
|
|
||||||
p_altitude_agl(fgGetNode("/position/altitude-agl-ft", true)),
|
|
||||||
egt0_node(fgGetNode("/engines/engine/egt-degf", true)),
|
|
||||||
egt1_node(fgGetNode("/engines/engine[1]/egt-degf", true)),
|
|
||||||
egt2_node(fgGetNode("/engines/engine[2]/egt-degf", true)),
|
|
||||||
egt3_node(fgGetNode("/engines/engine[3]/egt-degf", true)),
|
|
||||||
p_left_aileron(fgGetNode("surface-positions/left-aileron-pos-norm", true)),
|
p_left_aileron(fgGetNode("surface-positions/left-aileron-pos-norm", true)),
|
||||||
p_right_aileron(fgGetNode("surface-positions/right-aileron-pos-norm", true)),
|
p_right_aileron(fgGetNode("surface-positions/right-aileron-pos-norm", true)),
|
||||||
p_elevator(fgGetNode("surface-positions/elevator-pos-norm", true)),
|
p_elevator(fgGetNode("surface-positions/elevator-pos-norm", true)),
|
||||||
p_elevator_trim(fgGetNode("surface-positions/elevator_trim-pos-norm", true)),
|
p_elevator_trim(fgGetNode("surface-positions/elevator_trim-pos-norm", true)),
|
||||||
p_rudder(fgGetNode("surface-positions/rudder-pos-norm", true)),
|
p_rudder(fgGetNode("surface-positions/rudder-pos-norm", true)),
|
||||||
p_flaps(fgGetNode("surface-positions/flap-pos-norm", true)),
|
p_flaps(fgGetNode("surface-positions/flap-pos-norm", true)),
|
||||||
p_flaps_cmd(fgGetNode("/controls/flaps", true)),
|
p_flaps_cmd(fgGetNode("/controls/flight/flaps", true)),
|
||||||
p_alphadot(fgGetNode("/fdm/jsbsim/aero/alphadot-radsec", true)),
|
p_alphadot(fgGetNode("/fdm/jsbsim/aero/alphadot-rad_sec[0]", true)),
|
||||||
p_betadot(fgGetNode("/fdm/jsbsim/aero/betadot-radsec", true))
|
p_betadot(fgGetNode("/fdm/jsbsim/aero/betadot-rad_sec[0]", true)),
|
||||||
|
p_latitude(fgGetNode("/position/latitude-deg", true)),
|
||||||
|
p_longitude(fgGetNode("/position/longitude-deg", true)),
|
||||||
|
p_elev_node(fgGetNode("/position/altitude-ft", true)),
|
||||||
|
p_altitude_agl(fgGetNode("/position/altitude-agl-ft", true)),
|
||||||
|
vel_kcas(fgGetNode("/velocities/airspeed-kt[0]", true)),
|
||||||
|
p_vvi(fgGetNode("/velocities/vertical-speed-fps[0]", true )),
|
||||||
|
p_mach(fgGetNode("/velocities/mach[0]", true )),
|
||||||
|
egt0_node(fgGetNode("/engines/engine/EGT_degC[0]", true)),
|
||||||
|
egt1_node(fgGetNode("/engines/engine[1]/EGT_degC[0]", true)),
|
||||||
|
egt2_node(fgGetNode("/engines/engine[2]/EGT_degC[0]", true)),
|
||||||
|
egt3_node(fgGetNode("/engines/engine[3]/EGT_degC[0]", true)),
|
||||||
|
epr0_node(fgGetNode("/engines/engine/EPR[0]", true)),
|
||||||
|
epr1_node(fgGetNode("/engines/engine[1]/EPR[0]", true)),
|
||||||
|
epr2_node(fgGetNode("/engines/engine[2]/EPR[0]", true)),
|
||||||
|
epr3_node(fgGetNode("/engines/engine[3]/EPR[0]", true)),
|
||||||
|
n10_node(fgGetNode("/engines/engine/N1[0]", true)),
|
||||||
|
n11_node(fgGetNode("/engines/engine[1]/N1[0]", true)),
|
||||||
|
n12_node(fgGetNode("/engines/engine[2]/N1[0]", true)),
|
||||||
|
n13_node(fgGetNode("/engines/engine[3]/N1[0]", true)),
|
||||||
|
n20_node(fgGetNode("/engines/engine/N2[0]", true)),
|
||||||
|
n21_node(fgGetNode("/engines/engine[1]/N2[0]", true)),
|
||||||
|
n22_node(fgGetNode("/engines/engine[2]/N2[0]", true)),
|
||||||
|
n23_node(fgGetNode("/engines/engine[3]/N2[0]", true)),
|
||||||
|
oil_temp0(fgGetNode("engines/engine/oil-temp-degF[0]", true)),
|
||||||
|
oil_temp1(fgGetNode("engines/engine[1]/oil-temp-degF[0]", true)),
|
||||||
|
oil_temp2(fgGetNode("engines/engine[2]/oil-temp-degF[0]", true)),
|
||||||
|
oil_temp3(fgGetNode("engines/engine[3]/oil-temp-degF[0]", true)),
|
||||||
|
tank0_node(fgGetNode("/consumables/fuel/tank/level-lb[0]", true)),
|
||||||
|
tank1_node(fgGetNode("/consumables/fuel/tank[1]/level-lb[0]", true)),
|
||||||
|
tank2_node(fgGetNode("/consumables/fuel/tank[2]/level-lb[0]", true)),
|
||||||
|
tank3_node(fgGetNode("/consumables/fuel/tank[3]/level-lb[0]", true)),
|
||||||
|
tank4_node(fgGetNode("/consumables/fuel/tank[4]/level-lb[0]", true)),
|
||||||
|
tank5_node(fgGetNode("/consumables/fuel/tank[5]/level-lb[0]", true)),
|
||||||
|
tank6_node(fgGetNode("/consumables/fuel/tank[6]/level-lb[0]", true)),
|
||||||
|
tank7_node(fgGetNode("/consumables/fuel/tank[7]/level-lb[0]", true)),
|
||||||
|
p_park_brake(fgGetNode("/controls/gear/brake-parking", true)),
|
||||||
|
p_pitch(fgGetNode("/orientation/pitch-deg[0]", true)),
|
||||||
|
p_bank(fgGetNode("/orientation/roll-deg[0]", true)),
|
||||||
|
p_heading(fgGetNode("/orientation/heading-magnetic-deg[0]", true)),
|
||||||
|
p_yaw(fgGetNode("/fdm/jsbsim/aero/beta-rad[0]", true)),
|
||||||
|
p_yaw_rate(fgGetNode("/fdm/jsbsim/aero/betadot-rad_sec[0]", true))
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -95,35 +127,36 @@ bool FGOpenGC::open() {
|
||||||
void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
|
void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
|
||||||
|
|
||||||
data->version_id = OGC_VERSION;
|
data->version_id = OGC_VERSION;
|
||||||
|
|
||||||
data->longitude = p_longitude->getDoubleValue();
|
data->longitude = p_longitude->getDoubleValue();
|
||||||
data->latitude = p_latitude->getDoubleValue();
|
data->latitude = p_latitude->getDoubleValue();
|
||||||
data->elevation = p_alt_node->getDoubleValue();
|
data->elevation = p_elev_node->getDoubleValue();
|
||||||
data->magvar = mag_var_node->getDoubleValue();
|
data->magvar = magvar_node->getDoubleValue();
|
||||||
|
|
||||||
//cout << "ID: " << OGC_VERSION << " Lon: " << data->longitude << " Lat: " << data->latitude << endl;
|
|
||||||
|
|
||||||
data->pitch = cur_fdm_state->get_Theta_deg();
|
data->pitch = p_pitch->getDoubleValue();
|
||||||
data->bank = cur_fdm_state->get_Phi_deg();
|
data->bank = p_bank->getDoubleValue();
|
||||||
data->heading = cur_fdm_state->get_Psi_deg();
|
data->heading = p_heading->getDoubleValue();
|
||||||
data->altitude = p_altitude->getDoubleValue();
|
//data->altitude = p_altitude->getDoubleValue();
|
||||||
data->altitude_agl = p_altitude_agl->getDoubleValue();
|
data->altitude_agl = p_altitude_agl->getDoubleValue();
|
||||||
data->v_kcas = cur_fdm_state->get_V_calibrated_kts();
|
|
||||||
data->vvi = cur_fdm_state->get_Climb_Rate();
|
data->vvi = p_vvi->getDoubleValue();
|
||||||
data->mach = cur_fdm_state->get_Mach_number();
|
data->mach = p_mach->getDoubleValue();
|
||||||
data->groundspeed = cur_fdm_state->get_V_ground_speed();
|
data->groundspeed = cur_fdm_state->get_V_ground_speed();
|
||||||
data->v_keas = cur_fdm_state->get_V_equiv_kts();
|
data->v_keas = cur_fdm_state->get_V_equiv_kts();
|
||||||
|
data->v_kcas = vel_kcas->getDoubleValue();
|
||||||
|
|
||||||
|
|
||||||
data->phi_dot = cur_fdm_state->get_Phi_dot();
|
data->phi_dot = cur_fdm_state->get_Phi_dot();
|
||||||
data->theta_dot = cur_fdm_state->get_Theta_dot();
|
data->theta_dot = cur_fdm_state->get_Theta_dot();
|
||||||
data->psi_dot = cur_fdm_state->get_Psi_dot();
|
data->psi_dot = cur_fdm_state->get_Psi_dot();
|
||||||
|
|
||||||
data->alpha = cur_fdm_state->get_Alpha();
|
data->alpha = cur_fdm_state->get_Alpha();
|
||||||
data->beta = cur_fdm_state->get_Beta();
|
data->beta = p_yaw->getDoubleValue();
|
||||||
data->alpha_dot = p_alphadot->getDoubleValue();
|
data->alpha_dot = p_alphadot->getDoubleValue();
|
||||||
data->beta_dot = p_betadot->getDoubleValue();
|
data->beta_dot = p_yaw_rate->getDoubleValue();
|
||||||
|
|
||||||
//data->rudder_trim = p_Controls->get_rudder_trim();
|
//data->rudder_trim = p_Controls->get_rudder_trim();
|
||||||
|
data->parking_brake = p_park_brake->getDoubleValue();
|
||||||
|
|
||||||
data->left_aileron = p_left_aileron->getDoubleValue();
|
data->left_aileron = p_left_aileron->getDoubleValue();
|
||||||
data->right_aileron = p_right_aileron->getDoubleValue();
|
data->right_aileron = p_right_aileron->getDoubleValue();
|
||||||
|
@ -133,35 +166,40 @@ void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
|
||||||
data->flaps = p_flaps->getDoubleValue();
|
data->flaps = p_flaps->getDoubleValue();
|
||||||
data->flaps_cmd = p_flaps_cmd->getDoubleValue();
|
data->flaps_cmd = p_flaps_cmd->getDoubleValue();
|
||||||
|
|
||||||
data->gear_nose = fgGetDouble("gear/gear[0]/position-norm");
|
data->gear_nose = fgGetDouble("gear/gear[0]/position-norm[0]");
|
||||||
data->gear_left = fgGetDouble("gear/gear[1]/position-norm");
|
data->gear_left = fgGetDouble("gear/gear[1]/position-norm[0]");
|
||||||
data->gear_right = fgGetDouble("gear/gear[2]/position-norm");
|
data->gear_right = fgGetDouble("gear/gear[2]/position-norm[0]");
|
||||||
data->gear_left_rear = fgGetDouble("gear/gear[3]/position-norm");
|
data->gear_left_rear = fgGetDouble("gear/gear[3]/position-norm[0]");
|
||||||
data->gear_right_rear = fgGetDouble("gear/gear[4]/position-norm");
|
data->gear_right_rear = fgGetDouble("gear/gear[4]/position-norm[0]");
|
||||||
|
data->parking_brake = p_park_brake->getDoubleValue();
|
||||||
|
data->wow_main = fgGetBool("gear/gear[1]/wow[0]") && fgGetBool("gear/gear[2]/wow[0]");
|
||||||
|
data->wow_nose = fgGetBool("gear/gear[0]/wow[0]");
|
||||||
|
//cout << "Nose " << data->wow_nose << " Main " << wow_main << endl;
|
||||||
|
|
||||||
data->rpm[0] = fgGetDouble("/engines/engine[0]/rpm");
|
//data->rpm[0] = fgGetDouble("/engines/engine[0]/rpm");
|
||||||
data->rpm[1] = fgGetDouble("/engines/engine[1]/rpm");
|
//data->rpm[1] = fgGetDouble("/engines/engine[1]/rpm");
|
||||||
|
|
||||||
data->epr[0] = fgGetDouble("/engines/engine[0]/epr");
|
data->epr[0] = epr0_node->getDoubleValue();
|
||||||
data->epr[1] = fgGetDouble("/engines/engine[1]/epr");
|
data->epr[1] = epr1_node->getDoubleValue();
|
||||||
data->epr[2] = fgGetDouble("/engines/engine[2]/epr");
|
data->epr[2] = epr2_node->getDoubleValue();
|
||||||
data->epr[3] = fgGetDouble("/engines/engine[3]/epr");
|
data->epr[3] = epr3_node->getDoubleValue();
|
||||||
|
|
||||||
data->egt[0] = (egt0_node->getDoubleValue() - 32.0) * 0.555;
|
data->egt[0] = egt0_node->getDoubleValue();
|
||||||
data->egt[1] = (egt1_node->getDoubleValue() - 32.0) * 0.555;
|
data->egt[1] = egt1_node->getDoubleValue();
|
||||||
data->egt[2] = (egt2_node->getDoubleValue() - 32.0) * 0.555;
|
data->egt[2] = egt2_node->getDoubleValue();
|
||||||
data->egt[3] = (egt3_node->getDoubleValue() - 32.0) * 0.555;
|
data->egt[3] = egt3_node->getDoubleValue();
|
||||||
|
|
||||||
data->n2_turbine[0] = fgGetDouble("/engines/engine[0]/n2");
|
data->n2_turbine[0] = n20_node->getDoubleValue();
|
||||||
data->n2_turbine[1] = fgGetDouble("/engines/engine[1]/n2");
|
data->n2_turbine[1] = n21_node->getDoubleValue();
|
||||||
data->n2_turbine[2] = fgGetDouble("/engines/engine[2]/n2");
|
data->n2_turbine[2] = n22_node->getDoubleValue();
|
||||||
data->n2_turbine[3] = fgGetDouble("/engines/engine[3]/n2");
|
data->n2_turbine[3] = n23_node->getDoubleValue();
|
||||||
|
|
||||||
data->n1_turbine[0] = fgGetDouble("/engines/engine[0]/n1");
|
data->n1_turbine[0] = n10_node->getDoubleValue();
|
||||||
data->n1_turbine[1] = fgGetDouble("/engines/engine[1]/n1");
|
data->n1_turbine[1] = n11_node->getDoubleValue();
|
||||||
data->n1_turbine[2] = fgGetDouble("/engines/engine[2]/n1");
|
data->n1_turbine[2] = n12_node->getDoubleValue();
|
||||||
data->n1_turbine[3] = fgGetDouble("/engines/engine[3]/n1");
|
data->n1_turbine[3] = n13_node->getDoubleValue();
|
||||||
// the units for turbine engines is lbs/hr divide by 6.5 to convert to gph if piston type
|
|
||||||
|
// This is really lbs/hr (pph), converted in FGSimTurbine
|
||||||
data->fuel_flow[0] = fgGetDouble("/engines/engine[0]/fuel-flow-gph");
|
data->fuel_flow[0] = fgGetDouble("/engines/engine[0]/fuel-flow-gph");
|
||||||
data->fuel_flow[1] = fgGetDouble("/engines/engine[1]/fuel-flow-gph");
|
data->fuel_flow[1] = fgGetDouble("/engines/engine[1]/fuel-flow-gph");
|
||||||
data->fuel_flow[2] = fgGetDouble("/engines/engine[2]/fuel-flow-gph");
|
data->fuel_flow[2] = fgGetDouble("/engines/engine[2]/fuel-flow-gph");
|
||||||
|
@ -172,33 +210,65 @@ void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
|
||||||
data->oil_pressure[2] = fgGetDouble("/engines/engine[2]/oil-pressure-psi");
|
data->oil_pressure[2] = fgGetDouble("/engines/engine[2]/oil-pressure-psi");
|
||||||
data->oil_pressure[3] = fgGetDouble("/engines/engine[3]/oil-pressure-psi");
|
data->oil_pressure[3] = fgGetDouble("/engines/engine[3]/oil-pressure-psi");
|
||||||
|
|
||||||
data->oil_temp[0] = fgGetDouble("/engines/engine[0]/OilTemp_degK");
|
//data->oil_temp[0] = fgGetDouble("/engines/engine[0]/oil-temperature-degf");
|
||||||
data->oil_temp[1] = fgGetDouble("/engines/engine[1]/OilTemp_degK");
|
//data->oil_temp[1] = fgGetDouble("/engines/engine[1]/oil-temperature-degf");
|
||||||
data->oil_temp[2] = fgGetDouble("/engines/engine[2]/OilTemp_degK");
|
//data->oil_temp[2] = fgGetDouble("/engines/engine[2]/oil-temperature-degf");
|
||||||
data->oil_temp[3] = fgGetDouble("/engines/engine[3]/OilTemp_degK");
|
//data->oil_temp[3] = fgGetDouble("/engines/engine[3]/oil-temperature-degf");
|
||||||
// dummy value to fill data packet
|
|
||||||
data->oil_quantity[0] = fgGetDouble("/engines/engine[0]/oil-quantity");
|
|
||||||
data->oil_quantity[1] = fgGetDouble("/engines/engine[1]/oil-quantity");
|
|
||||||
data->oil_quantity[2] = fgGetDouble("/engines/engine[2]/oil-quantity");
|
|
||||||
data->oil_quantity[3] = fgGetDouble("/engines/engine[3]/oil-quantity");
|
|
||||||
data->oil_quantity[0] = 40.3; data->oil_quantity[1] = 44.6;
|
|
||||||
|
|
||||||
data->hyd_pressure[0] = fgGetDouble("/engines/engine[0]/hyd-pressure-psi");
|
data->oil_temp[0] = oil_temp0->getDoubleValue();
|
||||||
data->hyd_pressure[1] = fgGetDouble("/engines/engine[1]/hyd-pressure-psi");
|
data->oil_temp[1] = oil_temp1->getDoubleValue();
|
||||||
data->hyd_pressure[2] = fgGetDouble("/engines/engine[2]/hyd-pressure-psi");
|
data->oil_temp[2] = oil_temp2->getDoubleValue();
|
||||||
data->hyd_pressure[3] = fgGetDouble("/engines/engine[3]/hyd-pressure-psi");
|
data->oil_temp[3] = oil_temp3->getDoubleValue();
|
||||||
data->hyd_pressure[0] = 3215.0; data->hyd_pressure[1] = 3756.0;
|
|
||||||
|
|
||||||
data->man_pressure[0] = fgGetDouble("/engines/engine[0]/mp-osi");
|
data->hyd_pressure[0] = fgGetDouble("/engines/engine[0]/hyd-pressure-psi");
|
||||||
data->man_pressure[1] = fgGetDouble("/engines/engine[1]/mp-osi");
|
data->hyd_pressure[1] = fgGetDouble("/engines/engine[1]/hyd-pressure-psi");
|
||||||
|
data->hyd_pressure[2] = fgGetDouble("/engines/engine[2]/hyd-pressure-psi");
|
||||||
data->tank[0] = fgGetDouble("/consumables/fuel/tank[2]/level-gal_us") * 6.6;
|
data->hyd_pressure[3] = fgGetDouble("/engines/engine[3]/hyd-pressure-psi");
|
||||||
data->tank[1] = fgGetDouble("/consumables/fuel/tank/level-gal_us") * 6.6;
|
// just a temp thing until htdraulic model built
|
||||||
data->tank[2] = fgGetDouble("/consumables/fuel/tank[1]/level-gal_us") * 6.6;
|
// data->hyd_pressure[0] = 2750.0;
|
||||||
//data->tank[0] = 3000.0;
|
// data->hyd_pressure[1] = 2755.0;
|
||||||
//data->tank[1] = 9800.0;
|
// data->hyd_pressure[2] = 2747.0;
|
||||||
//data->tank[2] = 9800.0;
|
// data->hyd_pressure[3] = 2851.0;
|
||||||
|
|
||||||
|
|
||||||
|
//data->man_pressure[0] = fgGetDouble("/engines/engine[0]/mp-osi");
|
||||||
|
//data->man_pressure[1] = fgGetDouble("/engines/engine[1]/mp-osi");
|
||||||
|
|
||||||
|
data->fuel_tank[0] = tank0_node->getDoubleValue() * 0.001;
|
||||||
|
data->fuel_tank[1] = tank1_node->getDoubleValue() * 0.001;
|
||||||
|
data->fuel_tank[2] = tank2_node->getDoubleValue() * 0.001;
|
||||||
|
data->fuel_tank[3] = tank3_node->getDoubleValue() * 0.001;
|
||||||
|
data->fuel_tank[4] = tank4_node->getDoubleValue() * 0.001;
|
||||||
|
data->fuel_tank[5] = tank5_node->getDoubleValue() * 0.001; // 747 stab tank
|
||||||
|
data->fuel_tank[6] = tank6_node->getDoubleValue() * 0.001; // 747 res2 tank
|
||||||
|
data->fuel_tank[7] = tank7_node->getDoubleValue() * 0.001; // 747 res3 tank
|
||||||
|
double total_fuel = 0.0;
|
||||||
|
for ( int t= 0; t<8; t++ ) total_fuel += data->fuel_tank[t];
|
||||||
|
data->fuel_tank[8] = total_fuel;
|
||||||
|
//data->fuel_tank[8] = 386000.0; // total fuel load
|
||||||
|
//cout << endl << "Send " << data->fuel_tank[0] << endl;
|
||||||
|
/*********
|
||||||
|
data->boost_pumps[0] = boost1_node->getBoolValue();
|
||||||
|
data->boost_pumps[1] = boost2_node->getBoolValue();
|
||||||
|
data->boost_pumps[2] = boost3_node->getBoolValue();
|
||||||
|
data->boost_pumps[3] = boost4_node->getBoolValue();
|
||||||
|
data->boost_pumps[4] = boost5_node->getBoolValue();
|
||||||
|
data->boost_pumps[5] = boost6_node->getBoolValue();
|
||||||
|
data->boost_pumps[6] = boost7_node->getBoolValue();
|
||||||
|
data->boost_pumps[7] = boost8_node->getBoolValue();
|
||||||
|
|
||||||
|
data->over_ride_pumps[0] = ovride0_node->getBoolValue();
|
||||||
|
data->over_ride_pumps[1] = ovride1_node->getBoolValue();
|
||||||
|
data->over_ride_pumps[2] = ovride2_node->getBoolValue();
|
||||||
|
data->over_ride_pumps[3] = ovride3_node->getBoolValue();
|
||||||
|
data->over_ride_pumps[4] = ovride4_node->getBoolValue();
|
||||||
|
data->over_ride_pumps[5] = ovride5_node->getBoolValue();
|
||||||
|
|
||||||
|
data->x_feed_valve[0] = x_feed0_node->getBoolValue();
|
||||||
|
data->x_feed_valve[1] = x_feed1_node->getBoolValue();
|
||||||
|
data->x_feed_valve[2] = x_feed2_node->getBoolValue();
|
||||||
|
data->x_feed_valve[3] = x_feed3_node->getBoolValue();
|
||||||
|
**********/
|
||||||
data->total_temperature = cur_fdm_state->get_Total_temperature();
|
data->total_temperature = cur_fdm_state->get_Total_temperature();
|
||||||
data->total_pressure = cur_fdm_state->get_Total_pressure();
|
data->total_pressure = cur_fdm_state->get_Total_pressure();
|
||||||
data->dynamic_pressure = cur_fdm_state->get_Dynamic_pressure();
|
data->dynamic_pressure = cur_fdm_state->get_Dynamic_pressure();
|
||||||
|
@ -207,6 +277,7 @@ void FGOpenGC::collect_data( const FGInterface *fdm, ogcFGData *data ) {
|
||||||
data->static_temperature = temp_node->getDoubleValue();
|
data->static_temperature = temp_node->getDoubleValue();
|
||||||
data->wind = wind_speed_node->getDoubleValue();
|
data->wind = wind_speed_node->getDoubleValue();
|
||||||
data->wind_dir = wind_dir_node->getDoubleValue();
|
data->wind_dir = wind_dir_node->getDoubleValue();
|
||||||
|
data->sea_level_pressure = fgGetDouble("/environment/sea-level-pressure-inhg");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void distribute_data( const ogcFGData *data, FGInterface *chunk ) {
|
static void distribute_data( const ogcFGData *data, FGInterface *chunk ) {
|
||||||
|
@ -223,7 +294,7 @@ bool FGOpenGC::process() {
|
||||||
collect_data( cur_fdm_state, &buf );
|
collect_data( cur_fdm_state, &buf );
|
||||||
//collect_data( &buf );
|
//collect_data( &buf );
|
||||||
if ( ! io->write( (char *)(& buf), length ) ) {
|
if ( ! io->write( (char *)(& buf), length ) ) {
|
||||||
SG_LOG( SG_IO, SG_WARN, "Error writing data." );
|
SG_LOG( SG_IO, SG_ALERT, "Error writing data." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if ( get_direction() == SG_IO_IN ) {
|
} else if ( get_direction() == SG_IO_IN ) {
|
||||||
|
|
|
@ -46,20 +46,27 @@ class FGOpenGC : public FGProtocol, public FGInterface {
|
||||||
SGPropertyNode *temp_node;
|
SGPropertyNode *temp_node;
|
||||||
SGPropertyNode *wind_dir_node;
|
SGPropertyNode *wind_dir_node;
|
||||||
SGPropertyNode *wind_speed_node;
|
SGPropertyNode *wind_speed_node;
|
||||||
SGPropertyNode *mag_var_node;
|
SGPropertyNode *magvar_node;
|
||||||
|
|
||||||
// Position
|
// Position on the Geod
|
||||||
SGPropertyNode *p_latitude;
|
SGPropertyNode *p_latitude;
|
||||||
SGPropertyNode *p_longitude;
|
SGPropertyNode *p_longitude;
|
||||||
SGPropertyNode *p_alt_node;
|
SGPropertyNode *p_elev_node;
|
||||||
SGPropertyNode *p_altitude;
|
//SGPropertyNode *p_altitude;
|
||||||
SGPropertyNode *p_altitude_agl;
|
SGPropertyNode *p_altitude_agl;
|
||||||
|
|
||||||
SGPropertyNode *egt0_node;
|
// Orientation
|
||||||
SGPropertyNode *egt1_node;
|
SGPropertyNode *p_pitch;
|
||||||
SGPropertyNode *egt2_node;
|
SGPropertyNode *p_bank;
|
||||||
SGPropertyNode *egt3_node;
|
SGPropertyNode *p_heading;
|
||||||
|
SGPropertyNode *p_yaw;
|
||||||
|
SGPropertyNode *p_yaw_rate;
|
||||||
|
|
||||||
|
// Flight Parameters
|
||||||
|
SGPropertyNode *vel_kcas;
|
||||||
|
SGPropertyNode *p_vvi;
|
||||||
|
SGPropertyNode *p_mach;
|
||||||
|
|
||||||
// Control surfaces
|
// Control surfaces
|
||||||
SGPropertyNode *p_left_aileron;
|
SGPropertyNode *p_left_aileron;
|
||||||
SGPropertyNode *p_right_aileron;
|
SGPropertyNode *p_right_aileron;
|
||||||
|
@ -69,6 +76,67 @@ class FGOpenGC : public FGProtocol, public FGInterface {
|
||||||
SGPropertyNode *p_flaps;
|
SGPropertyNode *p_flaps;
|
||||||
SGPropertyNode *p_flaps_cmd;
|
SGPropertyNode *p_flaps_cmd;
|
||||||
|
|
||||||
|
// GEAR System
|
||||||
|
SGPropertyNode *p_park_brake;
|
||||||
|
|
||||||
|
// Engines
|
||||||
|
SGPropertyNode *egt0_node;
|
||||||
|
SGPropertyNode *egt1_node;
|
||||||
|
SGPropertyNode *egt2_node;
|
||||||
|
SGPropertyNode *egt3_node;
|
||||||
|
|
||||||
|
SGPropertyNode *epr0_node;
|
||||||
|
SGPropertyNode *epr1_node;
|
||||||
|
SGPropertyNode *epr2_node;
|
||||||
|
SGPropertyNode *epr3_node;
|
||||||
|
|
||||||
|
SGPropertyNode *n10_node;
|
||||||
|
SGPropertyNode *n11_node;
|
||||||
|
SGPropertyNode *n12_node;
|
||||||
|
SGPropertyNode *n13_node;
|
||||||
|
|
||||||
|
SGPropertyNode *n20_node;
|
||||||
|
SGPropertyNode *n21_node;
|
||||||
|
SGPropertyNode *n22_node;
|
||||||
|
SGPropertyNode *n23_node;
|
||||||
|
|
||||||
|
SGPropertyNode *oil_temp0;
|
||||||
|
SGPropertyNode *oil_temp1;
|
||||||
|
SGPropertyNode *oil_temp2;
|
||||||
|
SGPropertyNode *oil_temp3;
|
||||||
|
|
||||||
|
// Fuel System
|
||||||
|
SGPropertyNode *tank0_node;
|
||||||
|
SGPropertyNode *tank1_node;
|
||||||
|
SGPropertyNode *tank2_node;
|
||||||
|
SGPropertyNode *tank3_node;
|
||||||
|
SGPropertyNode *tank4_node;
|
||||||
|
SGPropertyNode *tank5_node;
|
||||||
|
SGPropertyNode *tank6_node;
|
||||||
|
SGPropertyNode *tank7_node;
|
||||||
|
// Boost pumps; Center tank has only override pumps; boosts are in the
|
||||||
|
// four main wing tanks 1->4
|
||||||
|
// SGPropertyNode *boost1_node;
|
||||||
|
// SGPropertyNode *boost2_node;
|
||||||
|
// SGPropertyNode *boost3_node;
|
||||||
|
// SGPropertyNode *boost4_node;
|
||||||
|
// SGPropertyNode *boost5_node;
|
||||||
|
// SGPropertyNode *boost6_node;
|
||||||
|
// SGPropertyNode *boost7_node;
|
||||||
|
// SGPropertyNode *boost8_node;
|
||||||
|
// Override pumps
|
||||||
|
// SGPropertyNode *ovride0_node;
|
||||||
|
// SGPropertyNode *ovride1_node;
|
||||||
|
// SGPropertyNode *ovride2_node;
|
||||||
|
// SGPropertyNode *ovride3_node;
|
||||||
|
// SGPropertyNode *ovride4_node;
|
||||||
|
// SGPropertyNode *ovride5_node;
|
||||||
|
// X_Feed valves
|
||||||
|
// SGPropertyNode *x_feed0_node;
|
||||||
|
// SGPropertyNode *x_feed1_node;
|
||||||
|
// SGPropertyNode *x_feed2_node;
|
||||||
|
// SGPropertyNode *x_feed3_node;
|
||||||
|
|
||||||
// Aero numbers
|
// Aero numbers
|
||||||
SGPropertyNode *p_alphadot;
|
SGPropertyNode *p_alphadot;
|
||||||
SGPropertyNode *p_betadot;
|
SGPropertyNode *p_betadot;
|
||||||
|
|
|
@ -97,8 +97,10 @@ public:
|
||||||
double gear_left;
|
double gear_left;
|
||||||
double gear_right;
|
double gear_right;
|
||||||
double gear_left_rear;
|
double gear_left_rear;
|
||||||
double gear_right_rear;
|
double gear_right_rear;
|
||||||
|
double parking_brake;
|
||||||
|
bool wow_main; // logical and of main gear
|
||||||
|
bool wow_nose;
|
||||||
// engine data
|
// engine data
|
||||||
|
|
||||||
double rpm[4]; // this is for pistons, jets see below
|
double rpm[4]; // this is for pistons, jets see below
|
||||||
|
@ -117,8 +119,8 @@ public:
|
||||||
double prop_advance[4];
|
double prop_advance[4];
|
||||||
|
|
||||||
// fuel system
|
// fuel system
|
||||||
double main_tank;
|
int num_tanks;
|
||||||
double tank[4];
|
double fuel_tank[9];
|
||||||
|
|
||||||
// Pressures and temperatures
|
// Pressures and temperatures
|
||||||
|
|
||||||
|
@ -131,6 +133,7 @@ public:
|
||||||
// more environmental data
|
// more environmental data
|
||||||
double wind;
|
double wind;
|
||||||
double wind_dir;
|
double wind_dir;
|
||||||
|
double sea_level_pressure;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _OPENGC_HXX
|
#endif // _OPENGC_HXX
|
||||||
|
|
Loading…
Add table
Reference in a new issue