Merge branch 'master' of https://github.com/lloi7/RM_auto-aim
# Conflicts: # energy/src/energy/send/send.cpp
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
extern mcu_data mcuData;
|
||||
extern McuData mcu_data;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// 此函数通过自瞄逻辑击打目标点,用于大符的自动对心和小符直接打击
|
||||
@@ -29,12 +29,12 @@ void Energy::getAimPoint(cv::Point target_point_) {
|
||||
extra_delta_y = 0;
|
||||
}
|
||||
|
||||
double dx = -(target_point_.x - 320 - COMPENSATE_YAW - mcuData.delta_x - manual_delta_x - extra_delta_x);
|
||||
double dy = -(target_point_.y - 240 - COMPENSATE_PITCH - mcuData.delta_y - manual_delta_y - extra_delta_y);
|
||||
double dx = -(target_point_.x - 320 - COMPENSATE_YAW - mcu_data.delta_x - manual_delta_x - extra_delta_x);
|
||||
double dy = -(target_point_.y - 240 - COMPENSATE_PITCH - mcu_data.delta_y - manual_delta_y - extra_delta_y);
|
||||
yaw_rotation = atan(dx / FOCUS_PIXAL) * 180 / PI;
|
||||
pitch_rotation = atan(dy / FOCUS_PIXAL) * 180 / PI;
|
||||
// cout << "yaw: " << yaw_rotation << '\t' << "pitch: " << pitch_rotation << endl;
|
||||
// cout << "mcuData.delta_x: " << mcuData.delta_x << '\t' << "mcuData.delta_y: " << mcuData.delta_y << endl;
|
||||
// cout << "mcu_data.delta_x: " << mcu_data.delta_x << '\t' << "mcu_data.delta_y: " << mcu_data.delta_y << endl;
|
||||
// cout << "manual delta: " << manual_delta_x << '\t' << manual_delta_y << endl;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,23 +15,23 @@ using std::vector;
|
||||
// 此函数用于操作手手动标定
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
void Energy::changeMark() {
|
||||
if (mcuData.mark == 0 && last_mark == 1) {//完成标定
|
||||
last_mark = mcuData.mark;
|
||||
origin_yaw = mcuData.curr_yaw;
|
||||
origin_pitch = mcuData.curr_pitch;
|
||||
if (mcu_data.mark == 0 && last_mark == 1) {//完成标定
|
||||
last_mark = mcu_data.mark;
|
||||
origin_yaw = mcu_data.curr_yaw;
|
||||
origin_pitch = mcu_data.curr_pitch;
|
||||
is_mark = false;
|
||||
manual_mark = true;
|
||||
// LOGM(STR_CTR(WORD_LIGHT_YELLOW, "IsMark"));
|
||||
} else if (mcuData.mark == 1) {//正在标定
|
||||
last_mark = mcuData.mark;
|
||||
} else if (mcu_data.mark == 1) {//正在标定
|
||||
last_mark = mcu_data.mark;
|
||||
is_mark = true;
|
||||
// LOGM(STR_CTR(WORD_BLUE,"Marking..."));
|
||||
|
||||
} else {//未在标定
|
||||
last_mark = mcuData.mark;
|
||||
last_mark = mcu_data.mark;
|
||||
is_mark = false;
|
||||
}
|
||||
//cout<<"mark: "<<int(mcuData.mark)<<endl;
|
||||
//cout<<"mark: "<<int(mcu_data.mark)<<endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ bool Energy::getOrigin() {
|
||||
if (abs(center_delta_yaw) > 0.3 || abs(center_delta_pitch) > 0.3) {
|
||||
return false;
|
||||
} else {
|
||||
origin_yaw = mcuData.curr_yaw;
|
||||
origin_pitch = mcuData.curr_pitch;
|
||||
origin_yaw = mcu_data.curr_yaw;
|
||||
origin_pitch = mcu_data.curr_pitch;
|
||||
auto_mark = true;
|
||||
LOGM(STR_CTR(WORD_BLUE_CODE, "auto mark success!"));
|
||||
return true;
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace cv;
|
||||
// 此函数用于判断世界坐标系下是否可以发弹
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
void Energy::judgeShootInWorld() {
|
||||
if (abs(yaw_rotation - mcuData.curr_yaw) < 0.5 && abs(pitch_rotation - mcuData.curr_pitch) < 0.5) {
|
||||
if (abs(yaw_rotation - mcu_data.curr_yaw) < 0.5 && abs(pitch_rotation - mcu_data.curr_pitch) < 0.5) {
|
||||
shoot = 4;
|
||||
// is_predicting = false;
|
||||
// is_guessing = true;
|
||||
|
||||
@@ -15,8 +15,8 @@ void Energy::writeDownSlightChange(cv::Mat &src) {
|
||||
if (fans_cnt >= 4) {
|
||||
FILE *fp_delta = fopen(PROJECT_DIR"/Mark/delta.txt", "w");
|
||||
if (fp_delta) {
|
||||
fprintf(fp_delta, "delta_x: %d, delta_y: %d\n", mcuData.delta_x + manual_delta_x,
|
||||
mcuData.delta_y + manual_delta_y);
|
||||
fprintf(fp_delta, "delta_x: %d, delta_y: %d\n", mcu_data.delta_x + manual_delta_x,
|
||||
mcu_data.delta_y + manual_delta_y);
|
||||
fclose(fp_delta);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user