|
Mavis API The API for communicating with mavis is available through mavisclient.dll. The function prototypes and data-type definitions that mavisclient.dll uses are in maviscomm.h. For a description of each mavis capability and an explanation of how to use it, see Mavis Capabilities.
getFrame int getFrame(BYTE * buf, int nBytes)Gets the next video frame. This function and getFrameSize() are provided so
video data can be forwarded from mavis to another application without having
to close mavis. Call getFrameSize() first to
get the video-frame dimensions. Then allocate a buffer of size
FrameSize_t.nBufSize for the frame data.
The format for frame data is a packed byte array. There are three bytes per pixel. The first byte is the blue value, second is green, third is red. Pixels are ordered row by row, starting at the bottom of the image. This is how video frames arrive from framecap. They're passed on unaltered for speed and to conserve shared memory. The utility library bmpUtils.dll, provided in the mavis download, has a function for expanding the packed video data into an RGB array.
getFrameSize int getFrameSize(FrameSize_t * pfs)Gets the video-frame dimensions. This function and getFrame() are provided so
video data can be forwarded from mavis to another application without having
to close mavis.
getTiltAngle int getTiltAngle(double * pAngle)Retrieves the value mavis is currently using for camera tilt angle. Mavis uses this value to compute distances.
locateHLines int locateHLines(int d, HLineOrder_t ordering, HLineMetadata_t * phlm)Locates line segments that are horizontal in 3D space. The first call to this function should use d=0. Subsequent calls with a non-zero
value for d tell mavis to use the current frame plus the previous frame to compute
distances to matching line segments. To start a new series, pass d=0 again. When
this method returns from any call except the first in a series, the fields in
HLineMetadata_t
will be set.Data for individual line segments are retrieved by calling nextLine().
lookOnce int lookOnce(ObjID_t objId, ObjLoc_t * pObjLoc)Captures one video frame and examines it for the requested object.
nextLine int nextLine(HLine_t * pLine)Retrieves data for one 3D line segment. Each time it's called, this function fetches data for the next 3D line segment and returns the number of line segments remaining. After the last line segment has been fetched, subsequent calls return -1, and the last line segment's data are repeated.
setTiltAngle int setTiltAngle(double angle)Updates the value for camera tilt angle in mavis. If the camera's tilt angle changes, call this method to tell mavis the camera's new tilt angle. For a camera that's tilted down, tilt angle should be negative. Mavis uses the tilt angle to compute distances.
startLookUntilSighted int startLookUntilSighted(ObjID_t objId, ObjLoc_t * pObjLoc, DWORD timeout)Repeats lookOnce() without returning
until the object is sighted or a stop condition is met.This function blocks until one of the following occurs: * The object is sighted * Another thread calls stopLookUntilSighted()* The timeout interval elapses
startRawFeed int startRawFeed()Toggles live frame feed on. Causes live video feed to display in the visual feedback window on MavisCtl. Calling stopRawFeed()
(or sending a command to mavis) will terminate the
live feed.
stopLookUntilSighted int stopLookUntilSighted()Forces a return from startLookUntilSighted().
Since startLookUntilSighted()
blocks, this function must be called from a separate thread.
stopRawFeed int stopRawFeed()Toggles live frame feed off. If live feed hasn't been started, calling this function has no effect.
DataRange_t typedef struct DataRange_tHigh and low values for a result.
FrameSize_t typedef struct FrameSize_tVideo-frame dimensions.
HLine_t typedef struct HLine_tInformation about one H-Line
HLineOrder_t typedef enum HLineOrder_tTells mavis how to order the list of H-Lines. Elements:
HLineMetadata_t typedef struct HLineMetadata_tMetadata about the H-Line analysis Sometimes it will be possible to estimate whether the robot has pivoted while moving forward. When mavis can make this estimate, it will set the pivotWasEstimated
flag and fill the estPivotAmount field.
HLineType_t typedef enum HLineType_tThe type of H-Line. In the image, a line will appear as lighter on one side and darker on the other. Only lines that are more horizontal than vertical in the image are considered for H-Lines. So only two line types are needed. GVPOS lines have a positive vertical gradient - they're lighter on top. GVNEG lines are darker on top. This information can be useful for mapping, since it helps distinguish lines from one another. Elements:
ObjID_t typedef enum ObjID_tPredefined IDs for hardcoded objects. Elements:
ObjLoc_t typedef struct ObjLoc_tThe outcome of looking for an object.
|