In the kit, there are two control methods: Web control and Python program control.
In this chapter, we are provided with method of web control. So we can open the browser on different devices, including computer, cellphone（Recommended）, tablet and so on. You can use most functions of Picar-4wd, such as obstacle avoidance, line-following, object following and voltage check.
Note: Check the next chapter if you want to use python to control Picar-4wd.
Boot Web Control
Input the command and start up the web control program.
As the program is running, on the browser, type the IP of the Raspberry Pi, and you can enter the Web interface.
- Arrow Key
- Power Regulator
- Obstacle Monitor: checking the obstacle ahead within 35cm and 180°. Red dot represents there is an obstacle ahead detected by ultrasonic module.
- Grayscale Monitor: displaying the color condition of the detected surface. If the module detects the black lines and then the cliff, the different colors will display on the monitor.
- Speed Monitor
- Ultrasonic: turning on/off the obstacle monitor and the ultrasonic measurement function.
- Grayscale: turning on/off the grayscale monitor and the line following function.
- Avoid: turning on/off obstacle avoidance function can make the car get around the obstacles automatically or not.
- Follow: turning on/off line following function can let the car follow the objects ahead or not.
- Cliff: turn on/off edge detection. The car retreats once it detects the cliff or not. If the car doesn’t realize the effect, please adjust the threshold on the setting page.
- Path: to turn on/off line following function. Once you start up the line following function, the car will drive along the black lines on the ground. If not, please adjust the threshold on the setting page.
- Setting: You can enter the Setting page by clicking this one.
This page is used to test whether the ultrasonic sensor works well. The slider below can be used to adjust the current direction and angle of the ultrasonic sensor.
You can test the working condition of the wheels on this page.
Click a wheel then set the POWER, click the two buttons in bottom right corner. When you press the button at left, the wheel goes forward; press the button on the right, the wheel go backward. If the car doesn’t follow your operation like that, you should adjust the direction. The methods are as follows:
- Input the following command to open the configure file.
- In the configure file, the first 4 lines of codes are used to control the turning of the motor. The last line is used to adjust the angle of the servo. For example, if in the above test, the direction of the motor at bottom left is reverse, so we change the code in the third line to left_rear_reverse = True.
- Rerun the following commands.
- In the browser, click Retry, and you can test the direction of the wheel ready to be used.
On this page, you can adjust the threshold of the line following and cliff detection.
Put the Picar-4wd on the white surface and record these three values of Grayscale. Now the value of Grayscale is large enough, about 1500. Then put the grayscale sensor module of Picar-4wd above the black surface and record these three values of Grayscale. Now, the value of Grayscale gets relatively small, about 150 as is predicted. So we set the value of Line Reference to 400. Of course, you can change the value. Once you finish doing this, you can see that the corresponding area turning into gray if the value of Grayscale is larger than 400; if not so, turning into black.
Put the car at the edge of the desk with the car’s head sticking out from the desk. Record three values of Grayscale, and now the value is relatively small, less than 100. Please set the value of Cliff Reference to 110. When you finish doing this, the corresponding area appears red exclamation symbol if the value of Grayscale is less than 110.
You can check the operating condition of the system on this page.
- Make the example program run automatically at startup.
picar-4wd web-example enable
- If you want to turn off the Start on Boot, please type in the following command.
picar-4wd web-example disable