Skip to content

Commit 06b1240

Browse files
committed
first attempt to adjust PID for hero
1 parent 5270f76 commit 06b1240

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

dev/application/param_adjusts/pa_hero/can_motor_config.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PIDController::pid_params_t CANMotorCFG::a2vParams[MOTOR_COUNT] = {
2323
{10, 0.0f, 0.2, 100, 500},
2424
{10, 0.0f, 0.2, 100, 500},
2525
{10, 0.0f, 0.1, 70, 90},
26-
{8.5, 0.0f, 0.1, 70, 90},
26+
{40., 1.0f, 0.1, 100, 200},
2727
{10, 0.0f, 0.2, 100, 500},
2828
{50, 0.0f, 0.18, 100, 250},//Bullet Loader temprarily to 2.5x to surpass the friction
2929
{10, 0.0f, 0.2, 100, 500},
@@ -36,7 +36,7 @@ PIDController::pid_params_t CANMotorCFG::v2iParams[MOTOR_COUNT] = {
3636
{26.0f,0.1f,0.02f,2000.0,6000.0},
3737
{26.0f,0.1f,0.02f,2000.0,6000.0},
3838
{50.0f, 0.0f, 0.0f, 5000.0f, 15000.0f},
39-
{ 50.0f, 0.0f, 0.00f, 5000.0f, 15000.0f},
39+
{ 35.f, 5.f, 0.00f, 5000.0f, 15000.0f},
4040
{26.0f, 0.1f, 0.02f, 2000.0f, 6000.0f},
4141
{35.0f, 2.1f, 0.0f, 3000.0f, 16383.0f},//Bullet Loader
4242
{26.0f, 0.1f, 0.02f, 2000.0f, 6000.0f},

dev/application/vehicles/hero/can_motor_config.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CANMotorBase CANMotorCFG::CANMotorProfile[MOTOR_COUNT] = {
1010
{CANMotorBase::can_channel_2, 0x204, CANMotorBase::M3508, 3572},//Back Right
1111
{CANMotorBase::can_channel_2, 0x203, CANMotorBase::M3508, 3572},//Back Left
1212
{CANMotorBase::can_channel_2, 0x208, CANMotorBase::GM6020, 1994},//Yaw
13-
{CANMotorBase::can_channel_1, 0x205, CANMotorBase::GM6020, 4600},//PITCH 侧面的6020
13+
{CANMotorBase::can_channel_1, 0x205, CANMotorBase::GM6020, 3301},//PITCH 侧面的6020
1414
{CANMotorBase::can_channel_1, 0x201, CANMotorBase::M3508_without_deceleration, 3344},
1515
{CANMotorBase::can_channel_2, 0x206, CANMotorBase::M3508, 3572}, //Bullet Loader
1616
{CANMotorBase::can_channel_1, 0x203, CANMotorBase::M3508_without_deceleration, 3572},//FW_UP(左边)
@@ -23,7 +23,7 @@ PIDController::pid_params_t CANMotorCFG::a2vParams[MOTOR_COUNT] = {
2323
{10, 0.0f, 0.2, 100, 500},
2424
{10, 0.0f, 0.2, 100, 500},
2525
{10, 0.0f, 0.1, 70, 90},
26-
{8.5, 0.0f, 0.1, 70, 90},
26+
{40., 1.0f, 0.1, 100, 200},
2727
{10, 0.0f, 0.2, 100, 500},
2828
{50, 0.0f, 0.18, 100, 250},//Bullet Loader temprarily to 2.5x to surpass the friction
2929
{10, 0.0f, 0.2, 100, 500},
@@ -36,7 +36,7 @@ PIDController::pid_params_t CANMotorCFG::v2iParams[MOTOR_COUNT] = {
3636
{26.0f,0.1f,0.02f,2000.0,6000.0},
3737
{26.0f,0.1f,0.02f,2000.0,6000.0},
3838
{50.0f, 0.0f, 0.0f, 5000.0f, 15000.0f},
39-
{ 50.0f, 0.0f, 0.00f, 5000.0f, 15000.0f},
39+
{ 35.f, 1.f, 0.00f, 5000.0f, 15000.0f},
4040
{26.0f, 0.1f, 0.02f, 2000.0f, 6000.0f},
4141
{35.0f, 2.1f, 0.0f, 3000.0f, 16383.0f},//Bullet Loader
4242
{26.0f, 0.1f, 0.02f, 2000.0f, 6000.0f},

dev/application/vehicles/hero/hardware_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#endif
2828

2929
#if !defined(ENABLE_USB_SHELL) || defined(__DOXYGEN__)
30-
#define ENABLE_USB_SHELL TRUE
30+
#define ENABLE_USB_SHELL FALSE
3131
#endif
3232

3333
#endif //META_INFANTRY_HARDWARE_CONF_H

dev/application/vehicles/hero/main_hero.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ int main() {
197197

198198
/// Start LGs
199199
#ifndef DEBUG_NO_GIMBAL
200-
GimbalLG::init(THREAD_GIMBAL_LG_VISION_PRIO, THREAD_GIMBAL_LG_SENTRY_PRIO);
200+
// Those two priorities are vision and subpitch, subpitch is already gone so no use of those two params temporarily
201+
// 24/03/14
202+
GimbalLG::init(THREAD_GIMBAL_SKD_PRIO, THREAD_GIMBAL_SKD_PRIO);
201203
#endif
202204
#ifndef DEBUG_NO_SHOOT
203205
ShootLG::init(SHOOT_DEGREE_PER_BULLET, true, THREAD_STUCK_DETECT_PRIO, THREAD_SHOOT_BULLET_COUNTER_PRIO, THREAD_SHOOT_LG_VISION_PRIO);
@@ -215,7 +217,7 @@ int main() {
215217

216218
/// Start Inspector and User Threads
217219
#if !defined(DEBUG_NO_SHOOT) && !defined(DEBUG_NO_CHASSIS) && !defined(DEBUG_NO_GIMBAL)
218-
InspectorH::start_inspection(THREAD_INSPECTOR_PRIO);
220+
// InspectorH::start_inspection(THREAD_INSPECTOR_PRIO);
219221
#endif
220222
UserH::start(THREAD_USER_PRIO, THREAD_USER_ACTION_PRIO);
221223

dev/application/vehicles/hero/user_hero.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ float UserH::gimbal_rc_yaw_max_speed = 60; // [degree/s]
1010
float UserH::gimbal_pc_yaw_sensitivity[3] = {50000, 100000, 150000}; // [Slow, Normal, Fast] [degree/s]
1111

1212
float UserH::gimbal_pc_pitch_sensitivity[3] = {20000, 50000, 60000}; // [Slow, Normal, Fast] [degree/s]
13-
float UserH::gimbal_pitch_min_angle = -12; // down range for pitch [degree]
14-
float UserH::gimbal_pitch_max_angle = 18; // up range for pitch [degree]
13+
// update: 2024/03/14 up to 12, down to -35 is ok.
14+
float UserH::gimbal_pitch_min_angle = -25; // down range for pitch [degree]
15+
float UserH::gimbal_pitch_max_angle = 10; // up range for pitch [degree]
1516

1617
/// Chassis Config
1718
float UserH::base_power = 40.0f;
@@ -50,7 +51,8 @@ void UserH::UserThread::main() {
5051
while (!shouldTerminate()) {
5152
#ifndef DEBUG_NO_GIMBAL
5253
/*** ---------------------------------- Gimbal --------------------------------- ***/
53-
if (!InspectorH::remote_failure() /*&& !InspectorI::chassis_failure()*/ && !InspectorH::gimbal_failure()) {
54+
// if (!InspectorH::remote_failure() /*&& !InspectorI::chassis_failure()*/ && !InspectorH::gimbal_failure()) {
55+
if(true){ // a stupid hack due to Gimbal's Yaw is broken 2024/03/13
5456
if ((Remote::rc.s1 == Remote::S_MIDDLE && Remote::rc.s2 == Remote::S_UP)) {
5557
/// Remote - Yaw + Pitch
5658
GimbalLG::set_mode(GimbalLG::CHASSIS_REF_MODE);

dev/application/vehicles/hero/user_hero.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
// Added by TonyZhangZTN for debug
2222
//#define DEBUG_NO_CHASSIS
23-
#define DEBUG_NO_GIMBAL
23+
//#define DEBUG_NO_GIMBAL
2424
//#define DEBUG_NO_SHOOT
2525
#define DEBUG_NO_VISION
2626
class UserH {

0 commit comments

Comments
 (0)