anki_vector.opengl¶
This module provides 3D classes for running the OpenGL Viewer.
It should be launched in a separate process to allow Vector to run freely while the viewer is rendering.
It uses PyOpenGL, a Python OpenGL 3D graphics library which is available on most platforms. It also depends on the Pillow library for image processing.
Warning
This package requires Python to have the PyOpenGL package installed, along with an implementation of GLUT (OpenGL Utility Toolkit).
To install the Python packages on Mac and Linux do python3 -m pip install --user "anki_vector[3dviewer]"
To install the Python packages on Windows do py -3 -m pip install --user "anki_vector[3dviewer]"
On Windows and Linux you must also install freeglut (macOS / OSX has one preinstalled).
On Linux: sudo apt-get install freeglut3
On Windows: Go to http://freeglut.sourceforge.net/ to get a freeglut.dll
file. It’s included in any of the Windows binaries downloads. Place the DLL
next to your Python script, or install it somewhere in your PATH to allow any
script to use it.”
Functions
|
Run the 3D Viewer window. |
-
anki_vector.opengl.
main
(close_event, input_intent_queue, nav_map_queue, world_frame_queue, extra_render_function_queue, user_data_queue, show_viewer_controls=True)¶ Run the 3D Viewer window. This is intended to run on a background process.
import multiprocessing as mp from anki_vector import opengl ctx = mp.get_context('spawn') close_event = ctx.Event() input_intent_queue = ctx.Queue(maxsize=10) nav_map_queue = ctx.Queue(maxsize=10) world_frame_queue = ctx.Queue(maxsize=10) extra_render_function_queue = ctx.Queue(maxsize=1) user_data_queue = ctx.Queue() process = ctx.Process(target=opengl.main, args=(close_event, input_intent_queue, nav_map_queue, world_frame_queue, extra_render_function_queue, user_data_queue), daemon=True) process.start()
- Parameters
close_event (multiprocessing.Event) – Used to notify each process when done rendering.
input_intent_queue (multiprocessing.Queue) – Sends key commands from the 3D viewer process to the main process.
nav_map_queue (multiprocessing.Queue) – Updates the 3D viewer process with the latest navigation map.
world_frame_queue (multiprocessing.Queue) – Provides the 3D viewer with details about the world.
extra_render_function_queue (multiprocessing.Queue) – Functions to be executed in the 3D viewer process.
user_data_queue (
Queue
) – A queue that may be used outside the SDK to pass information to the viewer process. May be used byextra_render_function_queue
functions.show_viewer_controls (
bool
) – Specifies whether to draw controls on the view.