Lesson 1 Introducing Web Controller UI
1.1 Running webServer.py Program
l Raspberry Pi will automatically run the program of the robot every time it reboots. Specifically, it will run adeept_rasptankpro/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.
l You can power off the Raspberry, install the camera module and Robot HAT, and reboot. Then webServer.py can run successfully.
l Under normal circumstances, you don't need to manually run webServer.py since the Raspberry Pi will automatically run the program when booting.
l 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
l Type in the following code to run webServer.py:
sudo python3 adeept_rasptankpro/server/webServer.py
l 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
l 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.
l 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
Then the web controller will be loaded into the browser.
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.
2. Hard Ware Module
l CPU Temp: Shows the temperature of the Raspberry Pi CPU.
l CPU Usage: Shows the usage of the Raspberry Pi CPU
l 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. (To turn left, you need to press "forward" and "left",To go back to the left, you need to press "back" and "left". The same to the right)
Speed: Slide to adjust the speed of the robot's movement.
4. Arm Control Module
Control the robotic's movements：
l LEFT: The robotic arm turns to the left.
l RIGHT: The robotic arm turns to the right.
l ARM UP: The robotic arm rotates upward.
l ARM DOWN: The robotic arm rotates downward.
l HAND UP: The robotic hand rotates upward.
l HAND DOWN: The robotic hand rotates downward.
l GRAB: clamping chuck.
l LOOSE: Loosening the chuck.
l CAMERA UP: The camera rotates upward.
l CAMERA DOWN: The camera rotates downward.
5. Actions Module
l MOTION GET: switching watchdog mode. In this mode, the robot product stops moving and reacts to the moving objects detected in the camera, and the moving objects are framed in the video of the Vedio module.
l AUTO MATIC: switching automatic obstacle avoidance mode. In this mode, the robot product will automatically advance and use the ultrasonic module to detect obstacles. When encountering obstacles, try to find other ways.
l POLICE LIGHT: switching the police light mode. In this mode, the LED lights of the robot product will flash like a warning light.
l TRACK LINE: switching hunting mode. In this mode, the robot product will try to move along the white lines on the black ground.
l STEADY CAMERA: Keep the camera angle of view in a horizontal position by adjusting the camera servo.
6. FC Control Module
Control the color detection function on/off and color setup.
l COLROR: Select the color to be detected.
l START: Turn on/off the color detection function.
7. PWM INIT SET Module
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.
8. Ports Control Module
Control the Port 1, Port 2, and Port 3 on the board to turn on/off.
l 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_rasptankpro/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)
l 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.