Merge remote-tracking branch 'origin/master'

This commit is contained in:
xinyang
2019-08-05 09:37:50 +08:00
3 changed files with 24 additions and 10 deletions

View File

@@ -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 - 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 - 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;
}
} 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;
}

View File

@@ -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)

View File

@@ -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