]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/LaRCsim.cxx
First commit of properties code. JSBSim now has a basic property tree all
[flightgear.git] / src / FDM / LaRCsim.cxx
index 9d70641cb7967897e74f1b0bafdf26626e16dcd2..e24ca735d765964cc8eb692095203caa7b0a4c6d 100644 (file)
@@ -45,10 +45,10 @@ FGLaRCsim::FGLaRCsim( double dt ) {
     speed_up = fgGetNode("/sim/speed-up", true);
     aero = fgGetNode("/sim/aero", true);
 
-    ls_toplevel_init( 0.0, (char *)(aero->getStringValue().c_str()) );
+    ls_toplevel_init( 0.0, (char *)(aero->getStringValue()) );
 
     lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is
-    if ( aero->getStringValue() == "c172" ) {
+    if ( string(aero->getStringValue()) == "c172" ) {
         copy_to_LaRCsim(); // initialize all of LaRCsim's vars
 
         //this should go away someday -- formerly done in fg_init.cxx
@@ -85,7 +85,7 @@ void FGLaRCsim::init() {
 // Run an iteration of the EOM (equations of motion)
 void FGLaRCsim::update( int multiloop ) {
 
-    if ( aero->getStringValue() == "c172" ) {
+    if ( string(aero->getStringValue()) == "c172" ) {
        // set control inputs
        // cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
        eng.set_IAS( V_calibrated_kts );
@@ -102,6 +102,22 @@ void FGLaRCsim::update( int multiloop ) {
        // update engine model
        eng.update();
 
+       // Fake control-surface positions
+       fgSetDouble("/surface-positions/flap-pos-norm",
+                   fgGetDouble("/controls/flaps"));
+                               // FIXME: ignoring trim
+       fgSetDouble("/surface-positions/elevator-pos-norm",
+                   fgGetDouble("/controls/elevator"));
+                               // FIXME: ignoring trim
+       fgSetDouble("/surface-positions/left-aileron-pos-norm",
+                   fgGetDouble("/controls/aileron"));
+                               // FIXME: ignoring trim
+       fgSetDouble("/surface-positions/right-aileron-pos-norm",
+                   -1 * fgGetDouble("/controls/aileron"));
+                               // FIXME: ignoring trim
+       fgSetDouble("/surface-positions/rudder-pos-norm",
+                   fgGetDouble("/controls/rudder"));
+
        // copy engine state values onto "bus"
        fgSetDouble("/engines/engine/rpm", eng.get_RPM());
        fgSetDouble("/engines/engine/mp-osi", eng.get_Manifold_Pressure());
@@ -153,7 +169,7 @@ void FGLaRCsim::update( int multiloop ) {
         speed_up->getIntValue();
     Flap_handle = 30.0 * globals->get_controls()->get_flaps();
 
-    if ( aero->getStringValue() == "c172" ) {
+    if ( string(aero->getStringValue()) == "c172" ) {
         Use_External_Engine = 1;
     } else {
        Use_External_Engine = 0;
@@ -523,7 +539,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
     _set_Climb_Rate( -1 * V_down );
     // cout << "climb rate = " << -V_down * 60 << endl;
 
-    if ( aero->getStringValue() == "uiuc" ) {
+    if ( string(aero->getStringValue()) == "uiuc" ) {
        if (pilot_elev_no) {
            globals->get_controls()->set_elevator(Long_control);
            globals->get_controls()->set_elevator_trim(Long_trim);