1
0
Fork 0

Vivian MEAZZA:

" Make a couple of minor adjustments to Harald's weather radar code, make
elevation work in the radar code, and add station ident to the TACAN code"
This commit is contained in:
mfranz 2006-06-09 18:29:51 +00:00
parent 20076aa2b9
commit 4db6e924fe
5 changed files with 29 additions and 7 deletions

View file

@ -210,6 +210,7 @@ void FGAIBase::bind() {
props->tie("radar/x-shift", SGRawValuePointer<double>(&x_shift));
props->tie("radar/y-shift", SGRawValuePointer<double>(&y_shift));
props->tie("radar/rotation", SGRawValuePointer<double>(&rotation));
props->tie("radar/ht-diff-ft", SGRawValuePointer<double>(&ht_diff));
props->tie("controls/lighting/nav-lights",
SGRawValueFunctions<bool>(_isNight));
@ -240,6 +241,7 @@ void FGAIBase::unbind() {
props->untie("radar/x-shift");
props->untie("radar/y-shift");
props->untie("radar/rotation");
props->untie("radar/ht-diff-ft");
props->untie("controls/lighting/nav-lights");
}
@ -298,11 +300,10 @@ double FGAIBase::UpdateRadar(FGAIManager* manager)
if (horiz_offset < -180.0) horiz_offset += 360.0;
// calculate elevation to target
elevation = atan2( altitude * SG_METER_TO_FEET - user_altitude, range_ft )
* SG_RADIANS_TO_DEGREES;
elevation = atan2( altitude - user_altitude, range_ft ) * SG_RADIANS_TO_DEGREES;
// calculate look up/down to target
vert_offset = elevation + user_pitch;
vert_offset = elevation - user_pitch;
/* this calculation needs to be fixed, but it isn't important anyway
// calculate range rate
@ -323,6 +324,7 @@ double FGAIBase::UpdateRadar(FGAIManager* manager)
x_shift = range * sin( horiz_offset * SG_DEGREES_TO_RADIANS);
rotation = hdg - user_heading;
if (rotation < 0.0) rotation += 360.0;
ht_diff = altitude - user_altitude;
}

View file

@ -116,7 +116,7 @@ protected:
double x_shift; // value used by radar display instrument
double y_shift; // value used by radar display instrument
double rotation; // value used by radar display instrument
double ht_diff; // value used by radar display instrument
string model_path; //Path to the 3D model
ssgSharedPtr<ssgBranch> model; //The 3D model object

View file

@ -111,6 +111,7 @@ TACAN::init ()
_yaw_node = fgGetNode("/orientation/side-slip-deg", true);
_serviceable_node = node->getChild("serviceable", 0, true);
_electrical_node = fgGetNode("/systems/electrical/outputs/tacan", true);
_ident_node = node->getChild("ident", 0, true);
SGPropertyNode *fnode = node->getChild("frequencies", 0, true);
_source_node = fnode->getChild("source", 0, true);
_frequency_node = fnode->getChild("selected-mhz", 0, true);
@ -245,6 +246,8 @@ TACAN::update (double delta_time_sec)
_transmitter_bias = _mobile_bias;
_transmitter_name = _mobile_name;
_name_node->setStringValue(_transmitter_name.c_str());
_transmitter_ident = _mobile_ident;
_ident_node->setStringValue(_transmitter_ident.c_str());
_channel_node->setStringValue(_channel.c_str());
}
@ -324,6 +327,8 @@ TACAN::update (double delta_time_sec)
_rotation_node->setDoubleValue(0);
_transmitter_name = "";
_name_node->setStringValue(_transmitter_name.c_str());
_transmitter_ident = "";
_ident_node->setStringValue(_transmitter_ident.c_str());
_channel_node->setStringValue(_channel.c_str());
return;
}
@ -372,6 +377,7 @@ TACAN::search (double frequency_mhz, double longitude_rad,
_mobile_range_nm = mobile_tacan->get_range();
_mobile_bias = mobile_tacan->get_multiuse();
_mobile_name = mobile_tacan->get_name();
_mobile_ident = mobile_tacan->get_trans_ident();
_mobile_valid = true;
SG_LOG( SG_INSTR, SG_DEBUG, " carrier transmitter valid " << _mobile_valid );
break;
@ -411,6 +417,7 @@ TACAN::search (double frequency_mhz, double longitude_rad,
_mobile_range_nm = mobile_tacan->get_range();
_mobile_bias = mobile_tacan->get_multiuse();
_mobile_name = mobile_tacan->get_name();
_mobile_ident = mobile_tacan->get_trans_ident();
_mobile_valid = true;
SG_LOG( SG_INSTR, SG_DEBUG, " tanker transmitter valid " << _mobile_valid );
break;
@ -452,6 +459,7 @@ TACAN::search (double frequency_mhz, double longitude_rad,
_mobile_range_nm = mobile_tacan->get_range();
_mobile_bias = mobile_tacan->get_multiuse();
_mobile_name = mobile_tacan->get_name();
_mobile_ident = mobile_tacan->get_trans_ident();
_mobile_valid = true;
SG_LOG( SG_INSTR, SG_DEBUG, " mp tanker transmitter valid " << _mobile_valid );
@ -488,6 +496,8 @@ TACAN::search (double frequency_mhz, double longitude_rad,
_transmitter_bias = tacan->get_multiuse();
_transmitter_name = tacan->get_name();
_name_node->setStringValue(_transmitter_name.c_str());
_transmitter_ident = tacan->get_trans_ident();
_ident_node->setStringValue(_transmitter_ident.c_str());
SG_LOG( SG_INSTR, SG_DEBUG, "name " << _transmitter_name);
SG_LOG( SG_INSTR, SG_DEBUG, "lat " << _transmitter_lat << "lon " << _transmitter_lon);

View file

@ -68,6 +68,9 @@ private:
SGPropertyNode_ptr _x_shift_node;
SGPropertyNode_ptr _y_shift_node;
SGPropertyNode_ptr _rotation_node;
/*SGPropertyNode_ptr _x_shift_calibration_node;
SGPropertyNode_ptr _y_shift_calibration_node;
SGPropertyNode_ptr _distance_calibration_node;*/
SGPropertyNode_ptr _in_range_node;
SGPropertyNode_ptr _distance_node;
@ -97,6 +100,7 @@ private:
double _transmitter_bearing_deg;
double _transmitter_bias;
string _transmitter_name;
string _transmitter_ident;
double _mobile_lat, _mobile_lon;
double _mobile_elevation_ft;
@ -104,6 +108,7 @@ private:
double _mobile_bearing_deg;
double _mobile_bias;
string _mobile_name;
string _mobile_ident;
string name;
int num;

View file

@ -159,6 +159,7 @@ wxRadarBg::update (double delta_time_sec)
// find something interesting to do...
} else {
string display_mode = _Instrument->getStringValue("display-mode", "arc");
// pretend we have a scan angle bigger then the FOV
// TODO:check real fov, enlarge if < nn, and do clipping if > mm
const float fovFactor = 1.45f;
@ -172,7 +173,7 @@ wxRadarBg::update (double delta_time_sec)
// float view_heading = get_track() * SG_DEGREES_TO_RADIANS;
} else if( display_mode == "plan" ) {
// no sense I presume
float view_heading = 0.0;
view_heading = 0;
} else {
// rose
}
@ -276,10 +277,13 @@ wxRadarBg::update (double delta_time_sec)
---------
*/
float yOffset = 180.0f, xOffset = 256.0f;
if( display_mode != "arc" ) {
yOffset = 40.0f;
xOffset = 240.0f;
}
if ( display_mode != "plan" ) {
glDisable(GL_BLEND);
glColor4f(1.0f, 0.0f, 0.0f, 0.01f);
glBegin( GL_QUADS );
@ -301,11 +305,11 @@ wxRadarBg::update (double delta_time_sec)
glBegin( GL_TRIANGLES );
glVertex2f(0.0, 0.0);
glVertex2f(-256.0, 0.0);
glVertex2f(-256.0, 256.0);
glVertex2f(-256.0, 256.0 * tan(30*SG_DEGREES_TO_RADIANS));
glVertex2f(0.0, 0.0);
glVertex2f(256.0, 0.0);
glVertex2f(256.0, 256.0);
glVertex2f(256.0, 256.0 * tan(30*SG_DEGREES_TO_RADIANS));
glVertex2f(-256, 0.0);
glVertex2f(256.0, 0.0);
@ -315,6 +319,7 @@ wxRadarBg::update (double delta_time_sec)
glVertex2f(256.0, -256.0);
glVertex2f(-256.0, -256.0);
glEnd();
}
// DEBUG only
/* glColor4f(1.0f, 0.0f, 0.0f, 1.0f);