energy changed

This commit is contained in:
sun
2019-07-10 15:23:43 +08:00
parent 747fb58eb8
commit 403d267ff3
11 changed files with 248 additions and 181 deletions

View File

@@ -27,7 +27,7 @@ using namespace std;
mcu_data mcuData = { // 单片机端回传结构体
0, // 当前云台yaw角
0, // 当前云台pitch角
ARMOR_STATE, // 当前状态,自瞄-大符-小符
BIG_ENERGY_STATE, // 当前状态,自瞄-大符-小符
0, // 云台角度标记位
1, // 是否启用数字识别
ENEMY_RED, // 敌方颜色
@@ -37,7 +37,7 @@ WrapperHead *video_gimble = nullptr; // 云台摄像头视频源
WrapperHead *video_chassis = nullptr; // 底盘摄像头视频源
Serial serial(115200); // 串口对象
uint8_t last_state = mcuData.state; // 上次状态,用于初始化
uint8_t last_state = ARMOR_STATE; // 上次状态,用于初始化
// 自瞄主程序对象
ArmorFinder armorFinder(mcuData.enemy_color, serial, PROJECT_DIR"/tools/para/", mcuData.use_classifier);
// 能量机关主程序对象
@@ -97,16 +97,12 @@ int main(int argc, char *argv[]) {
ok = checkReconnect(video_gimble->read(gimble_src), video_chassis->read(chassis_src));//检查有几个摄像头
if (save_video) saveVideos(gimble_src, chassis_src);//保存视频
if (show_origin) showOrigin(gimble_src, chassis_src);//显示原始图像
// if (from_camera == 0) {
// cv::resize(chassis_src, chassis_src, cv::Size(640, 480), 2);
// imshow("resize", chassis_src);
// energy.extract(chassis_src);
// }
if (last_state != BIG_ENERGY_STATE) {//若上一帧不是大符模式,即刚往完成切换,则需要初始化
energy.setEnergyRotationInit();
cout << "set" << endl;
}
energy.runBig(gimble_src, chassis_src);//击打大符
// energy.runBig(gimble_src);
last_state = mcuData.state;//更新上一帧状态
} else if (mcuData.state != BIG_ENERGY_STATE) {//自瞄或小符模式
last_state = mcuData.state;
@@ -118,10 +114,10 @@ int main(int argc, char *argv[]) {
armorFinder.run(gimble_src);
});
} else if (mcuData.state == SMALL_ENERGY_STATE) {
// energy.runSmall(gimble_src);
energy.runBig(gimble_src);
energy.runSmall(gimble_src);
}
}
// cv::waitKey(0);
});
} while (ok);
delete video_gimble;