Index>Robot Kit>DarkPaw Spider Robot Kit for RPi>Lesson 1 Introducing Web Controller UI

Lesson 1 Introducing Web Controller UI

5359

Lesson 1 Introducing Web Controller UI

1.1 Running webServer.py Program

Raspberry Pi will automatically run the program of the robot every time it reboots. Specifically, it will run adeept_darkpaw/server/webServer.py, but if the Raspberry Pi camera or the driver board Robot HAT is not connected, webServer.py will not run. It's normal because the program of the robot needs to use the camera and PCA9685 chip. The Adeept Robot HAT controls servo via PCA9685, while the Raspberry Pi communicates with PCA9685 through I2C. If Robot HAT is not installed on the Raspberry Pi, when instantiating the dependent library of PCA9685, a communication failure will occur with a program error.

You can power off the Raspberry, install the camera module and Robot HAT, and reboot. Then webServer.py can run successfully.

Under normal circumstances, you don't need to manually run webServer.py since the Raspberry Pi will automatically run the program when booting.

If you failed to open the page, you can remotely log into the Raspberry Pi via SSH and type in the command as shown below to disable all auto-run programs to release resource. Otherwise, there may be issues like camera initialization failure or occupied port.

sudo killall python3

wps269.jpg 

Type in the following code to run webServer.py:

sudo python3 adeept_darkpaw/server/webServer.py

wps270.jpg 

You can access the Raspberry Pi by IP address through a web browser only when it can successfully run webServer.py.

1.2 Getting Access to Web Controller

A web controller is a web interface to control the robot product to perform various actions and it can be applied on any device that is able to run a browser, including PC, mobile phones, tablets, etc.

If you've completed all installations based on the instructional document, it will be quite easy to open a web controller.

1. Check that your device is under the same LAN with the Raspberry Pi.

2. Obtain the Raspberry Pi's IP address (refer to the Software Installation section).

3. Open a web browser (recommended to use Chrome in case of any possible incompatibility with other browsers), enter the Raspberry Pi's IP address with the port :5000, for instance: 192.168.3.44:5000

wps271.jpg

Then the web controller will be loaded into the browser.

wps272.jpg

 

Modules on the web controller may vary from products. Most of them are explained below with the method for application. You can check modules on your web controller accordingly to better understand their functions and how to use them.

1.3 Function Overview of Web Controller

1. Video Module

Display the image captured by the camera.

wps273.jpg 

2. Hard Ware Module

wps274.jpg 

CPU Temp: Shows the temperature of the Raspberry Pi CPU.

CPU Usage: Shows the usage of the Raspberry Pi CPU

RAM Usage: Shows the usage of the Raspberry Pi memory  

3. Move Control Module

Control the movement of the robot towards the front, back, left, and right.

wps275.jpg 

Speed: Slide to adjust the speed of the robot's movement, for robot with wheels. It's not supported for the Adeept DarkPaw Robot.

4. Arm Control Module

Control the robot's movements. The movement control for Adeept DarkPaw Robot is as follows:  

wps276.jpg 

UP: Camera view moves upwards, by lifting the forelegs and lowering the hind legs.

DOWN: Camera view moves downwards, by lifting the hind legs and lowering the forelegs.

STAND UP: Stand up – whole robot body rises.

STAY LOW: Lie down – whole robot body gets low.

LEAN-L: Robot tilts towards the left.

LEAN-R: Robot tilts towards the right.

5. Actions Module

wps277.jpg 

MOTION GET: Click to start the watch dog mode. In this mode, the robot stays still and moves when motion is detected. The mobile object will be marked in a frame in the Video Module. Click again to disable the function.

POLICE LIGHT: Turn on or off the police light. Under the mode, the LED light on the robot will flash like the police light. Click again to disable the function.  

STEADY CAMERA: Self-balancing mode. In this mode, the robot will try to keep itself as level as possible.

6. FC Control Module

Control the color detection function on/off and color setup.

wps278.jpg 

COLROR: Select the color to be detected.

START: Turn on/off the color detection function.

7. PWM INIT SET Module

wps279.jpg 

Adjust the initial angle of servo to fix angle error during assembly. Servo will rotate to the initial position when initialized.

① Enter the number of the PWM port connected with the desired servo in the textbox under PWM. Click the PWM textbox and the buttons for increase and decrease will appear. Click to choose a PWM port number.

② Click the two buttons to control the servo to slightly rotate clockwise/counterclockwise.

③ Click to save the current angle of the servo as the initial.

④ Click to initialize the angle of all servos to the factory default settings.

4. Ports Control Module

wps280.jpg 

Control the Port 1, Port 2, and Port 3 on the board to turn on/off.

1.4 Q&A

After the Raspberry Pi boots, I can't access the web controller page via "Raspberry Pi's IP address + :5000 (port number)" (e.g., 192.168.3.230:5000)

Take the following steps:

1. Type in the command "sudo killall python3", run the webServer.py program by "sudo python3 <your path of the webserver.py file>" (e.g., sudo python3 adeept_rasptank/server/webServer.py)

2. If error happens when running webServer.py, please check whether the camera is connected appropriately (metals of the camera flex cable and camera module should be in contact with each other)

After the Raspberry Pi boots, I got access the web controller page via "Raspberry Pi's IP address + :5000 (port number)", but I saw a non-real-time, static video and couldn't control the robot to move.

Take the following steps:

1. Check whether the Raspberry Pi has rebooted or not. If it has, the "Connect Failed" message would be prompted within 1 minute on the web controller page, and the terminal logged into Raspberry Pi via SSH would not respond.

2. Possible reason for this issue: Low power of the battery. It's suggested to change high power batteries for controlling the robot via web controller.

3. Use 18650 battery with "high rate discharge" mark or that can support large current output of up to 4A.