mirror of
https://github.com/rene-dev/stmbl.git
synced 2026-02-06 10:23:58 +08:00
newpid conf pins, manutec conf
This commit is contained in:
@@ -8,12 +8,12 @@ conf0.out_rev = 0.000000
|
||||
conf0.high_motor_temp = 80.000000
|
||||
conf0.max_motor_temp = 100.000000
|
||||
conf0.phase_time = 0.500000
|
||||
conf0.phase_cur = 6.000000
|
||||
conf0.max_vel = 104.719757
|
||||
conf0.max_acc = 10471.975586
|
||||
conf0.max_force = 10.000000
|
||||
conf0.phase_cur = 15.000000
|
||||
conf0.max_vel = 100.000000
|
||||
conf0.max_acc = 10000.000000
|
||||
conf0.max_force = 15.000000
|
||||
conf0.max_dc_cur = 20.000000
|
||||
conf0.max_ac_cur = 20.000000
|
||||
conf0.max_ac_cur = 30.000000
|
||||
conf0.fb_type = 1.000000
|
||||
conf0.fb_polecount = 1.000000
|
||||
conf0.fb_offset = 0.000000
|
||||
@@ -38,14 +38,14 @@ conf0.max_pos_error = 1.570796
|
||||
conf0.high_dc_volt = 350.000000
|
||||
conf0.low_dc_volt = 12.000000
|
||||
conf0.high_hv_temp = 70.000000
|
||||
conf0.fan_hv_temp = 60.000000
|
||||
conf0.fan_hv_temp = 30.000000
|
||||
conf0.fan_core_temp = 450.000000
|
||||
conf0.fan_motor_temp = 60.000000
|
||||
conf0.p = 0.990000
|
||||
conf0.g = 0.990000
|
||||
conf0.pos_p = 100.000000
|
||||
conf0.vel_p = 1.000000
|
||||
conf0.acc_p = 0.300000
|
||||
conf0.acc_pi = 50.000000
|
||||
conf0.vel_p = 2000.000000
|
||||
conf0.vel_i = 10.000000
|
||||
conf0.vel_g = 1.000000
|
||||
conf0.cur_p = 0.500000
|
||||
conf0.cur_i = 0.000000
|
||||
conf0.cur_ff = 1.000000
|
||||
|
||||
@@ -8,12 +8,12 @@ conf0.out_rev = 0.000000
|
||||
conf0.high_motor_temp = 80.000000
|
||||
conf0.max_motor_temp = 100.000000
|
||||
conf0.phase_time = 0.500000
|
||||
conf0.phase_cur = 6.000000
|
||||
conf0.max_vel = 104.719757
|
||||
conf0.max_acc = 10471.975586
|
||||
conf0.max_force = 10.000000
|
||||
conf0.phase_cur = 15.000000
|
||||
conf0.max_vel = 100.000000
|
||||
conf0.max_acc = 10000.000000
|
||||
conf0.max_force = 15.000000
|
||||
conf0.max_dc_cur = 20.000000
|
||||
conf0.max_ac_cur = 20.000000
|
||||
conf0.max_ac_cur = 30.000000
|
||||
conf0.fb_type = 1.000000
|
||||
conf0.fb_polecount = 1.000000
|
||||
conf0.fb_offset = 0.000000
|
||||
@@ -38,14 +38,14 @@ conf0.max_pos_error = 1.570796
|
||||
conf0.high_dc_volt = 350.000000
|
||||
conf0.low_dc_volt = 12.000000
|
||||
conf0.high_hv_temp = 70.000000
|
||||
conf0.fan_hv_temp = 60.000000
|
||||
conf0.fan_hv_temp = 30.000000
|
||||
conf0.fan_core_temp = 450.000000
|
||||
conf0.fan_motor_temp = 60.000000
|
||||
conf0.p = 0.990000
|
||||
conf0.g = 0.990000
|
||||
conf0.pos_p = 100.000000
|
||||
conf0.vel_p = 1.000000
|
||||
conf0.acc_p = 0.300000
|
||||
conf0.acc_pi = 50.000000
|
||||
conf0.vel_p = 2000.000000
|
||||
conf0.vel_i = 10.000000
|
||||
conf0.vel_g = 1.000000
|
||||
conf0.cur_p = 0.500000
|
||||
conf0.cur_i = 0.000000
|
||||
conf0.cur_ff = 1.000000
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
conf0.r = 0.400000
|
||||
conf0.l = 0.002000
|
||||
conf0.j = 0.001000
|
||||
conf0.j = 0.000300
|
||||
conf0.psi = 0.081000
|
||||
conf0.polecount = 3.000000
|
||||
conf0.mot_type = 0.000000
|
||||
conf0.out_rev = 0.000000
|
||||
conf0.high_motor_temp = 80.000000
|
||||
conf0.max_motor_temp = 100.000000
|
||||
conf0.phase_time = 1.000000
|
||||
conf0.phase_time = 0.500000
|
||||
conf0.phase_cur = 15.000000
|
||||
conf0.max_vel = 104.719757
|
||||
conf0.max_acc = 10471.975586
|
||||
conf0.max_vel = 100.000000
|
||||
conf0.max_acc = 10000.000000
|
||||
conf0.max_force = 15.000000
|
||||
conf0.max_dc_cur = 20.000000
|
||||
conf0.max_ac_cur = 20.000000
|
||||
conf0.max_ac_cur = 30.000000
|
||||
conf0.fb_type = 1.000000
|
||||
conf0.fb_polecount = 1.000000
|
||||
conf0.fb_offset = 0.000000
|
||||
@@ -38,14 +38,14 @@ conf0.max_pos_error = 1.570796
|
||||
conf0.high_dc_volt = 350.000000
|
||||
conf0.low_dc_volt = 12.000000
|
||||
conf0.high_hv_temp = 70.000000
|
||||
conf0.fan_hv_temp = 60.000000
|
||||
conf0.fan_hv_temp = 30.000000
|
||||
conf0.fan_core_temp = 450.000000
|
||||
conf0.fan_motor_temp = 60.000000
|
||||
conf0.p = 0.990000
|
||||
conf0.pos_p = 50.000000
|
||||
conf0.vel_p = 1.000000
|
||||
conf0.acc_p = 0.300000
|
||||
conf0.acc_pi = 50.000000
|
||||
conf0.g = 0.990000
|
||||
conf0.pos_p = 100.000000
|
||||
conf0.vel_p = 2000.000000
|
||||
conf0.vel_i = 10.000000
|
||||
conf0.vel_g = 1.000000
|
||||
conf0.cur_p = 0.500000
|
||||
conf0.cur_i = 0.000000
|
||||
conf0.cur_ff = 1.000000
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
conf0.r = 0.400000
|
||||
conf0.l = 0.002000
|
||||
conf0.j = 0.001000
|
||||
conf0.j = 0.000100
|
||||
conf0.psi = 0.080000
|
||||
conf0.polecount = 3.000000
|
||||
conf0.mot_type = 0.000000
|
||||
conf0.out_rev = 0.000000
|
||||
conf0.high_motor_temp = 80.000000
|
||||
conf0.max_motor_temp = 100.000000
|
||||
conf0.phase_time = 1.000000
|
||||
conf0.phase_time = 0.500000
|
||||
conf0.phase_cur = 15.000000
|
||||
conf0.max_vel = 104.719757
|
||||
conf0.max_acc = 10471.975586
|
||||
conf0.max_force = 20.000000
|
||||
conf0.max_vel = 100.000000
|
||||
conf0.max_acc = 10000.000000
|
||||
conf0.max_force = 15.000000
|
||||
conf0.max_dc_cur = 20.000000
|
||||
conf0.max_ac_cur = 30.000000
|
||||
conf0.fb_type = 1.000000
|
||||
@@ -38,16 +38,16 @@ conf0.max_pos_error = 1.570796
|
||||
conf0.high_dc_volt = 350.000000
|
||||
conf0.low_dc_volt = 12.000000
|
||||
conf0.high_hv_temp = 70.000000
|
||||
conf0.fan_hv_temp = 60.000000
|
||||
conf0.fan_hv_temp = 30.000000
|
||||
conf0.fan_core_temp = 450.000000
|
||||
conf0.fan_motor_temp = 60.000000
|
||||
conf0.p = 0.990000
|
||||
conf0.g = 0.990000
|
||||
conf0.pos_p = 100.000000
|
||||
conf0.vel_p = 1.000000
|
||||
conf0.acc_p = 0.300000
|
||||
conf0.acc_pi = 50.000000
|
||||
conf0.vel_p = 2000.000000
|
||||
conf0.vel_i = 10.000000
|
||||
conf0.vel_g = 1.000000
|
||||
conf0.cur_p = 0.500000
|
||||
conf0.cur_i = 0.000000
|
||||
conf0.cur_ff = 1.000000
|
||||
conf0.cur_ind = 0.900000
|
||||
conf0.max_sat = 0.800000
|
||||
conf0.max_sat = 0.500000
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
conf0.r = 2.000000
|
||||
conf0.l = 0.004000
|
||||
conf0.j = 0.000500
|
||||
conf0.j = 0.000100
|
||||
conf0.psi = 0.080000
|
||||
conf0.polecount = 3.000000
|
||||
conf0.mot_type = 0.000000
|
||||
@@ -8,9 +8,9 @@ conf0.out_rev = 0.000000
|
||||
conf0.high_motor_temp = 80.000000
|
||||
conf0.max_motor_temp = 100.000000
|
||||
conf0.phase_time = 0.500000
|
||||
conf0.phase_cur = 5.000000
|
||||
conf0.max_vel = 104.719757
|
||||
conf0.max_acc = 10471.975586
|
||||
conf0.phase_cur = 8.000000
|
||||
conf0.max_vel = 100.000000
|
||||
conf0.max_acc = 10000.000000
|
||||
conf0.max_force = 20.000000
|
||||
conf0.max_dc_cur = 20.000000
|
||||
conf0.max_ac_cur = 16.000000
|
||||
@@ -38,16 +38,16 @@ conf0.max_pos_error = 1.570796
|
||||
conf0.high_dc_volt = 350.000000
|
||||
conf0.low_dc_volt = 12.000000
|
||||
conf0.high_hv_temp = 70.000000
|
||||
conf0.fan_hv_temp = 60.000000
|
||||
conf0.fan_hv_temp = 30.000000
|
||||
conf0.fan_core_temp = 450.000000
|
||||
conf0.fan_motor_temp = 60.000000
|
||||
conf0.p = 0.990000
|
||||
conf0.g = 0.990000
|
||||
conf0.pos_p = 100.000000
|
||||
conf0.vel_p = 1.000000
|
||||
conf0.acc_p = 0.300000
|
||||
conf0.acc_pi = 50.000000
|
||||
conf0.vel_p = 2000.000000
|
||||
conf0.vel_i = 10.000000
|
||||
conf0.vel_g = 1.000000
|
||||
conf0.cur_p = 0.500000
|
||||
conf0.cur_i = 0.000000
|
||||
conf0.cur_ff = 1.000000
|
||||
conf0.cur_ind = 0.900000
|
||||
conf0.max_sat = 0.800000
|
||||
conf0.max_sat = 0.500000
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
conf0.r = 6.000000
|
||||
conf0.l = 0.009300
|
||||
conf0.j = 0.000100
|
||||
conf0.j = 0.000050
|
||||
conf0.psi = 0.074000
|
||||
conf0.polecount = 3.000000
|
||||
conf0.mot_type = 0.000000
|
||||
@@ -9,8 +9,8 @@ conf0.high_motor_temp = 80.000000
|
||||
conf0.max_motor_temp = 100.000000
|
||||
conf0.phase_time = 0.500000
|
||||
conf0.phase_cur = 4.000000
|
||||
conf0.max_vel = 104.719757
|
||||
conf0.max_acc = 10471.975586
|
||||
conf0.max_vel = 100.000000
|
||||
conf0.max_acc = 10000.000000
|
||||
conf0.max_force = 20.000000
|
||||
conf0.max_dc_cur = 15.000000
|
||||
conf0.max_ac_cur = 12.000000
|
||||
@@ -38,16 +38,16 @@ conf0.max_pos_error = 1.570796
|
||||
conf0.high_dc_volt = 350.000000
|
||||
conf0.low_dc_volt = 12.000000
|
||||
conf0.high_hv_temp = 70.000000
|
||||
conf0.fan_hv_temp = 60.000000
|
||||
conf0.fan_hv_temp = 30.000000
|
||||
conf0.fan_core_temp = 450.000000
|
||||
conf0.fan_motor_temp = 60.000000
|
||||
conf0.p = 0.990000
|
||||
conf0.g = 0.990000
|
||||
conf0.pos_p = 100.000000
|
||||
conf0.vel_p = 1.000000
|
||||
conf0.acc_p = 0.300000
|
||||
conf0.acc_pi = 50.000000
|
||||
conf0.vel_p = 2000.000000
|
||||
conf0.vel_i = 10.000000
|
||||
conf0.vel_g = 1.000000
|
||||
conf0.cur_p = 0.500000
|
||||
conf0.cur_i = 0.000000
|
||||
conf0.cur_ff = 1.000000
|
||||
conf0.cur_ind = 0.900000
|
||||
conf0.max_sat = 0.800000
|
||||
conf0.max_sat = 0.500000
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
conf0.r = 13.000000
|
||||
conf0.l = 0.012000
|
||||
conf0.j = 0.000100
|
||||
conf0.j = 0.000050
|
||||
conf0.psi = 0.074000
|
||||
conf0.polecount = 3.000000
|
||||
conf0.mot_type = 0.000000
|
||||
@@ -9,8 +9,8 @@ conf0.high_motor_temp = 80.000000
|
||||
conf0.max_motor_temp = 100.000000
|
||||
conf0.phase_time = 0.500000
|
||||
conf0.phase_cur = 3.000000
|
||||
conf0.max_vel = 104.719757
|
||||
conf0.max_acc = 10471.975586
|
||||
conf0.max_vel = 100.000000
|
||||
conf0.max_acc = 10000.000000
|
||||
conf0.max_force = 20.000000
|
||||
conf0.max_dc_cur = 15.000000
|
||||
conf0.max_ac_cur = 5.000000
|
||||
@@ -38,16 +38,16 @@ conf0.max_pos_error = 1.570796
|
||||
conf0.high_dc_volt = 350.000000
|
||||
conf0.low_dc_volt = 12.000000
|
||||
conf0.high_hv_temp = 70.000000
|
||||
conf0.fan_hv_temp = 60.000000
|
||||
conf0.fan_hv_temp = 30.000000
|
||||
conf0.fan_core_temp = 450.000000
|
||||
conf0.fan_motor_temp = 60.000000
|
||||
conf0.p = 0.990000
|
||||
conf0.g = 0.990000
|
||||
conf0.pos_p = 100.000000
|
||||
conf0.vel_p = 1.000000
|
||||
conf0.acc_p = 0.300000
|
||||
conf0.acc_pi = 50.000000
|
||||
conf0.vel_p = 2000.000000
|
||||
conf0.vel_i = 10.000000
|
||||
conf0.vel_g = 1.000000
|
||||
conf0.cur_p = 0.500000
|
||||
conf0.cur_i = 0.000000
|
||||
conf0.cur_ff = 1.000000
|
||||
conf0.cur_ind = 0.900000
|
||||
conf0.max_sat = 0.800000
|
||||
conf0.max_sat = 0.500000
|
||||
|
||||
6
conf/stp.txt
Normal file
6
conf/stp.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
sim0.amp = 0
|
||||
sim0.freq = 0.5
|
||||
stp0.max_vel = 5
|
||||
stp0.max_acc = 50
|
||||
stp0.target = sim0.square
|
||||
rev0.in = stp0.pos_out
|
||||
@@ -49,15 +49,12 @@ HAL_PIN(acc_en) = 1.0;
|
||||
HAL_PIN(torque_en) = 1.0;
|
||||
|
||||
HAL_PIN(pos_p) = 100.0; // (1/s)
|
||||
HAL_PIN(pos_lp) = 5000.0; // (1/s)
|
||||
|
||||
HAL_PIN(vel_p) = 2000.0; // (1/s)
|
||||
HAL_PIN(vel_i) = 10.0;
|
||||
HAL_PIN(vel_g) = 1.0;
|
||||
HAL_PIN(vel_lp) = 5000.0; // (1/s)
|
||||
|
||||
HAL_PIN(acc_g) = 1.0;
|
||||
HAL_PIN(acc_lp) = 5000.0; // (1/s)
|
||||
|
||||
HAL_PIN(g) = 0.99; // model limit scaling
|
||||
|
||||
@@ -83,10 +80,6 @@ HAL_PIN(saturated) = 0.0; // (s)
|
||||
MEM(float sat) = 0.0;
|
||||
MEM(float torque_sum) = 0.0;
|
||||
|
||||
MEM(float old_vel_cmd) = 0.0;
|
||||
MEM(float old_acc_cmd) = 0.0;
|
||||
MEM(float old_torque_cmd) = 0.0;
|
||||
|
||||
RT(
|
||||
float j = MAX(PIN(j), 0.0);
|
||||
float g = CLAMP(PIN(g), 0.0, 1.0);
|
||||
@@ -116,13 +109,10 @@ RT(
|
||||
float pos_error = minus(pos_ext_cmd, pos_fb);
|
||||
|
||||
float pos_p = MAX(PIN(pos_p), 0.0);
|
||||
float pos_lp = LP_HZ(PIN(pos_lp));
|
||||
float vel_p = MAX(PIN(vel_p), 0.0);
|
||||
float vel_i = MAX(PIN(vel_i), 0.0);
|
||||
float vel_g = CLAMP(PIN(vel_g), 0.0, 1.0);
|
||||
float vel_lp = LP_HZ(PIN(vel_lp));
|
||||
float acc_g = CLAMP(PIN(acc_g), 0.0, 1.0);
|
||||
float acc_lp = LP_HZ(PIN(acc_lp));
|
||||
|
||||
|
||||
float pos_en = PIN(pos_en);
|
||||
@@ -158,9 +148,7 @@ RT(
|
||||
// pos -> vel
|
||||
vel_cmd = pos_error * pos_p; // p
|
||||
//vel_cmd = CLAMP(vel_cmd, vel_fb + acc_min * period, vel_fb + acc_max * period); // adaptive loop clamping
|
||||
//vel_cmd = vel_cmd * pos_lp + (1.0 - pos_lp) * old_vel_cmd; // lowpass
|
||||
vel_cmd = CLAMP(vel_cmd, vel_min * vel_g, vel_max * vel_g); // p clamping
|
||||
//old_vel_cmd = vel_cmd;
|
||||
vel_cmd += vel_ext_cmd; // ff
|
||||
vel_sat = SAT2(vel_cmd, vel_min * 0.99, vel_max * 0.99);
|
||||
vel_cmd = CLAMP(vel_cmd, vel_min, vel_max); // clamping
|
||||
@@ -168,9 +156,7 @@ RT(
|
||||
// vel -> acc
|
||||
vel_error = vel_cmd - vel_fb;
|
||||
acc_cmd = vel_error * vel_p; // p
|
||||
//acc_cmd = acc_cmd * vel_lp + (1.0 - vel_lp) * old_acc_cmd; // lowpass
|
||||
acc_cmd = CLAMP(acc_cmd, acc_min * acc_g, acc_max * acc_g); // p clamping
|
||||
//old_acc_cmd = acc_cmd;
|
||||
acc_cmd += acc_ext_cmd; // ff
|
||||
acc_sat = SAT2(acc_cmd, acc_min * 0.99, acc_max * 0.99);
|
||||
acc_cmd = CLAMP(acc_cmd, acc_min, acc_max); // clamping
|
||||
@@ -181,8 +167,6 @@ RT(
|
||||
torque_sum += vel_error * period * vel_i; // i
|
||||
torque_sum = CLAMP(torque_sum, torque_min - torque_cmd, torque_max - torque_cmd); // dynamic integral clamping
|
||||
torque_cmd += torque_sum;
|
||||
//torque_cmd = torque_cmd * acc_lp + (1.0 - acc_lp) * old_torque_cmd; // lowpass TODO: -ff
|
||||
//old_torque_cmd = torque_cmd;
|
||||
torque_sat = SAT2(torque_cmd, torque_min * 0.99, torque_max * 0.99);
|
||||
|
||||
|
||||
|
||||
12
src/link.c
12
src/link.c
@@ -181,20 +181,14 @@ void link_pid(){
|
||||
|
||||
// pid
|
||||
hal_link_pins("conf0.j", "pid0.j");
|
||||
hal_link_pins("conf0.p", "pid0.p");
|
||||
hal_link_pins("conf0.g", "pid0.g");
|
||||
hal_link_pins("conf0.pos_p", "pid0.pos_p");
|
||||
hal_link_pins("conf0.vel_p", "pid0.vel_p");
|
||||
hal_link_pins("conf0.acc_p", "pid0.acc_p");
|
||||
hal_link_pins("conf0.acc_pi", "pid0.acc_pi");
|
||||
hal_link_pins("conf0.vel_i", "pid0.vel_i");
|
||||
hal_link_pins("conf0.vel_g", "pid0.vel_g");
|
||||
hal_link_pins("conf0.max_vel", "pid0.max_usr_vel");
|
||||
hal_link_pins("conf0.max_acc", "pid0.max_usr_acc");
|
||||
hal_link_pins("conf0.max_force", "pid0.max_usr_torque");
|
||||
hal_set_pin("pid0.pos_lp", 4000.0);
|
||||
hal_set_pin("pid0.vel_lp", 4000.0);
|
||||
hal_set_pin("pid0.acc_lp", 4000.0);
|
||||
hal_set_pin("pid0.torque_ff", 1.0);
|
||||
hal_set_pin("pid0.vel_ff", 1.0);
|
||||
hal_set_pin("pid0.acc_ff", 1.0);
|
||||
hal_set_pin("net0.enable", 1.0);
|
||||
hal_link_pins("pid0.torque_cor_cmd", "t2c0.torque");
|
||||
|
||||
|
||||
@@ -298,11 +298,11 @@ int main(void)
|
||||
HAL_PIN(fan_core_temp) = 450.0;
|
||||
HAL_PIN(fan_motor_temp) = 60.0;
|
||||
|
||||
HAL_PIN(p) = 0.99;
|
||||
HAL_PIN(g) = 0.99;
|
||||
HAL_PIN(pos_p) = 100.0;
|
||||
HAL_PIN(vel_p) = 1.0;
|
||||
HAL_PIN(acc_p) = 0.3;
|
||||
HAL_PIN(acc_pi) = 50.0;
|
||||
HAL_PIN(vel_p) = 2000.0;
|
||||
HAL_PIN(vel_i) = 10.0;
|
||||
HAL_PIN(vel_g) = 1.0;
|
||||
HAL_PIN(cur_p) = 0.0;
|
||||
HAL_PIN(cur_i) = 0.0;
|
||||
HAL_PIN(cur_ff) = 1.0;
|
||||
|
||||
Reference in New Issue
Block a user