From 44812dbcfe422609cf90887e13f36830b0a3ddcf Mon Sep 17 00:00:00 2001 From: wanpiqiu123 <779893878@qq.com> Date: Sun, 4 Aug 2019 21:48:43 +0800 Subject: [PATCH 1/3] modify startup --- tools/create-startup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/create-startup.sh b/tools/create-startup.sh index e2b252b..fad1680 100755 --- a/tools/create-startup.sh +++ b/tools/create-startup.sh @@ -2,6 +2,8 @@ echo "#!/bin/bash" > $2/startup-run echo "echo sjturm | sudo -S cpufreq-set -g performance" >> $2/startup-run -echo "$1/tools/auto-pull.sh" >> $2/startup-run +echo "mkdir $1/Mark" >> $2/startup-run +echo "mkdir $1/gimbal_video" >> $2/startup-run +echo "mkdir $1/armor_box_photo" >> $2/startup-run echo "gnome-terminal -- bash -c \"echo sjturm | sudo -S $1/tools/monitor.sh \\\"$2/run --run-with-camera --save-video --wait-uart --save-labelled-boxes\\\"\"" >> $2/startup-run chmod +x $2/startup-run From 6e69bb0bd2a3b81c053431a11e02c95ec8c4bd6e Mon Sep 17 00:00:00 2001 From: sun Date: Sun, 4 Aug 2019 23:36:51 +0800 Subject: [PATCH 2/3] energy changed --- energy/src/energy/send/send.cpp | 14 +++++++++++++- others/include/config/setconfig.h | 16 ++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/energy/src/energy/send/send.cpp b/energy/src/energy/send/send.cpp index c140ae8..6ef0d10 100644 --- a/energy/src/energy/send/send.cpp +++ b/energy/src/energy/send/send.cpp @@ -19,23 +19,35 @@ void Energy::sendEnergy() { sum_yaw += yaw_rotation; sum_pitch += pitch_rotation; MINMAX(sum_yaw, -100, 100); - MINMAX(sum_pitch, -100, 100);\ + MINMAX(sum_pitch, -100, 100); + double tmp_yaw = yaw_rotation; + double tmp_pitch = pitch_rotation; yaw_rotation = BIG_YAW_AIM_KP * yaw_rotation + BIG_YAW_AIM_KI * sum_yaw + BIG_YAW_AIM_KD * (yaw_rotation - last_yaw); pitch_rotation = BIG_PITCH_AIM_KP * pitch_rotation + BIG_PITCH_AIM_KI * sum_pitch + BIG_PITCH_AIM_KD * (pitch_rotation - last_pitch); + last_yaw = tmp_yaw; + last_pitch = tmp_pitch; } else if (is_chassis) { sum_yaw += yaw_rotation - mcuData.curr_yaw; sum_pitch += pitch_rotation - mcuData.curr_pitch; + double tmp_yaw = yaw_rotation; + double tmp_pitch = pitch_rotation; yaw_rotation = BIG_YAW_AIM_KP * (yaw_rotation - mcuData.curr_yaw) + BIG_YAW_AIM_KI * sum_yaw; pitch_rotation = BIG_PITCH_AIM_KP * (pitch_rotation - mcuData.curr_pitch) + BIG_PITCH_AIM_KI * sum_pitch; + last_yaw = tmp_yaw; + last_pitch = tmp_pitch; } } else if (is_small){ sum_yaw += yaw_rotation; sum_pitch += pitch_rotation; MINMAX(sum_yaw, -100, 100); MINMAX(sum_pitch, -100, 100); + double tmp_yaw = yaw_rotation; + double tmp_pitch = pitch_rotation; yaw_rotation = SMALL_YAW_AIM_KP * yaw_rotation + SMALL_YAW_AIM_KD * (yaw_rotation - last_yaw); pitch_rotation = SMALL_PITCH_AIM_KP * pitch_rotation + SMALL_PITCH_AIM_KD * (pitch_rotation - last_pitch); + last_yaw = tmp_yaw; + last_pitch = tmp_pitch; } diff --git a/others/include/config/setconfig.h b/others/include/config/setconfig.h index 7a7c34e..0768d1c 100644 --- a/others/include/config/setconfig.h +++ b/others/include/config/setconfig.h @@ -32,31 +32,31 @@ #define ENERGY_CAMERA_GAIN (20) #endif #ifndef SMALL_YAW_AIM_KD - #define SMALL_YAW_AIM_KD (1.5) + #define SMALL_YAW_AIM_KD (0) #endif #ifndef SMALL_YAW_AIM_KP - #define SMALL_YAW_AIM_KP (2.5) + #define SMALL_YAW_AIM_KP (4) #endif #ifndef SMALL_PITCH_AIM_KD - #define SMALL_PITCH_AIM_KD (1.3) + #define SMALL_PITCH_AIM_KD (0) #endif #ifndef SMALL_PITCH_AIM_KP - #define SMALL_PITCH_AIM_KP (2.4) + #define SMALL_PITCH_AIM_KP (3.7) #endif #ifndef BIG_YAW_AIM_KD - #define BIG_YAW_AIM_KD (1) + #define BIG_YAW_AIM_KD (0) #endif #ifndef BIG_YAW_AIM_KP - #define BIG_YAW_AIM_KP (5.5) + #define BIG_YAW_AIM_KP (6.5) #endif #ifndef BIG_YAW_AIM_KI #define BIG_YAW_AIM_KI (0.1) #endif #ifndef BIG_PITCH_AIM_KD - #define BIG_PITCH_AIM_KD (1) + #define BIG_PITCH_AIM_KD (0) #endif #ifndef BIG_PITCH_AIM_KP - #define BIG_PITCH_AIM_KP (5.5) + #define BIG_PITCH_AIM_KP (6.5) #endif #ifndef BIG_PITCH_AIM_KI #define BIG_PITCH_AIM_KI (0.1) From 125c8d36c910827147bba592a86f2ea09b9ada4f Mon Sep 17 00:00:00 2001 From: xinyang Date: Sun, 4 Aug 2019 23:53:04 +0800 Subject: [PATCH 3/3] fix bug. --- energy/src/energy/send/send.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/energy/src/energy/send/send.cpp b/energy/src/energy/send/send.cpp index 6ef0d10..2feaa77 100644 --- a/energy/src/energy/send/send.cpp +++ b/energy/src/energy/send/send.cpp @@ -28,12 +28,12 @@ void Energy::sendEnergy() { last_yaw = tmp_yaw; last_pitch = tmp_pitch; } else if (is_chassis) { - sum_yaw += yaw_rotation - mcuData.curr_yaw; - sum_pitch += pitch_rotation - mcuData.curr_pitch; + sum_yaw += yaw_rotation - mcu_data.curr_yaw; + sum_pitch += pitch_rotation - mcu_data.curr_pitch; double tmp_yaw = yaw_rotation; double tmp_pitch = pitch_rotation; - yaw_rotation = BIG_YAW_AIM_KP * (yaw_rotation - mcuData.curr_yaw) + BIG_YAW_AIM_KI * sum_yaw; - pitch_rotation = BIG_PITCH_AIM_KP * (pitch_rotation - mcuData.curr_pitch) + BIG_PITCH_AIM_KI * sum_pitch; + yaw_rotation = BIG_YAW_AIM_KP * (yaw_rotation - mcu_data.curr_yaw) + BIG_YAW_AIM_KI * sum_yaw; + pitch_rotation = BIG_PITCH_AIM_KP * (pitch_rotation - mcu_data.curr_pitch) + BIG_PITCH_AIM_KI * sum_pitch; last_yaw = tmp_yaw; last_pitch = tmp_pitch; }