EFeru / hoverboard-firmware-hack-FOC

With Field Oriented Control (FOC)
GNU General Public License v3.0
1.05k stars 876 forks source link

`TRQ_MODE` overshooting. #455

Open Blue186 opened 6 months ago

Blue186 commented 6 months ago

Variant

USART

Control type

FOC

Control mode

None

Description

Hello, I have been trying to implement control mode switching through serial messages using SERIAL_START_FRAME. I observed that when in USART+FOC_CTRL+SPD_MODE/VLT_MODE, everything works fine, and the mode switch is successful. However, when attempting USART+FOC_CTRL+SPD_MODE/TRQ_MODE, after switching to TRQ_MODE, there are no errors, but when I slightly change command_in->steer or command_in->speed, the motor speed increases directly to the maximum.When I use the TRQ_MODE mode alone, the same issue occurs when combined with serial communication. I have tried reading through the code but haven't identified the issue. I would greatly appreciate your help if you could assist me in resolving this problem.

Candas1 commented 6 months ago

Hi,

It's hard to follow you. If it's happening with torque mode only, why share all the unrelated details about changing the mode?

This is how torque mode works without load.

Changing the mode is already covered with a different protocol if you read the wiki.

Blue186 commented 6 months ago

Thanks a lot, yes I found it. I found through issues that the torque mode is not linear and not very adjustable, so can I control the input of the torque mode through PID? Calculate the speed difference of the controlled variable, then I can control the speed in the torque mode, so as to better adjust the torque? (Not FOC speed mode) I will try that later.

Candas1 commented 6 months ago

This project is unfinished but you might be able to use the protocol piece.

For the non linearity, I think it's more a scale problem, it's mentioned on those issues.

Blue186 commented 6 months ago

Ok,thanks! I'll try to adapt it. In addition, I would like to ask, when I use a motor with a reduction ratio of 1:4.4 and 10 pole pairs, everything is normal when the motor rotates in the forward direction, but when it rotates in the reverse direction, it will stall and cannot start. ,what could be the problem? Of course, I also modified n_polePairs: 10 in the BLDC_controller_data.c file, and also tried to increase r_errInpTgtThres and t_errQual.

Blue186 commented 6 months ago

Ok,thanks! I'll try to adapt it. In addition, I would like to ask, when I use a motor with a reduction ratio of 1:4.4 and 10 pole pairs, everything is normal when the motor rotates in the forward direction, but when it rotates in the reverse direction, it will stall and cannot start. ,what could be the problem? Of course, I also modified n_polePairs: 10 in the BLDC_controller_data.c file, and also tried to increase r_errInpTgtThres and t_errQual.

This happens from time to time.

Candas1 commented 6 months ago

Are the phases/halls correct ?

Blue186 commented 6 months ago

Yes, correct. In the above situation, the motor gets stuck when it rotates reversely, and it needs a little external force to help it rotate normally. Once it rotates, everything is normal.