CCD dual tracking-Mini chassis1.Experimental Purpose2.Experimental preparation3.Experimental wiring3.1 Jumpers are required for the wiring of the ROS expansion board and the 310 motor3.2 3.2 Wiring of ROS expansion board, linear CCD module, and OLED screen4.Program source code analysis5.note6.experimental result
Through the previous experiment, we learned how the linear CCD module tracks along the black line. In this experiment, we increased our efforts to have the CCD track between the two black lines.
This experiment requires an ROS expansion board, a Chinese racing chassis car, a 310 motor, a 7.4V battery, a linear CCD module, and an OLED screen (not required)
These hardware can be purchased from Yabo Intelligent's Taobao store
The line sequence of the two is shown in the following figure:
M1--->M+
M2--->M-

This project introduces a real-time operating system for Freeros, and we will look at vTask ourselves_ The CCD thread function is sufficient, and other thread functions are not closely related to this experiment. Interested parties can analyze it on their own. vTask_CCD:This task is to first determine whether the freeros system is normal, and if it is normal, enter the APP_ CCD_ The following will focus on analyzing the processing function for the tracking task of Handle
void APP_CCD_Handle(void){ CCD_Read_TSL(); g_ccd_median = 64 - CCD_Find_Median(); if((g_ccd_median>-5&&g_ccd_median<5)||g_ccd_median == 64)//Straight travel { g_ccd_median = 0; } OLED_Show_CCD_Image(CCD_Get_ADC_128X32()); pid_output = (int)(APP_CCD_PID_Calc(g_ccd_median)); Motion_Ctrl(CCD_SPEED, 0, pid_output, 0);}

You can see that the car is tracking normally on the black and white line. For a detailed tracking video, please refer to the introduction video of the CCD module on Taobao, a flagship store of Yabo Intelligent.
Alternatively, check out a short follow-up video of this experiment.
Other reference tutorials: https://blog.csdn.net/Gxust_Veneno/article/details/119797411