Advanced Question Possibility of using Matlab to implement GNC functions ?

keudon

New member
Joined
Apr 17, 2013
Messages
1
Reaction score
0
Points
0
Hello everyone !

First of all, I must say Orbiter flight simulator is a brilliant project, and as an aerospace engineer, I really admire all the work behind it... :thumbup:

So, I have been using Orbiter Flight Simulator for some time as a hobby and there is something that I've been wondering about. I'm currently working for a huge EU company (manufacturing, among others, european spaceships :tiphat:)

One of my activity is to design control laws for orbital manoeuvers and attitude control (including homing, closing, formation flight etc...). I was curious if that would be possible to implement a controller (PD, PID, H_infinity and/or LQG, designed with Matlab) into OFS.

I identified some more precise questions as a starter :

1. OFS provides a ACS function (retro/prograde, normal +/- etc...). How is this function controlling the spacecraft with respect to the disturbance (J2, drag etc...) ? What sort of controler is used ?​

2. Is there a way to extract time-dependant "output" variables of a spacecraft such as attitude, velocity, Isp, CoG, Inertia etc... If yes, could those variables be used in real time during the simulation ?​

3. If such variables are accesible, are they estimated variables or "real" variables ? (with respect to the accuracy of the mathematical models used in OFS)​


The ultimate goal for me would be to test some control algorithm. I am not sure if a similar question have been asked before, otherwise I thank you in advance for a proper redirection :)

Thank for reading me, wish y'all the best !
 

SiameseCat

Addon Developer
Addon Developer
Joined
Feb 9, 2008
Messages
1,699
Reaction score
1
Points
0
Location
Ontario
It's easy to implement a state-space controller in Orbiter using C++ (or Lua). The only possible problem you might encounter is if you have integral/derivative terms, in which case you need to do numerical integration/differentiation.

The 'output' variables you mentioned, along with a lot of other information can be accessed during run-time and used in the controller. Any information you need about the spacecraft state should be available. One thing to note is that most of the vessel parameters (i.e. thruster ISP, CoG, inertia) are constants defined by whoever created the vessel. They'll almost certainly remain fixed throughout the simulation.

I'm not sure what you mean by estimated vs. real variables.

If you haven't done this already, take a look at the OrbiterSDK documentation (especially the API Reference) and examples. It should give you a good idea of what information is available and how to implement a controller in Orbiter.
 
Last edited:

RisingFury

OBSP developer
Addon Developer
Joined
Aug 15, 2008
Messages
6,427
Reaction score
492
Points
173
Location
Among bits and Bytes...
In your Orbiter\orbitersdk\doc folder is API_Reference.pdf. It describes in detail every function available to you as an addon developer.

It's possible to get all the variables you described and they are "real" values. They're the variables Orbiter uses internally for its own models, if that's what you mean by real.

It's possible to read and output them as the simulation progresses, however, you'll have a difficult time predicting them ahead of time as Orbiter doesn't do that for you...


By the way, I've done a lot of work in atmospheric autopilots for an addon I'm working on. So far implemented are taxi to and from hangars, takeoff, landing, formation flying, basic air to air combat, missile guidance, air to ground combat (dropping unguided bombs), navigation,... I've also made some AI that makes controlling vessels easier and makes aerial navigation more fuel efficient. I wouldn't mind exchanging - or receiving :lol: - some ideas from a professional in that field :thumbup:
 
Top