金牌会员
 
- 积分
- 1589
- 威望
- 778
- 贡献
- 511
- 兑换币
- 449
- 注册时间
- 2012-11-29
- 在线时间
- 150 小时
|
5#

楼主 |
发表于 2014-5-11 10:09:18
|
只看该作者
来套算曲率的,智能车书上写的- void chuli()
- {
- int x1,x2,x3,y1,y2,y3;
- unsigned int length1,length2,length3;
- int S;
-
- y1=5;
- y2=10;
- y3=15;
-
- x1=Center[2];
- x2=Center[1];
- x3=Center[0];
-
- S=abs((y2-y1)*(x3-x1)-(y3-y1)*(x2-x1));
- length1=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
- length2=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
- length3=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
- if(S<1)
- S=1;
- K=abs((length1*length2*length3)/S);//曲率的倒数,即曲率半径
- Center_Average=mid(Center[0],Center[1],Center[2]);
- ADV[Left[0]]=0;
- ADV[Right[0]]=0;
- Angle_PID(Center_Average);
- }
复制代码 |
|