Welcome to K210 Module repository
5.Identify parking spaces and park
Identify parking spaces and park
Identify parking spaces and park1.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 No. 1 and No. 2 parking spaces of the road signs, and complete the automatic parking function on the map.
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
x//Parking at No. 1void Reverse_parking_no1(void){ bound_num = one; Motion_Set_Pwm(800,800,-1000,-1000); dao_delay(600); Motion_Set_Pwm(-50,-50,-50,-50); dao_delay(400); Car_outbound();}
//Parking at No. 2void Reverse_parking_no2(void){ bound_num = two; Motion_Set_Pwm(-50,-50,-50,-50); dao_delay(530); Motion_Set_Pwm(0,0,0,0); dao_delay(100); Motion_Set_Pwm(800,800,-1000,-1000); dao_delay(600); Motion_Set_Pwm(0,0,0,0); dao_delay(100); Motion_Set_Pwm(-50,-50,-50,-50); dao_delay(400); Car_outbound(); }
void Car_outbound(){ Motion_Set_Pwm(0,0,0,0); for(u8 i = 0;i<3 ;i++) { dao_delay(1000); } Motion_Set_Pwm(50,50,50,50); dao_delay(350); Motion_Set_Pwm(0,0,0,0); dao_delay(20); Motion_Set_Pwm(-1000,-1000,1000,1000); Motion_Set_Pwm(-400,-400,800,800); dao_delay(450); set_dataid(chuku_track_line);
}
dao_delay :In order to achieve the accuracy of the delay every time, this function uses a timer to calculate the time.
Reverse_parking_no1:Drive into the No. 1 warehouse
Reverse_parking_no2:Drive into the No. 2 warehouse
Car_outbound:Pull into the parking garage and stop for a few seconds to drive out If you drive into a parking space and find that the position of the parking space does not exactly match the stop position of the car, you can adjust the value of the delay time to make adjustments
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 No. 1 parking lot at the stop line, the car enters the movement of reversing the No. 1 parking garage, and then drives out to make a parking line inspection movement, and resumes the normal line inspection movement for a period of time.
When the car recognizes the No. 2 parking lot at the stop line, the car enters the movement of reversing the No. 2 parking garage, and then drives out to make a parking line inspection movement, and resumes the normal line inspection movement for a period of time.
