Welcome to K210 Module repository
4.Identify and remove speed limit
Identify and remove speed limit
Identify and remove speed limit1.Experimental goal2. Experimental principle3.Main source code analysis4.Experimental results
1.Experimental goal
The purpose of this experiment is to combine the stm32 car with the k210 perspective module to identify the speed limit of the road sign, release the speed limit, and complete the map speed limit and release speed limit
2. Experimental principle
k210 transmits the recognized road sign information to STM32 through the serial port. The position of the stop line at the stm32 car will process the information of the k210 viewing angle module, so as to drive the motor to do the corresponding action
3.Main source code analysis
xxxxxxxxxxvoid Road_sign_speedlimit(void){ if(stop_flag)//Touched the stop line but exceeded a little bit, but did not receive k210 information, keep stopping { Motion_Set_Pwm(0,0,0,0);//stop return ; } if((IN_S1 == 0 || IN_S3 == 0) && IN_S2 == 1 && IN_S4 == 1) //go straight { Motion_Set_Pwm(60,0,60,0); } //Minor adjustments if(IN_S1 == 0 && IN_S3 == 1 && IN_S4 == 1 && IN_S2 == 1) { Motion_Set_Pwm(90,0,60,0); } else if(IN_S1 == 1 && IN_S3 == 0 && IN_S4 == 1 && IN_S2 == 1) { Motion_Set_Pwm(60,0,90,0); } //sharp left and right turns if(IN_S2 == 0 && IN_S3 == 1 ) { Motion_Set_Pwm(500,500,-350,-350); } else if(IN_S4 == 0 && IN_S1 == 1 ) { //Turn left Motion_Set_Pwm(-550,-550,550,550); } if((IN_S1 == 0 && IN_S2 == 0) && (IN_S3 == 0 && IN_S4 == 0))//all black lines { Motion_Set_Pwm(0,0,0,0);//stop delay_ms(300);//Don't Stop Before Misidentified Data stop_flag = 1;//Start receiving k210 information, interrupt processing }}Road_sign_speedlimit:When the smt32 car recognizes low-speed movement, it will enter the speed limit patrol movement.
stop_flag:When it is 1, it is necessary to process the information sent by k210, and change the corresponding state according to the information. When it is 0, the information of k210 is ignored.
4.Experimental results
Use the serial port burning tool to download the STM32_K210_AI.hex file in the OBJ folder in the stm32 source code provided in this tutorial This series of tutorials only provides the source code of the stm32 car part. If you only need a small part of the functions, you can transplant it into the source code
When the car recognizes the speed limit road sign at the stop line, the car enters the line patrol movement of the speed limit.
When the car recognizes the left turn at the stop line, the car resumes the normal movement of patrolling the line
