日常更新
This commit is contained in:
153
app/gl_barrier.c
153
app/gl_barrier.c
@@ -23,8 +23,28 @@ void CheckBarrier()
|
|||||||
|
|
||||||
void RunBarrier()
|
void RunBarrier()
|
||||||
{
|
{
|
||||||
if (barrier_type == BARRIER_LEFT_BEGIN||barrier_type == BARRIER_LEFT_RUNNING) {
|
if (barrier_type == BARRIER_LEFT_BEGIN || barrier_type == BARRIER_LEFT_RUNNING) {
|
||||||
track_type = TRACK_RIGHT;
|
track_type = TRACK_RIGHT;
|
||||||
|
if (barrier_type == BARRIER_LEFT_BEGIN)
|
||||||
|
{
|
||||||
|
timer_clear(TIM_2);
|
||||||
|
timer_start(TIM_2);
|
||||||
|
barrier_type = BARRIER_LEFT_RUNNING;
|
||||||
|
}
|
||||||
|
if (barrier_type == BARRIER_LEFT_RUNNING)
|
||||||
|
{
|
||||||
|
if (timer_get(TIM_2) >= 500)
|
||||||
|
{
|
||||||
|
barrier_type = BARRIER_NONE;
|
||||||
|
timer_stop(TIM_2);
|
||||||
|
timer_clear(TIM_2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
barrier_type = BARRIER_LEFT_RUNNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (barrier_begin_flag == 0) {
|
// if (barrier_begin_flag == 0) {
|
||||||
// timer_clear(TIM_3);
|
// timer_clear(TIM_3);
|
||||||
// timer_start(TIM_3);
|
// timer_start(TIM_3);
|
||||||
@@ -46,31 +66,35 @@ void RunBarrier()
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (pts_resample_left_count >= 5)
|
// if (pts_resample_left_count >= 5) {
|
||||||
{
|
// if (Lpt0_found) {
|
||||||
if (Lpt0_found) {
|
// Lpt0_found_count++;
|
||||||
Lpt0_found_count++;
|
// }
|
||||||
}
|
// if (Lpt0_found_count >= 1 && barrier_type == BARRIER_LEFT_BEGIN) {
|
||||||
if (Lpt0_found_count >= 1 && barrier_type == BARRIER_LEFT_BEGIN) {
|
// Lpt0_found_count = 0;
|
||||||
Lpt0_found_count = 0;
|
// barrier_type = BARRIER_LEFT_RUNNING;
|
||||||
barrier_type = BARRIER_LEFT_RUNNING;
|
// track_type = TRACK_RIGHT;
|
||||||
track_type = TRACK_RIGHT;
|
// timer_clear(TIM_2);
|
||||||
timer_clear(TIM_2);
|
// timer_start(TIM_2);
|
||||||
timer_start(TIM_2);
|
// } else if (barrier_type == BARRIER_LEFT_RUNNING) {
|
||||||
} else if (barrier_type == BARRIER_LEFT_RUNNING) {
|
// track_type = TRACK_RIGHT;
|
||||||
track_type = TRACK_RIGHT;
|
// if (timer_get(TIM_2) >= 500) {
|
||||||
if (timer_get(TIM_2) >= 500) {
|
// barrier_type = BARRIER_NONE;
|
||||||
barrier_type = BARRIER_NONE;
|
// track_type = TRACK_RIGHT;
|
||||||
track_type = TRACK_RIGHT;
|
// timer_stop(TIM_2);
|
||||||
timer_stop(TIM_2);
|
// timer_clear(TIM_2);
|
||||||
timer_clear(TIM_2);
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// } else {
|
||||||
}
|
// track_type = TRACK_RIGHT;
|
||||||
else{
|
// barrier_type = BARRIER_NONE;
|
||||||
track_type = TRACK_RIGHT;
|
// }
|
||||||
barrier_type = BARRIER_NONE;
|
|
||||||
}
|
// if (barrier_type == BARRIER_LEFT_RUNNING) {
|
||||||
|
// if (pts_resample_left_count >= 5 && pts_resample_right_count >= 5) {
|
||||||
|
// barrier_type = BARRIER_NONE;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// if (Lpt0_found) {
|
// if (Lpt0_found) {
|
||||||
// Lpt0_found_count++;
|
// Lpt0_found_count++;
|
||||||
@@ -92,8 +116,26 @@ void RunBarrier()
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (barrier_type == BARRIER_RIGHT_BEGIN||barrier_type == BARRIER_RIGHT_RUNNING) {
|
if (barrier_type == BARRIER_RIGHT_BEGIN || barrier_type == BARRIER_RIGHT_RUNNING) {
|
||||||
track_type = TRACK_LEFT;
|
track_type = TRACK_LEFT;
|
||||||
|
if (barrier_type == BARRIER_RIGHT_BEGIN)
|
||||||
|
{
|
||||||
|
timer_clear(TIM_2);
|
||||||
|
timer_start(TIM_2);
|
||||||
|
barrier_type = BARRIER_RIGHT_RUNNING;
|
||||||
|
}
|
||||||
|
if (barrier_type == BARRIER_RIGHT_RUNNING)
|
||||||
|
{
|
||||||
|
if (timer_get(TIM_2) >= 500)
|
||||||
|
{
|
||||||
|
barrier_type = BARRIER_NONE;
|
||||||
|
timer_stop(TIM_2);
|
||||||
|
timer_clear(TIM_2);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
barrier_type = BARRIER_RIGHT_RUNNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
// if (barrier_begin_flag == 0) {
|
// if (barrier_begin_flag == 0) {
|
||||||
// timer_clear(TIM_3);
|
// timer_clear(TIM_3);
|
||||||
// timer_start(TIM_3);
|
// timer_start(TIM_3);
|
||||||
@@ -115,31 +157,35 @@ void RunBarrier()
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (pts_resample_right_count >= 5)
|
// if (pts_resample_right_count >= 5) {
|
||||||
{
|
// if (Lpt1_found) {
|
||||||
if (Lpt1_found) {
|
// Lpt1_found_count++;
|
||||||
Lpt1_found_count++;
|
// }
|
||||||
}
|
// if (Lpt1_found_count >= 1 && barrier_type == BARRIER_RIGHT_BEGIN) {
|
||||||
if (Lpt1_found_count >= 1 && barrier_type == BARRIER_RIGHT_BEGIN) {
|
// Lpt1_found_count = 0;
|
||||||
Lpt1_found_count = 0;
|
// barrier_type = BARRIER_RIGHT_RUNNING;
|
||||||
barrier_type = BARRIER_RIGHT_RUNNING;
|
// track_type = TRACK_LEFT;
|
||||||
track_type = TRACK_LEFT;
|
// timer_clear(TIM_2);
|
||||||
timer_clear(TIM_2);
|
// timer_start(TIM_2);
|
||||||
timer_start(TIM_2);
|
// } else if (barrier_type == BARRIER_RIGHT_RUNNING) {
|
||||||
} else if (barrier_type == BARRIER_RIGHT_RUNNING) {
|
// track_type = TRACK_LEFT;
|
||||||
track_type = TRACK_LEFT;
|
// if (timer_get(TIM_2) >= 500) {
|
||||||
if (timer_get(TIM_2) >= 500) {
|
// timer_stop(TIM_2);
|
||||||
timer_stop(TIM_2);
|
// timer_clear(TIM_2);
|
||||||
timer_clear(TIM_2);
|
// barrier_type = BARRIER_NONE;
|
||||||
barrier_type = BARRIER_NONE;
|
// track_type = TRACK_LEFT;
|
||||||
track_type = TRACK_LEFT;
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// } else {
|
||||||
}
|
// track_type = TRACK_LEFT;
|
||||||
else{
|
// barrier_type = BARRIER_NONE;
|
||||||
track_type = TRACK_LEFT;
|
// }
|
||||||
barrier_type = BARRIER_NONE;
|
|
||||||
}
|
// if (barrier_type == BARRIER_RIGHT_RUNNING) {
|
||||||
|
// if (pts_resample_left_count >= 5 && pts_resample_right_count >= 5) {
|
||||||
|
// barrier_type = BARRIER_NONE;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +226,6 @@ void RunS()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// void Check_shield(){
|
// void Check_shield(){
|
||||||
// if (begin_flag == 1)
|
// if (begin_flag == 1)
|
||||||
// {
|
// {
|
||||||
@@ -196,6 +241,4 @@ void RunS()
|
|||||||
// timer_clear(TIM_3);
|
// timer_clear(TIM_3);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
@@ -15,6 +15,8 @@ int32_t Right_Border_ToLeft_Circle = 0;
|
|||||||
int32_t Left_Border_ToRight_Circle = 0;
|
int32_t Left_Border_ToRight_Circle = 0;
|
||||||
int32_t Right_Border_ToRight_Circle = 0;
|
int32_t Right_Border_ToRight_Circle = 0;
|
||||||
|
|
||||||
|
int32_t ceshi = 0;
|
||||||
|
|
||||||
void CheckCircle()
|
void CheckCircle()
|
||||||
{
|
{
|
||||||
// 非圆环模式下,单边L角点, 单边长直道
|
// 非圆环模式下,单边L角点, 单边长直道
|
||||||
@@ -59,7 +61,7 @@ void RunCircle()
|
|||||||
}
|
}
|
||||||
} else if (circle_type == CIRCLE_LEFT_RUNNING) // 正常巡线,寻外圆右线
|
} else if (circle_type == CIRCLE_LEFT_RUNNING) // 正常巡线,寻外圆右线
|
||||||
{
|
{
|
||||||
//track_type = TRACK_RIGHT;
|
// track_type = TRACK_RIGHT;
|
||||||
track_type = TRACK_LEFT; // 看看加一个如果丢线才切换
|
track_type = TRACK_LEFT; // 看看加一个如果丢线才切换
|
||||||
if (Lpt1_found) {
|
if (Lpt1_found) {
|
||||||
pts_resample_right_count = mid_right_count = Lpt1_rpts1s_id;
|
pts_resample_right_count = mid_right_count = Lpt1_rpts1s_id;
|
||||||
@@ -125,7 +127,7 @@ void RunCircle()
|
|||||||
} else if (circle_type == CIRCLE_RIGHT_RUNNING) // 正常巡线,寻外圆左线
|
} else if (circle_type == CIRCLE_RIGHT_RUNNING) // 正常巡线,寻外圆左线
|
||||||
{
|
{
|
||||||
track_type = TRACK_RIGHT;
|
track_type = TRACK_RIGHT;
|
||||||
//track_type = TRACK_LEFT; // 看看加一个如果丢线才切换
|
// track_type = TRACK_LEFT; // 看看加一个如果丢线才切换
|
||||||
if (Lpt0_found) // 外环存在拐点,可再加拐点距离判据 (左 L 点)
|
if (Lpt0_found) // 外环存在拐点,可再加拐点距离判据 (左 L 点)
|
||||||
{
|
{
|
||||||
pts_resample_left_count = mid_left_count = Lpt0_rpts0s_id;
|
pts_resample_left_count = mid_left_count = Lpt0_rpts0s_id;
|
||||||
@@ -149,13 +151,13 @@ void RunCircle()
|
|||||||
{
|
{
|
||||||
Right_Border_None_Circle++;
|
Right_Border_None_Circle++;
|
||||||
}
|
}
|
||||||
if (pts_resample_right_count > 0.7 / RESAMPLEDIST &&
|
if (pts_resample_right_count > (0.7 / RESAMPLEDIST) && Right_Border_None_Circle > FRAMENONE) {
|
||||||
Right_Border_None_Circle > FRAMENONE) {
|
|
||||||
circle_type = CIRCLE_NONE;
|
circle_type = CIRCLE_NONE;
|
||||||
Right_Border_None_Circle = 0;
|
Right_Border_None_Circle = 0;
|
||||||
Right_Border_Have_Circle = 0;
|
Right_Border_Have_Circle = 0;
|
||||||
Left_Border_ToLeft_Circle = 0;
|
Left_Border_ToLeft_Circle = 0;
|
||||||
Left_Border_ToRight_Circle = 0;
|
Left_Border_ToRight_Circle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ enum circle_type_e {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern enum circle_type_e circle_type;
|
extern enum circle_type_e circle_type;
|
||||||
|
extern int32_t ceshi;
|
||||||
|
|
||||||
void CheckCircle(void);
|
void CheckCircle(void);
|
||||||
void RunCircle(void);
|
void RunCircle(void);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#define SELFADAPT_OFFSET (8) // 适应性块大小
|
#define SELFADAPT_OFFSET (8) // 适应性块大小
|
||||||
#define PIXPERMETER (70.0f)
|
#define PIXPERMETER (70.0f)
|
||||||
#define PIXPERMETER_ACROSS (72.0f)
|
#define PIXPERMETER_ACROSS (72.0f)
|
||||||
|
#define PIXPERMETER_ACROSS_BARRIER (10.0f)
|
||||||
#define RESAMPLEDIST (0.02f)
|
#define RESAMPLEDIST (0.02f)
|
||||||
#define ANGLEDIST (0.2f)
|
#define ANGLEDIST (0.2f)
|
||||||
#define ANGLEDIST_barrier (0.06f)
|
#define ANGLEDIST_barrier (0.06f)
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ void cross_farline(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*如果一行全为白色没写*/
|
/*如果一行全为白色没写*/
|
||||||
if (far_x1 <= 30)
|
if (far_x1 <= 4)
|
||||||
{
|
{
|
||||||
far_x1 = 30;
|
far_x1 = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; h1 > 0; h1--) {
|
for (; h1 > 0; h1--) {
|
||||||
@@ -98,9 +98,9 @@ void cross_farline(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*如果一行全为白色没写*/
|
/*如果一行全为白色没写*/
|
||||||
if (far_x2 >= 120)
|
if (far_x2 >= 136)
|
||||||
{
|
{
|
||||||
far_x2 = 120;
|
far_x2 = 136;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; h2 > 0; h2--) {
|
for (; h2 > 0; h2--) {
|
||||||
|
|||||||
@@ -47,11 +47,15 @@ int32_t pts_far_resample_right_count;
|
|||||||
|
|
||||||
float mid_left[PT_MAXLEN][2];
|
float mid_left[PT_MAXLEN][2];
|
||||||
float mid_right[PT_MAXLEN][2];
|
float mid_right[PT_MAXLEN][2];
|
||||||
|
float mid_left_barrier[PT_MAXLEN][2];
|
||||||
|
float mid_right_barrier[PT_MAXLEN][2];
|
||||||
|
|
||||||
float mid_s[PT_MAXLEN][2];
|
float mid_s[PT_MAXLEN][2];
|
||||||
|
|
||||||
int32_t mid_left_count;
|
int32_t mid_left_count;
|
||||||
int32_t mid_right_count;
|
int32_t mid_right_count;
|
||||||
|
int32_t mid_left_barrier_count;
|
||||||
|
int32_t mid_right_barrier_count;
|
||||||
|
|
||||||
float angle_new_left[PT_MAXLEN];
|
float angle_new_left[PT_MAXLEN];
|
||||||
float angle_new_right[PT_MAXLEN];
|
float angle_new_right[PT_MAXLEN];
|
||||||
|
|||||||
@@ -57,9 +57,14 @@ extern int32_t pts_far_resample_right_count;
|
|||||||
extern float mid_left[PT_MAXLEN][2];
|
extern float mid_left[PT_MAXLEN][2];
|
||||||
extern float mid_right[PT_MAXLEN][2];
|
extern float mid_right[PT_MAXLEN][2];
|
||||||
extern float mid_s[PT_MAXLEN][2];
|
extern float mid_s[PT_MAXLEN][2];
|
||||||
|
extern float mid_left_barrier[PT_MAXLEN][2];
|
||||||
|
extern float mid_right_barrier[PT_MAXLEN][2];
|
||||||
|
|
||||||
extern int32_t mid_left_count;
|
extern int32_t mid_left_count;
|
||||||
extern int32_t mid_right_count;
|
extern int32_t mid_right_count;
|
||||||
|
extern int32_t mid_left_barrier_count;
|
||||||
|
extern int32_t mid_right_barrier_count;
|
||||||
|
|
||||||
|
|
||||||
extern float angle_new_left[PT_MAXLEN];
|
extern float angle_new_left[PT_MAXLEN];
|
||||||
extern float angle_new_right[PT_MAXLEN];
|
extern float angle_new_right[PT_MAXLEN];
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ void CheckGarage()
|
|||||||
int banmaxian_hangshu = 0;//斑马线行数
|
int banmaxian_hangshu = 0;//斑马线行数
|
||||||
|
|
||||||
//从下往上扫描
|
//从下往上扫描
|
||||||
for (int y = BEGINH_L + 2; y >= BEGINH_L - 2; y--)
|
for (int y = BEGINH_L + 4; y >= BEGINH_L - 4; y--)
|
||||||
{
|
{
|
||||||
int banmaxian_kuandu=0;
|
int banmaxian_kuandu=0;
|
||||||
//int banmaxian_hangshu=0;
|
//int banmaxian_hangshu=0;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
enum garage_type_e {
|
enum garage_type_e {
|
||||||
GARAGE_NONE, // 非车库模式
|
GARAGE_NONE, // 非车库模式
|
||||||
GARAGE_FOUND,
|
GARAGE_FOUND,
|
||||||
|
OUT_STOP,
|
||||||
};
|
};
|
||||||
extern enum garage_type_e garage_type;
|
extern enum garage_type_e garage_type;
|
||||||
|
|
||||||
|
|||||||
@@ -146,5 +146,11 @@ void img_processing() {
|
|||||||
GetMidLine_Right(pts_resample_right, pts_resample_right_count, mid_right, (int) round(ANGLEDIST / RESAMPLEDIST), PIXPERMETER_ACROSS * ROADWIDTH / 2);
|
GetMidLine_Right(pts_resample_right, pts_resample_right_count, mid_right, (int) round(ANGLEDIST / RESAMPLEDIST), PIXPERMETER_ACROSS * ROADWIDTH / 2);
|
||||||
mid_right_count = pts_resample_right_count;
|
mid_right_count = pts_resample_right_count;
|
||||||
|
|
||||||
|
// 左右中线跟踪(避障专属)
|
||||||
|
GetMidLine_Left(pts_resample_left, pts_resample_left_count, mid_left_barrier, (int) round(ANGLEDIST / RESAMPLEDIST), PIXPERMETER_ACROSS_BARRIER * ROADWIDTH / 2);
|
||||||
|
mid_left_barrier_count = pts_resample_left_count;
|
||||||
|
GetMidLine_Right(pts_resample_right, pts_resample_right_count, mid_right_barrier, (int) round(ANGLEDIST / RESAMPLEDIST), PIXPERMETER_ACROSS_BARRIER * ROADWIDTH / 2);
|
||||||
|
mid_right_barrier_count = pts_resample_right_count;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -139,13 +139,16 @@ void ElementJudge()
|
|||||||
cross_type = CROSS_NONE;
|
cross_type = CROSS_NONE;
|
||||||
circle_type = CIRCLE_NONE;
|
circle_type = CIRCLE_NONE;
|
||||||
barrier_type = BARRIER_NONE;
|
barrier_type = BARRIER_NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (cross_type != CROSS_NONE) {
|
if (cross_type != CROSS_NONE) {
|
||||||
circle_type = CIRCLE_NONE;
|
circle_type = CIRCLE_NONE;
|
||||||
barrier_type = BARRIER_NONE;
|
barrier_type = BARRIER_NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (barrier_type != BARRIER_NONE) {
|
if (barrier_type != BARRIER_NONE) {
|
||||||
circle_type = CIRCLE_NONE;
|
circle_type = CIRCLE_NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +186,16 @@ void MidLineTrack()
|
|||||||
GetMidLine_Right(pts_far_resample_right + far_Lpt1_rpts1s_id, pts_far_resample_right_count - far_Lpt1_rpts1s_id, mid_right, (int)round(ANGLEDIST / RESAMPLEDIST), PIXPERMETER * ROADWIDTH / 2);
|
GetMidLine_Right(pts_far_resample_right + far_Lpt1_rpts1s_id, pts_far_resample_right_count - far_Lpt1_rpts1s_id, mid_right, (int)round(ANGLEDIST / RESAMPLEDIST), PIXPERMETER * ROADWIDTH / 2);
|
||||||
mid_track_count = pts_far_resample_right_count - far_Lpt1_rpts1s_id;
|
mid_track_count = pts_far_resample_right_count - far_Lpt1_rpts1s_id;
|
||||||
}
|
}
|
||||||
|
} else if (barrier_type == BARRIER_LEFT_RUNNING || barrier_type == BARRIER_RIGHT_RUNNING)
|
||||||
|
{
|
||||||
|
if (track_type == TRACK_LEFT) {
|
||||||
|
mid_track = mid_left_barrier;
|
||||||
|
mid_track_count = mid_left_barrier_count;
|
||||||
} else {
|
} else {
|
||||||
|
mid_track = mid_right_barrier;
|
||||||
|
mid_track_count = mid_right_barrier_count;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
if (track_type == TRACK_LEFT) {
|
if (track_type == TRACK_LEFT) {
|
||||||
mid_track = mid_left;
|
mid_track = mid_left;
|
||||||
mid_track_count = mid_left_count;
|
mid_track_count = mid_left_count;
|
||||||
@@ -287,17 +299,10 @@ void MidLineTrack()
|
|||||||
switch (barrier_type) {
|
switch (barrier_type) {
|
||||||
case BARRIER_LEFT_BEGIN:
|
case BARRIER_LEFT_BEGIN:
|
||||||
// dx_near = mid_track[aim_idx_near][1] - cx + barrier_offset;
|
// dx_near = mid_track[aim_idx_near][1] - cx + barrier_offset;
|
||||||
pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * 0.5f * dx / dn) / PI32 * 180.0f - 20;
|
pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * 0.5f * dx / dn) / PI32 * 180.0f;
|
||||||
break;
|
|
||||||
case BARRIER_LEFT_RUNNING:
|
|
||||||
pure_angle = 15.f;
|
|
||||||
break;
|
break;
|
||||||
case BARRIER_RIGHT_BEGIN:
|
case BARRIER_RIGHT_BEGIN:
|
||||||
pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * 0.5f * dx / dn) / PI32 * 180.0f + 20;
|
pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * 0.5f * dx / dn) / PI32 * 180.0f;
|
||||||
break;
|
|
||||||
case BARRIER_RIGHT_RUNNING:
|
|
||||||
// dx_near = mid_track[aim_idx_near][1] - cx - barrier_offset;
|
|
||||||
pure_angle = -15.f;
|
|
||||||
default:
|
default:
|
||||||
// pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * 0.5f * dx / dn) / PI32 * 180.0f;
|
// pure_angle = -atanf(PIXPERMETER * 2.0f * 0.2f * 0.5f * dx / dn) / PI32 * 180.0f;
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
@@ -309,12 +314,10 @@ void MidLineTrack()
|
|||||||
// pure_angle_half = last_pure_angle_half;
|
// pure_angle_half = last_pure_angle_half;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (garage_type == GARAGE_FOUND)
|
if (garage_type == GARAGE_FOUND) {
|
||||||
{
|
|
||||||
pure_angle = 0.f;
|
pure_angle = 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (barrier_type == BARRIER_LEFT_BEGIN) {
|
// if (barrier_type == BARRIER_LEFT_BEGIN) {
|
||||||
// // dx_near = mid_track[aim_idx_near][1] - cx + barrier_offset;
|
// // dx_near = mid_track[aim_idx_near][1] - cx + barrier_offset;
|
||||||
// pure_angle = -25.f;
|
// pure_angle = -25.f;
|
||||||
@@ -349,7 +352,7 @@ void MidLineTrack()
|
|||||||
timer_clear(TIM_3);
|
timer_clear(TIM_3);
|
||||||
timer_start(TIM_3);
|
timer_start(TIM_3);
|
||||||
}
|
}
|
||||||
if (circle_type == CIRCLE_LEFT_RUNNING || circle_type == CIRCLE_RIGHT_RUNNING || circle_type == CIRCLE_RIGHT_OUT || circle_type == CIRCLE_LEFT_OUT || circle_type == CIRCLE_LEFT_END || circle_type == CIRCLE_RIGHT_END) {
|
if (circle_type == CIRCLE_LEFT_RUNNING || circle_type == CIRCLE_RIGHT_RUNNING || circle_type == CIRCLE_RIGHT_OUT || circle_type == CIRCLE_LEFT_OUT) {
|
||||||
if (circle_flag == 1) {
|
if (circle_flag == 1) {
|
||||||
state_type = CIRCLE_STATE;
|
state_type = CIRCLE_STATE;
|
||||||
}
|
}
|
||||||
@@ -370,6 +373,12 @@ void MidLineTrack()
|
|||||||
circle_flag = 1;
|
circle_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (circle_type == CIRCLE_LEFT_END || circle_type == CIRCLE_RIGHT_END)
|
||||||
|
{
|
||||||
|
state_type = STRAIGHT_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (barrier_type == BARRIER_LEFT_BEGIN || barrier_type == BARRIER_LEFT_RUNNING || barrier_type == BARRIER_RIGHT_BEGIN || barrier_type == BARRIER_RIGHT_RUNNING) {
|
if (barrier_type == BARRIER_LEFT_BEGIN || barrier_type == BARRIER_LEFT_RUNNING || barrier_type == BARRIER_RIGHT_BEGIN || barrier_type == BARRIER_RIGHT_RUNNING) {
|
||||||
state_type = BARRIER_STATE;
|
state_type = BARRIER_STATE;
|
||||||
}
|
}
|
||||||
@@ -399,4 +408,13 @@ void MidLineTrack()
|
|||||||
// timer_clear(TIM_3);
|
// timer_clear(TIM_3);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (state_type != BARRIER_STATE || garage_type != GARAGE_FOUND) {
|
||||||
|
if ((pts_left_count <= 2) && (pts_right_count <= 2) && (GET_PIX_1C(mt9v03x_image_copy[0], BEGINH_L, IMAGE_W / 2 - BEGINW_R) <= FIX_BINTHRESHOLD) && (GET_PIX_1C(mt9v03x_image_copy[0], BEGINH_L, IMAGE_W / 2 + BEGINW_L) <= FIX_BINTHRESHOLD)) {
|
||||||
|
garage_type = OUT_STOP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
garage_type = GARAGE_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ static void Loop()
|
|||||||
ips200_show_int(90, 18 + 38, track_type, 1);
|
ips200_show_int(90, 18 + 38, track_type, 1);
|
||||||
ips200_show_int(90, 18 + 56, garage_type, 1);
|
ips200_show_int(90, 18 + 56, garage_type, 1);
|
||||||
ips200_show_int(90, 18 + 74, cross_type, 1);
|
ips200_show_int(90, 18 + 74, cross_type, 1);
|
||||||
ips200_show_int(90, 18 + 92, circle_type, 1);
|
ips200_show_int(90, 18 + 92, circle_type, 2);
|
||||||
ips200_show_int(90, 18 + 110, s_type, 1);
|
ips200_show_int(90, 18 + 110, s_type, 1);
|
||||||
ips200_show_float(90, 18 + 128, curvature, 4, 5);
|
ips200_show_float(90, 18 + 128, curvature, 4, 5);
|
||||||
ips200_show_int(90, 18 + 146, Lpt0_found_barrier_in, 1);
|
ips200_show_int(90, 18 + 146, Lpt0_found_barrier_in, 1);
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ static void Loop()
|
|||||||
ips200_show_uint(160, 224, Lpt1_found_barrier_in, 3);
|
ips200_show_uint(160, 224, Lpt1_found_barrier_in, 3);
|
||||||
ips200_show_uint(200, 165, barrier_type, 3);
|
ips200_show_uint(200, 165, barrier_type, 3);
|
||||||
ips200_show_uint(200, 185, state_type, 5);
|
ips200_show_uint(200, 185, state_type, 5);
|
||||||
|
//ips200_show_uint(200, 205, ceshi, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user