jetson_tello.app¶
- jetson_tello.app.run_jetson_tello_app(fly, process_frame, drone=None, on_frame_decoded=None, wait_for_wifi=True)¶
Fly and control a drone while analysing video frames using CUDA.
This function takes two main arguments - an async function to control the drone in whatever way you want, and a callback called with video frame data ready and loaded into CUDA memory for analysis.
The process_frame callback always waits for the next available frame, skipping any that arrive while processing the last. Frame analysis can take as long as it needs without falling behind the live video.
There is also an optional on_frame_decoded callback which is called for every frame. This must be fast enough to not clog things up and cause latency.
- Parameters
fly (Coroutine function which takes a
tello_asyncio.tello.Tello
drone argument.) – Awaitable function which controls the drone. The app exits when complete.process_frame (Awaitable or plain function taking
tello_asyncio.tello.Tello
drone,jetson_tello.types.DecodedFrame
frame,cudaImage
cuda) – Callback called with frame data loaded into CUDA memorydrone (
tello_asyncio.tello.Tello
) – Optional drone instance. One will be created automatically if not providedon_frame_decoded (Awaitable or plain function taking
jetson_tello.types.DecodedFrame
frame) – Optional callback called for every decoded framewait_for_wifi (bool) – If true, wait for connection to the drone’s WiFi network before proceeding (Linux only)
jetson_tello.coco¶
- exception jetson_tello.coco.InvalidCocoClassError(value)¶
Bases:
Exception
Exception raised if a COCO class could not identified from the given value.
- jetson_tello.coco.get_coco_class(value)¶
COCO class from a class ID, name or object detection object.
- Parameters
value – The class ID, name or object detection
- Return type
jetson_tello.coco.classes.CocoClass
- Throws
- jetson_tello.coco.get_coco_class_by_id(id)¶
COCO class from a class ID.
- Parameters
id (int) – The class ID
- Return type
jetson_tello.coco.classes.CocoClass
- Throws
- jetson_tello.coco.get_coco_class_by_name(name)¶
COCO class from a class name.
- Parameters
name (string) – The class name
- Return type
jetson_tello.coco.classes.CocoClass
- Throws
jetson_tello.video¶
- class jetson_tello.video.DecodedFrame(number, width, height, data)
Bases:
tuple
Video frame data and information
- data
Decoded frame data as bytes
- height
Frame image height in pixels
- number
Position in the sequence of successfully decoded frames
- width
Frame image width in pixels
- class jetson_tello.video.H264DecoderAsync
Bases:
object
Decodes a stream of h.264 encoded video frames, making them available for analysis.
- async decode_frames(video_stream, on_frame_decoded=None)
Begin decoding video frames.
- Parameters
video_stream (Asynchronous iterator of h.264 frames) – The video stream
on_frame_decoded (Awaitable or plain function taking
jetson_tello.types.DecodedFrame
) – Optional callback called for each successfully decoded frame. Must be fast!
- property decoded_frame
The most recently decoded frame. :rtype:
jetson_tello.types.DecodedFrame
- exception jetson_tello.video.NoFrameData
Bases:
Exception
Exception raised when no frame data is available, either because the frame is corrupted, or intentionally for reasons known only to the h.264 encoder.
- jetson_tello.video.decoded_frame_to_cuda(decoded_frame)
Loads frame data into CUDA memory.
- Parameters
decoded_frame (
jetson_tello.types.DecodedFrame
) –- Return type
cudaImage
- jetson_tello.video.decoded_frame_to_numpy_array(decoded_frame)
Takes a decoded frame and returns a NumPy array of the RGB values.
- Parameters
decoded_frame (
jetson_tello.types.DecodedFrame
) –- Return type
numpy.array
- jetson_tello.video.h264_frame_to_cuda(h264_frame)
Decodes raw h.264 frame data and copies it into CUDA memory.
- Parameters
frame (bytes) – The raw frame data
- Return type
(
jetson_tello.types.DecodedFrame
,cudaImage
)- Throws
jetson_tello.video.NoFrameData
- jetson_tello.video.h264_frame_to_numpy_array(h264_frame)
Decodes raw h.264 frame data and copies it into a NumPy array ready for analysis.
- Parameters
h264_frame – The h.264 encoded frame data
- Return type
(
jetson_tello.types.DecodedFrame
,numpy.ndarray
)- Throws
jetson_tello.video.NoFrameData