Commit Graph

174 Commits

Author SHA1 Message Date
Benjamin Vedder 015a657cc9 Sensor port init in only one place, better encoder debug info 2022-01-25 13:57:25 +01:00
Benjamin Vedder 1b802ebe8f Release motor fix when cc_min_current is 0 2022-01-19 18:52:45 +01:00
Benjamin Vedder 9c484d01e4 Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
Benjamin Vedder 7d38621e32 Indentation fix 2022-01-12 12:32:38 +01:00
Benjamin Vedder 16385f1706 Renamed compression to lzo, added observer offset parameter 2022-01-12 12:27:45 +01:00
Benjamin Vedder af55c79a2a Renamed foc_f_sw to foc_f_zv 2022-01-06 20:44:00 +01:00
Benjamin Vedder 95c67175ab First attempt at a resistance and temperature observer 2021-12-29 18:21:42 +01:00
ElwinBoots e4f4bb1d3f [MCPWM_FOC] Make rotor lock feature use D axis
Changes rotor lock feature from Q axis to D axis. This has two advantages:
1. Now the angle you put in is the angle you really get in the alpha beta frame (no 90 degree offset).
2. Now when the rotor is being locked, the D axis is really the D axis and Q is really the Q axis. This helps for FRF measurements.
2021-12-28 19:43:51 -05:00
secupol 480ffbbeb0
Fix fault parameter in mcpwm_foc_measure_inductance function. 2021-12-21 16:35:25 +09:00
Benjamin Vedder 4eec52d5c0 Fix NaN-problem after lost tracking on some motors 2021-12-19 23:55:03 +01:00
Benjamin Vedder 2a281e36ae Initialize integrator in dutycycle downramp controller 2021-11-27 23:32:08 +01:00
Benjamin Vedder c5c309e227 More braking improvements 2021-11-27 18:51:02 +01:00
Benjamin Vedder afe85a2937 Handle different max and min currents in braking mode 2021-11-27 16:38:32 +01:00
Benjamin Vedder b524773c0d Another attempt at braking 2021-11-27 10:58:52 +01:00
Benjamin Vedder 76b4f58e4e Another attempt at braking smoothly to 0 2021-11-26 00:43:41 +01:00
Andrej Vlašić 132c603699 Use the same minimal temp value for Temperature compensation 2021-11-24 12:18:29 +01:00
Benjamin Vedder f6e78a09b6 Fixed measured MTPA mode, send ld_lq_diff detection result 2021-11-21 18:17:40 +01:00
Benjamin Vedder fff18eb76b Reset PID controller filters when not running to avoid start glitch 2021-11-15 21:29:05 +01:00
ElwinBoots 78065cf74d SVM sign fix
The original SVM code output was 1-dutycycle instead of dutycycle.
To make the math correct this was "corrected" by having the mod_alpha and mod_beta inputs negative.
This code now instead really fixes the output to dutycycle. Now the input should not be taken negative anymore.
2021-11-13 21:51:20 +01:00
Benjamin Vedder cb84c94788 Disable HFI start in braking mode 2021-11-08 22:48:15 +01:00
Kenn Sebesta 67738328cb [SVM] Comment the function API 2021-11-07 18:21:23 -05:00
Benjamin Vedder bc63a3127a Added q-axis modulation filter and use it for input current limits 2021-11-07 23:00:48 +01:00
Kenn Sebesta 80adea0336 [MCPWM_FOC] Condense math in order to save on FPU operations 2021-11-07 09:01:54 -05:00
Kenn Sebesta 6dbea7ed86 [MCPWM_FOC] Eliminate repeated divisions
`/((2.0/3.0) * v_bus)` is the same as `* 1.5/V_bus`. Abstracting this out
saves at least one division per loop, and in some cases as many as three.

Each STM32F4 FPU division takes 14 cycles.
2021-11-07 07:35:08 -05:00
ElwinBoots bbb8a3d6a8 Added comments to the current loop 2021-11-05 07:32:08 +01:00
Benjamin Vedder d79d12a489 Fixed braking mode 2021-10-31 21:51:40 +01:00
Benjamin Vedder 78e750a338 Scale down measured inductance. Read the comment for details. 2021-10-31 17:47:09 +01:00
Benjamin Vedder 5304872a92 Added missing bracket from PR 2021-10-31 09:35:52 +01:00
Kenn Sebesta d97793bf7b
Update mcpwm_foc.c
Co-authored-by: kalvdans <github@kalvdans.no-ip.org>
2021-10-27 14:14:27 -04:00
Kenn Sebesta 0e58e29072 [MCPWM_FOC] Fix mislabeled variable
It's not estimated RPM, it's estimated rad/sec.
2021-10-27 14:09:10 -04:00
Kenn Sebesta 8de85899b7 [Convenience math] Capture a last couple laggards which were missed earlier 2021-10-27 14:08:35 -04:00
Benjamin Vedder 78887f35cf Added link to forum post as comment to explain factor 4 2021-10-25 12:39:54 +02:00
Benjamin Vedder f1c4e713d7 Added MTPA modes 2021-10-24 18:10:00 +02:00
Benjamin Vedder 98587c961b Updated inductance calculation, include motor saliency in observer, separate setting for MTPA 2021-10-24 13:25:12 +02:00
Benjamin Vedder 8cf082e0e0 Better bus current estimation, HFI max voltage and duty scaling fix 2021-10-16 12:54:33 +02:00
Benjamin Vedder b1f564c3bb
Merge pull request #352 from kubark42/convenience_math
Use convenience macros for deg/rad conversions
2021-10-15 22:35:47 +02:00
Benjamin Vedder d8a99fd0f1 Inductance and resistance measurement and scaling fixes, various other fixes 2021-10-15 22:25:07 +02:00
Kenn Sebesta bec06ac85a [Utils] Change convenience multiplication factors into convenience MACROs 2021-10-13 14:18:05 -04:00
Kenn Sebesta aeb5d74488 [Utils] Use convenience macros for deg/rad conversions 2021-10-13 11:52:04 -04:00
Benjamin Vedder 86cbc92b8d Fixed regression in sensorless braking 2021-08-20 21:36:44 +02:00
Benjamin Vedder 4603ff5d4e Change filtered duty cycle to absolute value 2021-08-16 20:33:26 +02:00
Benjamin Vedder 741dd2b38a Speed PID fixes 2021-07-14 19:59:34 +02:00
Benjamin Vedder 3c88ecb7aa Added configurable PID loop rate and more AUX port modes 2021-07-12 14:31:01 +02:00
Benjamin Vedder 804f49b2a8 Moved position control loop to 1 khz timer 2021-07-11 21:10:14 +02:00
Benjamin Vedder 1ab25a47db Added position PID offset support and KD_PROC term 2021-07-11 20:19:26 +02:00
Benjamin Vedder 75b84f1f2d Added kill switch support 2021-06-13 13:46:27 +02:00
Benjamin Vedder 93b405add9 Merge branch 'master' into dev_fw_5_03 2021-05-24 08:49:05 +02:00
Benjamin Vedder 3d2aad0977 Take current limit into account when going to full brake 2021-05-20 18:13:40 +02:00
Benjamin Vedder fdad367c8d limit mc_interface_set_current_off_delay time to 5s 2021-05-20 00:57:26 +02:00
Benjamin Vedder 934d7b9751 Locking around stop code, added mc_interface_set_current_off_delay 2021-05-15 15:24:39 +02:00