Declare external reactions in C++ code, rather than in XML configuration. #1204
Replies: 2 comments
-
// Ok, here! How would I declare an External Reaction?
shared_ptr<JSBSim::FGExternalReactions> ptr = f.GetExternalReactions(); // Is this a step in right direction?
ptr->Load(someXmlElement); // This does not work, my compiler complains I'm doing something wrong. These lines look good to me however you should call them after your model has been loaded i.e. after If that does not help, it would be helpful to provide the error message that your compiler is returning. |
Beta Was this translation helpful? Give feedback.
-
The issue I was having was with my #include statements. I had to be ensure to have
Here's what I am doing with my code so that I can access the external reaction location, vector, and magnitude, and modify it during the simulation in accordance with my simulation:
My simulation appears to be doing what I want, but I'm wary of trusting the results when I'm being given warning messages like this. Any ideas on what the the warnings could be about, and how to fix them? |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I'm embedding JSBSim inside another program for a project I am working on involving aircraft towing systems. To get this to work, it would be very nice to be able to declare an External Reaction via the C++ code rather than in the XML configuration files. I've read through the documentation on the FGExternalReactions, which indicates that this should be possible, but alas, I cannot figure out how.
I've tried accessing the FGExternalReactions through the GetExternalReactions from the FGFDMExec class. But I can't seem to do anything with it once I have it without causing my code to not compile. I believe I should be able to call the Load() method to initialize an external reaction from an XML element. But I can't seem to call this method without causing my code to fail to compile.
Any help in solving this issue would be much appreciated. I'm willing to accept the answer of "just use the XML configuration files" if there's no good way to do this, I just want to explore this avenue first, as I believe it will make the workflow of my project cleaner. Thank you very much for your time.
Beta Was this translation helpful? Give feedback.
All reactions