欢迎来到天天文库
浏览记录
ID:38427815
大小:15.67 KB
页数:3页
时间:2019-06-12
《路径识别代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、路径识别代码识别是用来设定速度的。。。简单的识别还是容易,贴个代码。。。其中gap值为极左极右差值,附for(i=49;i>=(M_Row_End+3);i--)//recored_end_row{if(Black_Flag[i].Mid_flag&&Black_Flag[i-3].Mid_flag){n=Runway_Midpoint[i-3]-Runway_Midpoint[i];if(n>=2)S_right++;elseif(n<=-2)S_left++;elseS_straight++
2、;}}voidRoad_S_Dis(void){prespeed_value=speed_value;if(curValidline<11){if(gap<=24)//包括了直道和小S弯{straight_flag++;straight_flag%=3000;}elseif(gap<=65)//入弯口{if(S_right>3&&S_left>3)Big_S=1;elsebend_flag=1;}else{zhongsu++;zhongsu%=3000;}//较远前瞻的弯,给定中速zhongsu
3、3_flag=0;danwan_flag=0;}elseif(M_Row_End<=22){if(gap>=75
4、
5、S_right>=(50-M_Row_End)-6
6、
7、S_left>=50-M_Row_End-6){danwan_flag++;danwan_flag%=3000;}//单向弯道,给定中速2elseif(gap>=45){if(S_right>3&&S_left>3)jiman_flag=1;//较近前瞻的S弯,给定慢速else{zhongsu2_flag++;zhongsu2_
8、flag%=3000;}//较近前瞻的缓慢程度弯道,给定中速danwan_flag=0;}else{jiaokuaisu_flag=1;danwan_flag=0;}//较近前瞻的平缓曲线,给定较快速度zhongsu3_flag=0;}elseif(M_Row_End<=33){if(gap>=80){danwan2_flag++;danwan2_flag%=3000;}//近前瞻的单向弯道,给定中速elseif(gap>=50
9、
10、S_right>50-M_Row_End-5
11、
12、S_left>5
13、0-M_Row_End-5)//近前瞻的急偏道,给定中慢速{zhongsu3_flag++;zhongsu3_flag%=3000;}else{mansu_flag=1;zhongsu3_flag=0;}//弯入十字中慢速danwan_flag=0;}else{if(gap>=20){mansu++;mansu%=3000;}else{kuaisu++;kuaisu%=3000;}//直道入十字情况zhongsu3_flag=0;danwan_flag=0;}if(straight_flag==
14、1)Hightest_speed=longtest_speed;elseif(bend_flag==1)Hightest_speed=longtest_speed-75;elseif(Big_S==1)Hightest_speed=longtest_speed-80;elseif(zhongsu==1)Hightest_speed=MidLongtest_speed+10;elseif(danwan_flag>0){if(danwan_flag==1)Hightest_speed=MidLong
15、test_speed;elseif(danwan_flag==2)Hightest_speed=MidLongtest_speed+50;elseHightest_speed=Hightest_speed+10>longtest_speed+50?longtest_speed+50:Hightest_speed+10;}elseif(jiman_flag==1)Hightest_speed=Midtest_speed;elseif(zhongsu2_flag==1)Hightest_speed=
16、MidLongtest_speed-20;elseif(jiaokuaisu_flag==1)Hightest_speed=MidLongtest_speed+20;elseif(danwan2_flag==1)Hightest_speed=MidLongtest_speed;elseif(zhongsu3_flag>0)//进入十字弯减速,然后加速{if(zhongsu3_flag==1)Hightest_speed=MidLongtest_speed;elseif(zhongsu3_flag
此文档下载收益归作者所有