Closed EmerickH closed 5 years ago
will be interested in what this does :). I never instrumented the current measurement - what does it do if over current? I could imagine options:
For your application, this is for collision with actors without causing harm?
Current limit just chops the PWM, so effectively reduces the duty cycle. Simplified: The current is equivalent to motor torque.
Yes in my application I need a very responsive PID (high Proportional) to follow correctly a recorded trajectory, but a small max current/torque because if the robot is stuck by someone holding it for example, if the maximum current is too high, the robot will increase its power to try to go to its wanted position, until the wheels are going to skid on the floor and so loose its trajectory... (and do some black tracks on the floor). So I need to calibrate my maximum power to be enough to move the robot correctly but less than the skid limit. I also need to disable buzzer when current limit is reached.
EDIT: Also, do you know why this parameter changes nothing on my board?
https://github.com/btsimonh/hoverboard-firmware-hack/blob/3ad34cfba56a00dfc176c8c48c99dc74ddb82a10/src/protocol.c#L309
OK, it was a bug on my read/write interface.
I just flashed this, and the current limit seems not working... -> Fixed, everything working, I just forgot to change something
Everything is working now, just is anyone knows why 0x82 and 0x81 were inverted? https://github.com/btsimonh/hoverboard-firmware-hack/blob/dcdf9a0f8985401cd0768a0d439fd44861681a55/src/protocol.c#L300-L301 Also 0x86 and 0x85: https://github.com/btsimonh/hoverboard-firmware-hack/blob/dcdf9a0f8985401cd0768a0d439fd44861681a55/src/protocol.c#L305-L306
haha :). I guess I wrote them IPD, then cut & paste to put it in 'PID' order; I'm happy with the new numbers
I'm gonna merge this without checking myself - Still up to my eyes in 'real' work :( @EmerickH - I had trouble with aggressive PID values; did you find some good ones? please share.... Did you use the dead reckoning output?
My PID values (for positional control):
Works well: P: 300 I: 50 D: 0 pwm limit: 400 Max cur: 100-200 depending weight (=1-2A)
More responsive but more unstable: P:500 I:50 D:15 pl:150 Max cur: 100-200
Be careful: if you increases Proportional >~200 you have to lower before pwm limit and max current, else it's gonna do some impressive jumps (50cm is my record!)
I just saw a big error in my code: https://github.com/btsimonh/hoverboard-firmware-hack/blob/10858d808f135047d8fff2c94c08ca6149f28f90/inc/bldc.h#L17 This must be float not short as I've already divided by 100... I'm going to recreate a pull when I will have some time
max current limit x 100
variable, replacing actual DC_CUR_LIMIT Value will be always < DC_CUR_LIMIT for securityTODO:
#define CONTROL_TYPE USART2_CONTROLLED
, maybe I should come back to default HOVERBOARD_WITH_SOFTWARE_SERIAL_B2_C9Remove buzzer-> It's only on the total current limit so if <15 A/motor, no beepFully working!