Merge branch 'master' of http://git.isthmus.tk:441/btl143/firmware_violet_zf
This commit is contained in:
96
app/main.c
96
app/main.c
@@ -33,32 +33,106 @@
|
||||
* 2022-09-15 <20><> W first version
|
||||
********************************************************************************************************************/
|
||||
#include "zf_common_headfile.h"
|
||||
#include "gl_headfile.h"
|
||||
#include "cw_servo.h"
|
||||
#include "by_pt_button.h"
|
||||
#include "by_fan_control.h"
|
||||
|
||||
uint8 mt9v03x_image_cp[MT9V03X_H][MT9V03X_W];
|
||||
uint16_t pwm_cnt = 0;
|
||||
uint8 (*Img_Gray)[MT9V03X_W]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MT9V03X_W <20>е<EFBFBD> uint8 <20><><EFBFBD>͵Ķ<CDB5>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
//uint8 *mt9v03x_image_copy[0]; // <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> uint8 <20><><EFBFBD>͵<EFBFBD>һά<D2BB><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
sint32 pts_left[PT_MAXLEN][2], pts_right[PT_MAXLEN][2];
|
||||
sint32 pts_left_count, pts_right_count;
|
||||
float32 pts_inv_l[PT_MAXLEN][2], pts_inv_r[PT_MAXLEN][2];
|
||||
sint32 pts_inv_l_count, pts_inv_r_count;
|
||||
float32 pts_filter_l[PT_MAXLEN][2], pts_filter_r[PT_MAXLEN][2];
|
||||
sint32 pts_filter_l_count, pts_filter_r_count;
|
||||
float32 pts_resample_left[PT_MAXLEN][2], pts_resample_right[PT_MAXLEN][2];
|
||||
sint32 pts_resample_left_count, pts_resample_right_count;
|
||||
float32 mid_left[PT_MAXLEN][2], mid_right[PT_MAXLEN][2];
|
||||
sint32 mid_left_count, mid_right_count;
|
||||
|
||||
|
||||
//<2F><><EFBFBD>ұ<EFBFBD><D2B1>߾ֲ<DFBE><D6B2>Ƕȱ仯<C8B1><E4BBAF>+<2B>Ǽ<EFBFBD><C7BC><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||
float angle_new_left[PT_MAXLEN];
|
||||
float angle_new_right[PT_MAXLEN];
|
||||
int angle_new_left_num, angle_new_right_num;
|
||||
uint8_t mt9v03x_image_copy[MT9V03X_H][MT9V03X_W];
|
||||
|
||||
// <20><><EFBFBD>ұ<EFBFBD><D2B1>߾ֲ<DFBE><D6B2>Ƕȱ仯<C8B1><E4BBAF>
|
||||
float angle_left[PT_MAXLEN];
|
||||
float angle_right[PT_MAXLEN];
|
||||
int angle_left_num, angle_right_num;
|
||||
|
||||
// L<>ǵ<EFBFBD>
|
||||
int Lpt0_rpts0s_id, Lpt1_rpts1s_id;
|
||||
bool Lpt0_found, Lpt1_found;
|
||||
int Lpt1[2],Lpt0[2];
|
||||
|
||||
int Lpt_in0_rpts0s_id, Lpt_in1_rpts1s_id;
|
||||
bool Lpt_in0_found, Lpt_in1_found;
|
||||
int Lpt_in1[2], Lpt_in0[2];
|
||||
|
||||
// <20><>ֱ<EFBFBD><D6B1>
|
||||
bool is_straight0, is_straight1;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
bool is_turn0, is_turn1;
|
||||
|
||||
// <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float rptsn[PT_MAXLEN][2];
|
||||
int rptsn_num;
|
||||
float aim_distance;
|
||||
|
||||
enum track_type_e track_type = TRACK_RIGHT;
|
||||
|
||||
|
||||
int frame_count = 0;
|
||||
|
||||
void img_processing();
|
||||
void get_corners();
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clock_init(SYSTEM_CLOCK_120M); // <20><>ʼ<EFBFBD><CABC>оƬʱ<C6AC><CAB1> <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Ϊ 120MHz
|
||||
debug_init(); // <20><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC> MPU ʱ<><CAB1> <20><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>
|
||||
|
||||
mt9v03x_init();
|
||||
ips114_init();
|
||||
by_gpio_init();
|
||||
by_exit_init();
|
||||
by_pwm_init();
|
||||
cw_servo_init();
|
||||
// mt9v03x_init();
|
||||
// <20>˴<EFBFBD><CBB4><EFBFBD>д<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
|
||||
while (1) {
|
||||
// <20>˴<EFBFBD><CBB4><EFBFBD>д<EFBFBD><D0B4>Ҫѭ<D2AA><D1AD>ִ<EFBFBD>еĴ<D0B5><C4B4><EFBFBD>
|
||||
//while (frame_count < 20) {
|
||||
// if (mt9v03x_finish_flag) {
|
||||
// memcpy(mt9v03x_image_copy[0], mt9v03x_image[0], (sizeof(mt9v03x_image_copy) / sizeof(uint8_t)));
|
||||
// adaptiveThreshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, 188, 120, 7, 8);
|
||||
// //threshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, MT9V03X_W, MT9V03X_H, 110);
|
||||
// ips114_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
|
||||
// mt9v03x_finish_flag = 0;
|
||||
// frame_count++;
|
||||
// }
|
||||
|
||||
//}
|
||||
if (mt9v03x_finish_flag) {
|
||||
//ips114_show_gray_image(0, 0, mt9v03x_image[0], 188, 120, 188, 120,0);
|
||||
memcpy(mt9v03x_image_copy[0], mt9v03x_image[0],(sizeof(mt9v03x_image_copy)/sizeof(uint8_t)));
|
||||
//Img_Gray = mt9v03x_image;
|
||||
//mt9v03x_image_copy[0] = Img_Gray[0];
|
||||
mt9v03x_finish_flag = 0;
|
||||
|
||||
state_type = COMMON_STATE;
|
||||
img_processing();
|
||||
get_corners();
|
||||
aim_distance = COMMON_AIM;
|
||||
tracking();
|
||||
ElementJudge();
|
||||
ElementRun();
|
||||
MidLineTrack();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// <20>˴<EFBFBD><CBB4><EFBFBD>д<EFBFBD><D0B4>Ҫѭ<D2AA><D1AD>ִ<EFBFBD>еĴ<D0B5><C4B4><EFBFBD>
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user