1
This commit is contained in:
@@ -20,7 +20,7 @@ void CheckCross()
|
|||||||
if (cross_type == CROSS_NONE && Xfound && cross_easy == 0) {
|
if (cross_type == CROSS_NONE && Xfound && cross_easy == 0) {
|
||||||
cross_type = CROSS_BEGIN;
|
cross_type = CROSS_BEGIN;
|
||||||
}
|
}
|
||||||
if (cross_type == CROSS_NONE && cross_easy == 1 && (Lpt0_found || Lpt1_found)) {
|
if (cross_type == CROSS_NONE && cross_easy == 1 && (((Lpt0_found || Lpt1_found) && (pts_resample_left_count <= 3 || pts_resample_right_count <= 3)) || Xfound)) {
|
||||||
cross_type = CROSS_BEGIN;
|
cross_type = CROSS_BEGIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ int8_t turn_flag = 0;
|
|||||||
int circle_flag = 1;
|
int circle_flag = 1;
|
||||||
int pingbi_num = 0;
|
int pingbi_num = 0;
|
||||||
int last_garage_type = GARAGE_NONE;
|
int last_garage_type = GARAGE_NONE;
|
||||||
|
float turn_threshold = 12.0f;
|
||||||
// 计算最小二乘法斜率的函数
|
// 计算最小二乘法斜率的函数
|
||||||
float leastSquaresSlope(float points[][2], int n)
|
float leastSquaresSlope(float points[][2], int n)
|
||||||
{
|
{
|
||||||
@@ -369,6 +370,16 @@ void MidLineTrack()
|
|||||||
{
|
{
|
||||||
aim_distance = cross_aim;
|
aim_distance = cross_aim;
|
||||||
}
|
}
|
||||||
|
if (curvature >= turn_threshold)
|
||||||
|
{
|
||||||
|
aim_distance = turn_aim;
|
||||||
|
}
|
||||||
|
if (curvature <= turn_threshold)
|
||||||
|
{
|
||||||
|
aim_distance = mid_aim;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ extern float curvature;
|
|||||||
|
|
||||||
extern int8_t turn_flag ;
|
extern int8_t turn_flag ;
|
||||||
extern float curvature;
|
extern float curvature;
|
||||||
|
extern float turn_threshold;
|
||||||
void aim_distance_select(void);
|
void aim_distance_select(void);
|
||||||
void tracking(void);
|
void tracking(void);
|
||||||
void ElementJudge(void);
|
void ElementJudge(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user