Basic AutoScript Functions¶
AutoScript has some basic functions for accessing drone navigation data and controlling flight. On this page, these built-in functions are documented.
In AutoFlight 1.0, the AutoScript API has changed and is not compatible with earlier versions of AutoFlight.
They are divided into two modules named
imgproc module contains functions for retrieving and processing images, while the
basicctl module is used for most other simple commands.
For more advanced and high-level commands, please use the
Using OpenCV’s built in GUI functionality is not (yet) possible in AutoFlight. To display an image, you should always use
imgproc.showFrame(img) and never OpenCV’s
imshow() or similar.
I am still refining the image processing capabilities of AutoScript. Right now it is possible to retrieve images, to process them using OpenCV for Python, to display them in the AutoFlight main window and to use the April Tag detector built into AutoFlight.
Get the latest frame.
Returns: A numpy array containing the latest received video frame in 8-bit 3 channel BGR format.
Get the age of the latest frame. Useful for ignoring outdated frames when the video feed is interrupted.
Returns: The age of the latest frame, in milliseconds.
Show an image in the AutoFlight main window.
Parameters: frame – A numpy array containing the frame to display. Must be 8-bit 3 channel BGR or binary.
Start the integrated April tag detector.
Stop the integrated April tag detector.
Tell the tag detector which April tag family you want to detect.
Parameters: family – The name of the tag family (e.g.:
set_tag_roi(x, y, width, height)¶
Set the rectangular region of interest for the tag detector. Only this region will be analyzed when running the tag detector, potentially reducing CPU usage significantly.
- x – X-coordinate of the upper left point of your ROI
- y – Y-coordinate of the upper left point of your ROI
- width – Width of the ROI
- height – Height of the ROI
Get the detected tags.
Returns: A list of tuples, each tuple representing one detected tag. Each tuple contains the tag’s ID, a flag indicating whether the detection is valid or not and a list of X/Y coordinates of the tag’s edges.