Allows a FLIGHTLAB model to be used in end-user applications without requiring the Scope development system.
FCMDUMP
commandFCMDUMP("filename.fcm")
// Load model: exec("$FL_DIR/flme/models/articulated/arti-rgd-3iv-qs.def",1); // Set initial conditions: world_model_airframe_cpg_testcond_veq = 20; exec("xatestcond.exc",1); exec("xamodeltrim.exc",1); // Set up and declare variable lists: pushg(world_model_airframe_cpg_xaout) varlist @STATES "Position, orientation, and velocity" = .. posxi,posyi,poszi, vxb,vyb,vzb, phi,theta,psi ; popg; fcmdump(@states); // Dump model: fcmdump("articulated.fcm");
#include "fcm.h"
in C source files
-lfcm
($FL_DIR/lib$FL_MACHTYPE/libfcm.a
)
FCMDUMP
command
flcomp.so
component library -- included with FLIGHTLAB
FCM_FILE
: master handle;
FCM_MODEL
: model instance handle;FCM_OPERATION
: operation handle;FCM_VARLIST
: variable list handle;FCM_FIELD
: field handle;fcm_open
to obtain an FCM_FILE
handleFCM_FILE
:
fcm_create
to create an FCM_MODEL
instanceFCM_MODEL
(s)fcm_destroy()
to destroy an FCM_MODEL
instancefcm_close()
to free all resources associated with an FCM_FILE
FCM_MODEL
s created from the same FCM_FILE
can use the same operation and variable list handlesFCM_OPERATION op_handle = fcm_lookup_operation(fcm, "opname")
fcm_invoke(model_handle,op_handle)
fcm_create()
FCM_VARLIST vl_handle = fcm_lookup_varlist(fcm, "@name")
fcm_fetch(model_handle, vl_handle, buf, len)
fcm_store(model_handle, vl_handle, buf, len)
double
sfcm_create()
fcm_read(model, vl_handle, &structvar, size)
fcm_write(model, vl_handle,&structvar, size)
fcm_checkpoint(model_handle, filename)
fcm_restore(model_handle, filename)
fcm_reload(model_handle)
#include "fcm.h" ... /* Initialization: */ FCM_FILE fcm = fcm_open("articulated.fcm"); FCM_OPERATION op_step = fcm_lookup_operation(fcm,"STEP"); FCM_VARLIST vl_states = fcm_lookup_varlist(fcm,"@STATES"); FCM_MODEL model = fcm_create(fcm); double state_buf[N_STATES]; ... /* Run-time, once per frame: */ fcm_invoke(model, op_step); fcm_fetch(model, vl_states, state_buf, N_STATES); ... /* Cleanup: */ fcm_close(fcm);
NULL
on failureconst char *fcm_error_message()
- returns a textual description
of the most recent errorFCM_FILE fcm = fcm_open(filename); if (fcm == NULL) fprintf(stderr, "FCM error: %s\n", fcm_error_message());
fcm_error_code()
returns a numeric code:
FCM_ERR_FORMAT
- file format errorFCM_ERR_NOT_FOUND
- object not foundfcm.h
for full list.fcm_load_components()
$FL_FCM_COMPONENTS
environment variableflcomp.so
in current working directoryNote: fcm_load_components(NULL);
called automatically
by libflcomms when needed
fcm_open()
fcm_create()
fcm_load_components()
FCM_MODEL
at a timeFCM_MODEL
to a single subthreadFCM_FILE
and FCM_MODEL
handles between threads