- A DJI Robomaster EP Core robot.
- Python 3.x installed on your system.
- The following Python libraries installed:
- OpenCV (cv2)
- NumPy (numpy)
- Robomaster SDK (robomaster)
- Keyboard monitoring (keyboard)
Once you have the necessary setup, follow these steps:
- Clone the repository containing the project files.
- Ensure that the robot is connected to the same network as your computer.
- Run the Python script for the desired color line detection (e.g., Yellow.py, Red.py, Orange.py, Green.py, Blue.py).
- The robot will start the line following process, and the video feed with the detected lines will be displayed.
- Press 'q' on the keyboard to stop the program.
- Yellow.py
- Red.py
- Orange.py
- Green.py
- Blue.py
Each file contains the same core functionality, with the only difference being the color mask used for line detection.
You can customize the project by modifying the following parameters: Adjust the kp, ki, and kd values in the PIDController class to optimize the robot's line following performance. Update the lower_* and upper_* values in the color detection section to adjust the range of the color mask. Modify the threshold1 and threshold2 values in the edge detection part to improve the line detection accuracy. Adjust the parameters for the cv2.HoughLinesP() function, such as threshold, minLineLength, and maxLineGap, to fine-tune the line detection.