-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1b60da
commit 4369ec6
Showing
13 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.lib | ||
*.pyd | ||
*.exp | ||
*.dll | ||
*.exe | ||
*.obj | ||
*.o | ||
*.so | ||
__pycache*/ | ||
*.egg-*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
rem This compiles telloc on windows. | ||
rem run this script from the developer command prompt. | ||
rem read the README. | ||
|
||
rem :: set environment variables :: | ||
set ffmpeg_include_dir="C:\Program Files\FFmpeg\include" | ||
set ffmpeg_lib_dir="C:\Program Files\FFmpeg\lib" | ||
set ffmpeg_dll_dir="C:\Program Files\FFmpeg\bin" | ||
set build_python="true" | ||
set python_dir="%userprofile%\AppData\Local\Programs\Python\Python311" | ||
|
||
rem :: compile telloc :: | ||
set SOURCES=telloc\video.c telloc\telloc_windows.c | ||
set avcodec=%ffmpeg_lib_dir%\avcodec.lib | ||
set avformat=%ffmpeg_lib_dir%\avformat.lib | ||
set avutil=%ffmpeg_lib_dir%\avutil.lib | ||
set swscale=%ffmpeg_lib_dir%\swscale.lib | ||
cl /c /MT /Itelloc\ /I%ffmpeg_include_dir% %SOURCES% | ||
lib /OUT:telloc.lib /MACHINE:X64 video.obj telloc_windows.obj %avcodec% %avformat% %avutil% %swscale% ws2_32.lib | ||
|
||
rem :: compile test program :: | ||
cl /c telloc/main_windows.c /Itelloc /link /LIBPATH:%CD% telloc.lib /OUT:test.exe user32.lib gdi32.lib | ||
|
||
IF NOT %build_python% == "false" ( | ||
rem build the python library | ||
cl /c /MT /Itelloc /I%python_dir%\include tellopy.c | ||
link /dll /MACHINE:X64 /OUT:tellopy\libtellopy.pyd /LIBPATH:%python_dir%\libs tellopy.obj telloc.lib python3.lib | ||
copy %ffmpeg_dll_dir%\avcodec*.dll tellopy | ||
copy %ffmpeg_dll_dir%\avformat*.dll tellopy | ||
copy %ffmpeg_dll_dir%\avutil*.dll tellopy | ||
copy %ffmpeg_dll_dir%\swscale*.dll tellopy | ||
copy %ffmpeg_dll_dir%\swresample*.dll tellopy | ||
) | ||
|
||
rem del *.obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from . import libtellopy | ||
# import os | ||
# import ctypes | ||
|
||
# path = os.path.dirname(os.path.abspath(__file__)) | ||
# os.add_dll_directory(path) | ||
# libtellopy = ctypes.windll.LoadLibrary(os.path.abspath(os.path.join(path, 'libtellopy.pyd'))) | ||
|
||
|
||
def connect(): | ||
""" | ||
Connect to Tello drone, returning True if successful and False otherwise. | ||
:return: success | ||
""" | ||
return libtellopy.connect() | ||
|
||
|
||
def send_command(command): | ||
""" | ||
Send a command to the Tello drone, returning the response. | ||
:param command: string command from Tello SDK api commands (e.g. 'battery?', 'takeoff', 'land', 'streamon', 'streamoff') | ||
:return: string response | ||
""" | ||
return libtellopy.send_command(command) | ||
|
||
|
||
def read_image(): | ||
""" | ||
Read a frame from the video stream, returning a tuple of (height, width, flat) where flat is a list of RGB values. | ||
:return: height, width, rgblist | ||
""" | ||
return libtellopy.read_image() | ||
|
||
|
||
def read_state(): | ||
""" | ||
Read the state of the drone, returning a dictionary of key-value pairs. | ||
:return: string of comma-separated state information. Should be easy to turn into a dictionary. | ||
""" | ||
return libtellopy.read_state() | ||
|
||
|
||
def disconnect(): | ||
""" | ||
Disconnect from the Tello drone. | ||
Throws and exception if there is a problme disconnecting. But honestly, you are likely to segfault in that case. | ||
:return: True if disconnected or disconnection successful. | ||
""" | ||
return libtellopy.disconnect() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,11 @@ | |
author='Alec Graves', | ||
author_email='[email protected]', | ||
description='A simple package for controlling and viewing video from the DJI Tello', | ||
long_description=open('README.md').read(), | ||
long_description=open('README.md', encoding='utf8').read(), | ||
long_description_content_type='text/markdown', | ||
url='https://github.com/alecGraves/telloc', | ||
url='https://github.com/alecGraves/tellopy', | ||
packages=find_packages(), | ||
package_data={'telloc': ['libtellopy.so', 'libtellopy.dll']}, | ||
package_data={'telloc': ['libtellopy.so', 'libtellopy.pyd', "*.dll"]}, | ||
include_package_data=True, | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.