[psas-software] Re: flight computer + sim too slow
jamey at minilop.net
Tue Nov 15 16:19:33 PST 2005
I hope you'll forgive me for moving this question onto the software
mailing list, David. A number of other people have insight into this
question and I'd like to invite them to contribute to the answer.
On Tue, Nov 15, 2005 at 11:35:05AM -0800, David Allen wrote:
> I'm trying to do machine learning with our flight computer + simulator but
> it is running too slow. At the full data rate this combination can take
> 4 1/2 minutes to simulate 14 minutes of flight time. The same simulation
> with only the simulator running takes 22 seconds.
In fairness, the simulator has so much more information available to it
that it doesn't have to do near as much work. Although given that I'm a
bit surprised that it takes a whole 22 seconds.
> If I reduce the accelerometer data rate down to 100 messages per second,
> it takes about 1 1/2 minutes for the same time. This is still too slow.
> I'm guessing that it is the communication path between the simulator and
> the flight computer that is the bottleneck. Do you guys have any ideas on
> how to improve this?
What you really want is the ability to have the flight computer jump to
the next time that something "interesting" happens, I think.
Unfortunately the definition of "interesting" isn't knowable by the
simulator; it includes both timeouts on the various timers in the flight
computer, as well as "significant" changes in sensor values. And again,
whether changes are "significant" depends on how the flight computer is
implemented and what state it's in.
You'd get some improvement if you finished the re-architecting of the
flight computer that I started, such that nothing used the system clock
and all internal times were derived directly from messages coming in off
the CAN bus. I came to the conclusion at some point that this requires a
purely single-threaded flight computer, and that getting rid of the last
couple of threads was just enough of a headache to not bother with it
before the launch. But I don't remember why I thought any of that.
If we had well-designed modular flight computer code -- and as I
designed most of it, this is no criticism of anyone else -- then
simulator components could probably plug directly into their
corresponding flight computer components. You could bypass a lot of
these performance issues without particularly compromising the value of
the simulator for testing purposes.
I've been eyeing Knit, the C Component Extension, as a tool to get us a
modular architecture with minimal code changes. Their model is much like
the one I used function pointers and structures to simulate, except they
manipulate .o files to get the same effect at link time, and to do it in
a way directed by a separate .unit file. We might be able to "Knit"
together the code from the nodes, the flight computer, and the simulator
into a single application, if the simulator were rewritten in C. :-)
More information about the psas-avionics