Display¶
drone.display
Copyright MIT GNU General Public License v3.0
MIT BWSI Autonomous Drone Racing Course - UAV Neo
File Name: display.py File Description: Defines the interface of the Display module of the drone_core library.
- class display.Display(isHeadless: bool)¶
Allows the user to print images to the screen.
- abstractmethod create_window() None¶
Creates an empty window into which images will be displayed.
- abstractmethod get_matrix() NDArray¶
Returns the current configuration of the dot matrix display module.
- new_matrix() NDArray¶
Returns a new matrix of all zeroes for the dot matrix display module.
- abstractmethod set_matrix(matrix: NDArray) None¶
Sets the dot matrix display module to the pattern in the argument (2D matrix).
- Parameters:
matrix – The 8x24 NumPy array with the pattern to be displayed.
Example:
dot_matrix = np.ones((8, 24), dtype=np.uint8) uav.display.set_matrix(dot_matrix)
- abstractmethod set_matrix_intensity(intensity: float) None¶
Sets the intensity of the dot matrix display module.
- Parameters:
intensity – The LED intensity (between 0.0 and 1.0) to set.
Example:
uav.display.set_matrix_intensity(0.5)
- abstractmethod show_color_image(image: NDArray) None¶
Displays a color image in a window.
- Parameters:
image – The color image to display to the screen.
Example:
image = uav.camera.get_color_image() uav.display.show_color_image(image)
- show_depth_image(image: NDArray, max_depth: int = 1000, points: list[tuple[int, int]] = []) None¶
Displays a depth image in grayscale in a window.
- Parameters:
image – The depth image to display to the screen.
max_depth – The farthest depth to show in the image in cm.
points – A list of points in (pixel row, pixel column) format to highlight.
Example:
depth_image = uav.camera.get_depth_image() uav.display.show_depth_image(depth_image)
- abstractmethod show_text(text: str, scroll_speed: float = 2.0) None¶
Displays text on the 8x24 matrix. If the text is too long, it scrolls.
- Parameters:
text – The string to display.
scroll_speed – The scrolling speed in characters per second.
Example:
uav.display.show_text("Hello, Drone!")