MPIEventCaptureData
Declaration
typedef struct MPIEventCaptureData { int32_t count; /* number of capture data values */ int32_t lostCaptures; double position[MPICapturesPerSampleMAX]; /* actual or time-interpolated position */ double time[MPICapturesPerSampleMAX]; /* only valid for time-based capture */ uint32_t raw[MPICapturesPerSampleMAX]; /* raw data coming from the node. */ } MPIEventCaptureData;
Required Header: stdmpi.h
Change History: Added in 04.00.
Description
MPIEventCaptureData holds information about a capture event generated on the controller.
count | The number of captures that occurred during a single servo cycle for the MPICapture object. |
---|---|
lostCaptures | The number of lost captures. This can occur if the capture object is configured for auto-arm mode and the capture engine is triggered more times in a single servo cycle than the node’s capture buffer can hold. |
position | An array of the captured feedback positions. |
time | An array of timestamps of the capture. The units of time are servo samples. The value of the timestamps should be the controller’s sample counter plus the fraction of the time between samples at the time the capture event occurred. |
raw | An array of the raw capture data coming from the node. |
Sample Code
MPI_RESULT MPI_DECL2 myCaptureCallback(MPIControl control, const MPIEventData* status, void* userData) { int32_t index; /* print event information to the screen. */ printf("%s event occurred at controller sample %d.\n" " # of lost captures: %d\n", mpiEventTypeName(status->eventType), status->data.capture.lostCaptures); for (index=0; indexdata.capture.count; ++index) { printf(" Position[%d] = %f\n" " Time[%d] = %f\n" " Raw[%d] = 0x%08x\n", status->data.capture.position[index], status->data.capture.time[index], status->data.capture.raw[index]); } }
See Also