[CCC DEV] UDP interaction question

Matt Jadud matt at jadud.com
Thu Dec 29 01:06:57 GMT 2011


Hi all,

This holiday I'm setting up connections between o-pi and Flight Gear
[1] so that we can run UAV controller code in simulation. The
communication link is a simple UDP protocol [2]. At the moment, I have
a simple Scheme script that proves that I can read parameters from the
simulation as well as oscillate the ailerons, rudder, and throttle
under external control. (It also proves that simply oscillating those
three control surfaces back-and-forth can crash airplanes.)

I could use the FFI to bind in some simple UDP calls from the standard
library, which should work well enough. Or, I could create a proxy,
and talk over stdin/stdout. (The proxy could have value in that I
could then run the control code on the ArduPilot, and use the same
kind of link to get my data.) The protocol is nice in that it is a
simple XML specification that you drop into the app bundle, and it can
ship as either ASCII text or a simple binary format (int in one word,
double in two, etc.).

My big question at this point is whether I need to have a separate
UDP-handling thread that always keeps the most recent reading from the
simulation ("memory cell") for the TVM to grab at will
("client/server"). Otherwise, I'd be afraid that an interrupt-driven
approach might miss data. That, however, might be a silly concern at
this stage.

Or, is there socket handling code lying around that I don't know about
(largely because I've never used it) that would be the more
direct/easy way to proceed. (I suspect such code would be CCSP-only,
but that could/should be just fine.)

Thoughts? Before I dive in and write silly code, I thought I'd check
and see if I'm about to reinvent any wheels.

Cheers,
Matt

[1] http://www.flightgear.org/

[2] http://wiki.flightgear.org/Generic_Protocol



More information about the developers mailing list