Index>Robot Kit>RaspTank Smart Robot Car Kit for RPi>Lesson 1 Introducing GUI Control UI
No related product information!

Lesson 1 Introducing GUI Control UI

4138

Lesson 1 Introducing GUI Control UI

For previous robot program of Adeept, we've introduced the method of controlling robot via desktop GUI program written with Python. However, it's not recommended for beginners as it requires some further knowledge and experience.

The GUI program now is only compatible with Windows operating system. Generally, it's named GUI.py and stored under the client directory of the robot software package.

1.1 Installing GUI Dependent Libraries on Windows

Installing Python3

You need to install Python on your computer to run the program for PC. Since the code of this robot was developed and debugged by Python3, please download the Python3.7 version or higher in case of any error caused by incompatibility.

Download Python3 at this link: https://www.python.org/downloads/windows/

Double click the installation package to install Python.

Pay attention to select Add Python to PATH when installing.

Installing NumPy

NumPy is a basic software package for scientific calculation through Python. OpenCV needs to use some of its functions.

Press Win + R key, type in "cmd", and click OK to start cmd.

Type in the command below to install NumPy:

pip3 install numpy

Press Enter to start downloading and installing NumPy.

Installing OpenCV

Same method with installing NumPy

Start cmd, type in the command as shown below:

pip3 install opencv-contrib-python

Press Enter to start downloading and installing OpenCV

Installing zmq and pybase64

zmq and pybase64 are the libraries for real time video

Start cmd, type in the following command: 

pip3 install zmq pybase64

Start cmd, type in the following command: 

Press Enter to start downloading and installing zmq and pybase64. 

Downloading GUI Program

Since the GUI.py is included in the code file of the robot, here we download the code file on Windows:

Choose the path to save the code file: F:\Robot

Type in the command as shown below:

F:

image.png

 

Type in the command below:

cd Robot

image.png

 

Type in the command below to download the code program:

git clone https://github.com/adeept/adeept_rasptank.git

image.png

 

1.2 Introducing GUI Control Program

The web terminal and GUI are not connected. Therefore, to control the robot via GUI, you need to manually run server.py on Raspberry Pi. (similar to manually running webserver.py, the only difference is the server.py program)

Terminate the auto-run program of webServer.py on Raspberry Pi:

sudo killall python3

image.png

 

Run the server.py program:

sudo python3 adeept_rasptank/server/server.py

image.png

 

After server.py run successfully on Raspberry, run GUI.py on Windows.

Run GUI.py in cmd. If you right click on the GUI.py file in the folder, there may be an error message.

Access the folder of the robot program:

image.png

 

Run the GUI.py program (run it after accessing the client folder, or there may be an error).

Python GUI.py

image.png

 

The GUI interface will appear after run successfully.

image.png 

Enter the IP address of the Raspberry Pi in the GUI on PC, click Connect, and you can control the robot now. For instance, enter 192.168.3.241

image.png 

image.png 

Now you can see 3 windows: cmd, Adeept RaspTank, and stream window.  

cmd execution window: Shows up every time a GUI is started. Any abnormalities of execution will be shown in this window. GUI will be closed if you close the window.

Camera stream window: Shows the images captured by the camera. The rendering may vary from different product types; some product may even communicate with this window.

Adeept RaspTank window: To connect and control the robot.

IP Address textbox: Enter the IP address of the Raspberry Pi, click Connect to connect it and GUI.  

image.png 

Movement control:

image.png 

Forward: Control the robot to move forward, with a shortcut W.

Backward: Control the robot to move backwards, with a shortcut S.

Left: Control the robot to turn left, with a shortcut A.

Right: Control the robot to turn right, with a shortcut D.

Up: Control the camera to move upwards; the shortcut key is I.

Down: Control the camera to move downwards; the shortcut key is K.

\ : Control the rotation of the mechanical arm chuck; the shortcut key is U.

/ : Control the rotation of the mechanical arm chuck; the shortcut key is O.

Home: Control all servos to return to the neutral position; the shortcut key is H.

 

1.3 Q&A

 

If Numpy/OpenCV/zmq/pybase64 has been installed on the PC, but an error appears after running the program: ModuleNotFoundError: No module named numpy/cv/zmq

It may be that multiple versions of python are installed on the PC, and the python version of the installed dependent library is inconsistent with the python version of the running program, causing the program to report an error.