#include <simgear/compiler.h>
+#include <FDM/LaRCsim/ls_types.h>
+
#include <map>
#include STL_IOSTREAM
#include <math.h>
#define gear_map aircraft_->gear_map
#define MAX_GEAR 16
bool gear_model[MAX_GEAR];
- double D_gear_v[MAX_GEAR][3];
- double cgear[MAX_GEAR];
- double kgear[MAX_GEAR];
- double muGear[MAX_GEAR];
- double strutLength[MAX_GEAR];
+ SCALAR D_gear_v[MAX_GEAR][3];
+ SCALAR cgear[MAX_GEAR];
+ SCALAR kgear[MAX_GEAR];
+ SCALAR muGear[MAX_GEAR];
+ SCALAR strutLength[MAX_GEAR];
#define D_gear_v aircraft_->D_gear_v
#define gear_model aircraft_->gear_model
#define cgear aircraft_->cgear
void
FGInterface::bind ()
{
- // Time management
+ // Time management (read-only)
fgTie("/fdm/time/delta_t", this,
- &FGInterface::get_delta_t);
-
- // The following two can't be uncommented until we have support for
- // the "long" data type in the property manager
- /* fgTie("/fdm/time/elapsed", this,
- &FGInterface::get_elapsed);
+ &FGInterface::get_delta_t); // read-only
+ fgTie("/fdm/time/elapsed", this,
+ &FGInterface::get_elapsed); // read-only
fgTie("/fdm/time/remainder", this,
- &FGInterface::get_remainder); */
+ &FGInterface::get_remainder); // read-only
fgTie("/fdm/time/multi_loop", this,
- &FGInterface::get_multi_loop);
+ &FGInterface::get_multi_loop); // read-only
// Aircraft position
fgTie("/position/latitude", this,
return globals->get_props()->getIntValue(name, defaultValue);
}
+inline int fgGetLong (const string &name, long defaultValue = 0L)
+{
+ return globals->get_props()->getLongValue(name, defaultValue);
+}
+
inline float fgGetFloat (const string &name, float defaultValue = 0.0)
{
return globals->get_props()->getFloatValue(name, defaultValue);
return globals->get_props()->setIntValue(name, val);
}
+inline bool fgSetLong (const string &name, long val)
+{
+ return globals->get_props()->setLongValue(name, val);
+}
+
inline bool fgSetFloat (const string &name, float val)
{
return globals->get_props()->setFloatValue(name, val);
"Failed to tie property " << name << " to a pointer");
}
+inline void
+fgTie (const string &name, long *pointer, bool useDefault = true)
+{
+ if (!globals->get_props()->tie(name, SGRawValuePointer<long>(pointer),
+ useDefault))
+ SG_LOG(SG_GENERAL, SG_WARN,
+ "Failed to tie property " << name << " to a pointer");
+}
+
inline void
fgTie (const string &name, float *pointer, bool useDefault = true)
{
acmodel_selector = new ssgSelector;
acmodel_pos = new ssgTransform;
+ // Get the model location, and load textures from the same
+ // directory. Use an absolute path for the model to avoid
+ // incompatibilities in different versions of PLIB.
string acmodel_path =
fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
-
- string full_model = globals->get_fg_root() + "/"
- + acmodel_path;
- int pos = full_model.rfind("/");
-
- SGPath texturepath( full_model.substr(0, pos) );
- cout << "Texture path = " << texturepath.str() << endl;
- ssgTexturePath( (char *)texturepath.c_str() );
-
- ssgEntity *acmodel_obj = ssgLoad((char *)(acmodel_path.c_str()));
+ SGPath full_model = globals->get_fg_root();
+ full_model.append(acmodel_path);
+ // this should be redundant...
+ ssgModelPath( (char *)full_model.dir().c_str() );
+ ssgTexturePath( (char *)full_model.dir().c_str() );
+ ssgEntity *acmodel_obj = ssgLoad( (char *)full_model.c_str() );
// find moving parts (if this is an MDL model)
flaps_selector = (ssgSelector*)fgFindNode( acmodel_obj, "FLAPS" );