some refactor

This commit is contained in:
xinyang
2019-05-17 22:52:35 +08:00
parent 77a58511c9
commit 424cc724d8
13 changed files with 212 additions and 197 deletions

View File

@@ -4,10 +4,12 @@
#ifndef CONSTANT_H
#define CONSTANT_H
#include "additions/additions.h"
#define d2r (CV_PI / 180.0)
const int ALLY_BLUE = 123;
const int ALLY_RED = 456;
const int ALLY_BLUE = ENEMY_RED;
const int ALLY_RED = ENEMY_BLUE;
const int SRC_WIDTH_CAMERA = 640;
const int SRC_HEIGHT_CAMERA = 480;
const int SRC_WIDTH = 320;

View File

@@ -15,12 +15,13 @@
#include "energy/constant.h"
#include "energy/param_struct_define.h"
#include "serial/serial.h"
#include "additions/additions.h"
using std::vector;
class Energy {
public:
Energy(Serial &u, int &ally_color);
Energy(Serial &u, uint8_t &enemy_color);
~Energy();
int run(cv::Mat &src);
@@ -28,7 +29,7 @@ public:
clock_t start;
Serial &serial;
void setAllyColor(int color);
// void setAllyColor(int color);
void setRotation(int rotation);
void extract(cv::Mat &src);
@@ -51,7 +52,7 @@ private:
double last_target_position;
double last_hit_position;
float target_armor;
int &ally_color_;
uint8_t &ally_color;
int energy_part_rotation;
float attack_distance;
int send_cnt;