FLCOMMS

What is it?

FLCOMMS data model

FLCOMMS data model - figure

Scope interface - attaching variable lists

Scope API - Example

// Load a model:
exec("$FL_DIR/flme/models/articulated/arti-rgd-3iv-qs.def",1);

// Set up variable lists for the data we want to share:
pushg(world_model_airframe_cpg_xaout);
    varlist @STATES "Aircraft rigid body states" = ..
            posxi, posyi, poszi, ..
            phi, theta, psi;
popg;
pushg(world_model_control_cpg_in);
    varlist @PILOTIN "Pilot inputs" = ..
       xa, xb, xc, xp;
popg

// Publish the shared variables:
attach(@STATES,  "w");
attach(@PILOTIN, "r");

// Synchronize data:
apctl("sync");

flcomms Command-line utility

% flcomms -l
Data blocks (serial=13)
   #: hflg flags name   size   addr #rw owner   serial    magic
---------------------------------------------------------------
 124: 0104 r   D PILOTIN  32 0x1100   1     0 s=000000 m=0xB1F7
 125: 0204  w  D STATES   48 0x1000   1 29392 s=000006 m=0x2D8C

flcomms Command-line utility (cont)

FLCOMMS: C API

Connecting to data blocks

FLC_HANDLE h = flc_open("name", size, magic, mode_flag | type_flag);

Reading and writing

C API - Example

#include "flcomms.h"
struct STATES {
    double posxi, posyi, poszi;  /* position */
    double phi, theta, psi;      /* orientation */
} states;
double pilotin[4];
...
flc_attach(NULL, 0);
FLC_HANDLE states_handle = flc_open(
    "STATES", sizeof(struct STATES),
    0, FLC_TYPE_DOUBLE|FLC_MODE_READ);
FLC_HANDLE pilotin_handle = flc_open(
    "PILOTIN", 4*sizeof(double),
    0, FLC_TYPE_DOUBLE|FLC_MODE_WRITE);
...
flc_write(pilotin_handle, pilotin, 4*sizeof(double));
flc_read(states_handle, &states, sizeof(states));

Error reporting

What to do when things go wrong

Limitations

FLCOMMS over a network - figure

NETFLC

Other netflc options

Magic Numbers

Thread-safety issues

Conclusion

Questions?