fix bug.
This commit is contained in:
@@ -40,5 +40,5 @@ void Energy::judgeShootInGimbal() {
|
||||
} else
|
||||
shoot = 2;
|
||||
|
||||
// cout << "yaw: " << yaw_rotation << '\t' << "pitch: " << pitch_rotation << endl;
|
||||
cout << "yaw: " << yaw_rotation << '\t' << "pitch: " << pitch_rotation << endl;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void Energy::sendTarget(Serial &serial, float x, float y, uint16_t z, uint16_t u
|
||||
time_t t = time(nullptr);
|
||||
if (last_time != t) {
|
||||
last_time = t;
|
||||
cout << "fps:" << fps << ", (" << x << "," << y << "," << z << "," << u << ")" << endl;
|
||||
cout << "fps:" << fps << ", (" << x << "," << y << "," << z << ")" << endl;
|
||||
fps = 0;
|
||||
}
|
||||
fps += 1;
|
||||
|
||||
10
main.cpp
10
main.cpp
@@ -97,7 +97,7 @@ int main(int argc, char *argv[]) {
|
||||
if (mcuData.state == BIG_ENERGY_STATE) {//大能量机关模式
|
||||
if (last_state != BIG_ENERGY_STATE) {//若上一帧不是大能量机关模式,即刚往完成切换,则需要初始化
|
||||
destroyAllWindows();
|
||||
if(from_camera){
|
||||
if (from_camera) {
|
||||
delete video_gimbal;
|
||||
video_gimbal = new CameraWrapper(ENERGY_CAMERA_GAIN, 0/*, "armor"*/);
|
||||
if (video_gimbal->init()) {
|
||||
@@ -120,13 +120,13 @@ int main(int argc, char *argv[]) {
|
||||
if (!from_camera) extract(gimbal_src, chassis_src);
|
||||
if (save_video) saveVideos(gimbal_src, chassis_src);//保存视频
|
||||
if (show_origin) showOrigin(gimbal_src, chassis_src);//显示原始图像
|
||||
// energy.runBig(gimbal_src, chassis_src);
|
||||
energy.runBig(gimbal_src);
|
||||
energy.runBig(gimbal_src, chassis_src);
|
||||
// energy.runBig(gimbal_src);
|
||||
last_state = mcuData.state;//更新上一帧状态
|
||||
} else if (mcuData.state == SMALL_ENERGY_STATE) {
|
||||
if (mcuData.state != SMALL_ENERGY_STATE) {
|
||||
destroyAllWindows();
|
||||
if(from_camera){
|
||||
if (from_camera) {
|
||||
delete video_gimbal;
|
||||
video_gimbal = new CameraWrapper(ENERGY_CAMERA_GAIN, 0/*, "armor"*/);
|
||||
if (video_gimbal->init()) {
|
||||
@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) {
|
||||
} else { // 自瞄模式
|
||||
if (last_state != ARMOR_STATE) {
|
||||
destroyAllWindows();
|
||||
if(from_camera){
|
||||
if (from_camera) {
|
||||
delete video_gimbal;
|
||||
video_gimbal = new CameraWrapper(ARMOR_CAMERA_GAIN, 0/*, "armor"*/);
|
||||
if (video_gimbal->init()) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#define ARMOR_CAMERA_GAIN (30)
|
||||
#endif
|
||||
#ifndef ENERGY_CAMERA_GAIN
|
||||
#define ENERGY_CAMERA_GAIN (20)
|
||||
#define ENERGY_CAMERA_GAIN (30)
|
||||
#endif
|
||||
#ifndef AIM_KP
|
||||
#define AIM_KP (6)
|
||||
|
||||
@@ -37,7 +37,7 @@ void uartReceive(Serial *pSerial) {
|
||||
pSerial->ReadData((uint8_t *) buffer, sizeof(mcuData)+1);
|
||||
if (buffer[sizeof(mcuData)] == '\n') {
|
||||
memcpy(&mcuData, buffer, sizeof(mcuData));
|
||||
// LOGM("Get, state:%c, mark:%d!", mcuData.state, (int) mcuData.mark);
|
||||
LOGM("Get, state:%c, mark:%d!", mcuData.state, (int) mcuData.mark);
|
||||
// LOGM("Get yaw: %f, pitch: %f!", mcuData.curr_yaw, mcuData.curr_pitch);
|
||||
// LOGM("Get delta x: %d, delta y: %d!", mcuData.delta_x, mcuData.delta_y);
|
||||
// static int t = time(nullptr);
|
||||
|
||||
Reference in New Issue
Block a user