Building an environment for "Tello_Video" on Mac OS X

Introduction

This page is

Move the Tello-Python sample "Tello_Video"

It is a supplementary page of.

※Caution ** My Mac is old (High Sierra), so I tried Xcode 10. </ font> ** Another problem may occur with new Macs. .. ..

Overview

Of the DJI official Python sample program "Tello-Python" for Tello  Tello_Video In order to try

--Installation of various dependent libraries --Building H.264 video decoding library

You need to do.

You can use git's Tello-Python page as an installation method.

・ Mac

 i. Make sure you have the latest Xcode command line tools installed. If not, you might need to update your OS X and XCode to the latest version in order to compile the h264 decoder module
ii. Go to the "install\Mac" folder folder in command line, run

   chmod a+x ./mac_install.sh
   ./mac_install.sh

If you see no errors during installation, you are good to go!

is what it reads. That is, after installing the command line tools of Xcode, which is the development environment for Mac.

Move folders, change file attributes, execute shell files


$ cd install/Mac/
$ chmod a+x ./mac_install.sh
$ ./mac_install.sh

It means to type the command. ** mac_install.sh </ font> ** is a shell script that automatically builds the environment for Mac.

If you are familiar with Mac, you will think, "Why, if you have an sh file, you can run it." However, if you execute it as it is

--It is said that nose and tornado are missing when matplotlib is installed. --OpenCV version 3.x is not installed. (Become 4.x system) --cmake does not pass before building h264 decode library

Will occur.

So, rewrite mac_install.sh.

Referenced page

-How to install Command Line Tools I searched for and installed Xcode 10 here. -Install Command Line Tools for Xcode with Mavericks For those who already have the GUI version of Xcode installed -Python: [pip install requests] What to do with [matplotlib 1.3.1 requires nose, which is not installed.]Tello_Video & Tello_Video_With_Pose_Recognition # 41 # 42

Prerequisites

We will assume that Tello-Python is installed in your home folder (~).

Move directory

First, open the console (terminal) and type the following command to move to the Tello-Video folder.

cd(change_directory)


$ cd ~/Tello-Python/Tello-Video

Looking inside the Tello_Video directory with the ls command,

Tello_Contents of Video


$ ls
LICENSE.md  README.md  h264decoder  img  install  main.py  tello.py  tello_control_ui.py

You can see that there is a directory called ʻinstall`. The contents of this directory are

In the install directory


$ ls install/
Linux  Mac  Windows

It looks like this, and the installation files are placed in each directory of Linux, Mac, and Windows, but ** none of them are old and useless </ font> * *.

However, Mac can handle it with a few changes.

Rewrite Mac_install.sh

For Mac, you can install it automatically by rewriting the contents of mac_install.sh a little.

** * Changes made ** Added to install nose and tornado with easy_install. The version of OpenCV is 3.4.2.17 which can use SHIFT. The trouble that there is no boost_python in cmake has been rewritten according to the issue.

Use a text editor (TextEdit, mi, etc.) and rewrite ** mac_install.sh ** as follows.

mac_install.sh


#!/bin/sh



echo 'Compiling and Installing the Tello Video Stream module'

echo 'You might need to enter your password'

# go to /sample_code folder
cd ..
cd ..

# install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew update



# install pip

#sudo easy_install pip

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py

# install cmake

brew install cmake



# install dependencies

brew install boost

brew install boost-python

brew install ffmpeg

brew install tcl-tk

# added by hsgucci
sudo easy_install nose

# added by hsgucci
sudo easy_install tornado

sudo pip install numpy --ignore-installed

sudo pip install matplotlib --ignore-installed

sudo pip install pillow --ignore-installed

sudo pip install opencv-python==3.4.2.17 --ignore-installed



# pull and build h264 decoder library

cd h264decoder


mkdir build

cd build

# comment out by hsgucci
#cmake ..

# added by hsgucci
cmake -D Boost_NO_BOOST_CMAKE:BOOL=ON ..

make



# copy source .so file to tello.py directory

cp libh264decoder.so ../../



echo 'Compilation and Installation Done!'

Run mac_install.sh

After rewriting, move to the folder containing the shell file and Give execute permission with chmod and execute.

Move folders, change file attributes, execute shell files


$ cd ~/Tello-Python/Tello_Video/install/Mac/
$ chmod a+x mac_install.sh
$ ./mac_install.sh

It will be installed automatically.

After the installation is complete, go back to the Tello-Video directory.

Go back up two levels


$ cd ../../

** This completes the work. </ font> **

important point

The point to note when installing with mac_install.sh is ** Be sure to move the current directory to ~ / Tello-Python / Tello_Video / install / Mac / Then run mac_install.sh </ font> **.

I mean,

mac_install.Excerpt from sh


cd ..    #Move to the next higher directory
cd ..    #Move to the next higher directory
#Homebrew installation
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update

(Abbreviation)

# pull and build h264 decoder library
cd h264decoder    #Enter a folder called h264 decoder
mkdir build
cd build          #Enter a folder called build
cmake ..
make

# copy source .so file to tello.py directory
cp libh264decoder.so ../../      #Copy files to a folder two levels higher

In this way, go up the folder two levels and install apt and pip. This is because we are moving to the h264decoder folder and building and copying the library.

If, from the Tello_Video folder, do the following

Don't call the file directly like this


$ ./install/Mac/mac_install.sh

What happens if you run the shell with a relative path? It goes up two levels of ~ / Tello-Python / Tello_Video /, that is, up to the home directory ~ / and tries to enter h264 decoder. Of course, there is no such folder, so there is no way to build it.

in conclusion

Finally Linux, Raspberry Pi, Windows, Mac are all over ~ (joy) But the times are Python 3. .. ..

Recommended Posts