> With the potential of exposing my C++ knowledge deficiency, I'll explain how
> far I got ;-)
> As mentioned in the last post, I have two variables I can access through the
> existing code I have.
> One variable is cur_fdm_state which is of type FGInterface. FGInterface is a
> parent class of JSBSim so accessing accessing the said 'get_fdmex()' method
> isn't easily done. I tried declaring a virtual method in FGInterface and
> defining it in JSBSim, but this only got ugly. The other variable is
> 'globals', but I haven't had much luck here either.
> With your knowledge of flightgear, do you know if it is possible to access
> methods from the JSBSim object via either of these variables? If so, could
> you provide suggestions?

In FGJSBSim (the JSBSim object derived from FGInterface) there is a private 
member called
Aerodynamics that points to the FGAerodynamics object of JSBSim. If you have 
your own
"cur_fdm_state" object, however, the Aerodynamics object won't be accessible 
unless you
change the Aerodynamics object to be protected instead of private, or unless 
you provide a
getter such as GetAerodynamics() that returns the pointer to the Aerodynamics 
object.
Then, you could simply do:

my_string = cur_fdm_object->Aerodynamics->GetCoefficientStrings(delimiter);

-or-

my_string = cur_fdm_object->GetAerodynamics()->GetCoefficientStrings(delimiter);

> With the other option of using the XML file, could you give me an example of
> how the values would be retrieved?

  <output name="localhost" type="SOCKET" port="1139" rate="10">
      <coefficients> ON </coefficients>
  </output>

If you were to do the above (i.e. place it in your aircraft config file) you 
would have to
have a listening socket somewhere ready to receive the data. In another shell 
window you
could type:

nc -l -p 1139

to listen to the data output by the sim. I've only done this with JSBSim 
standalone - not
with FlightGear.

Jon


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to