duty_cycle control vs current_control

Thanks for the calibration. I think we’re on the same page. There are terms that relate to the control strategy used to shape the current profiles… trapezoidal, double hump, sinusoidal etc. Separate from this is whether there is a current loop closure that makes the throttle a current vs straight duty cycle controller.

It seems like many of the ESC’s out there are purposefully vague on what they’re actually doing or capable of. It’s not till you get them on the scope that you can really see. I should probably read up on what VESC is actually doing since it appears to give you options.

omg yes to vague.

and i was literally thinking this morning, can I learn how to scope these things? maybe i can figure out what they’re doing for braking as well in addition to how many commutation variants are out there.

but yah pardon the sloppy use of words around here. few of us are more than hobbyists.

I can’t commit myself to taking anyone’s money sadly. I learned to code so I could make my board capable enough for mountain bike trails. I don’t really have any other experience as a developer. I also lack the hardware and experience on a 4-wheel board. I would need a partner with hardware to test on and some code experience or at least the desire/ability to learn. I can’t say it is easy but it is really fruitful to make the board react exactly like you want.

1 Like

FWIW, the best way for me has been to get some cheap development hardware and set it up on the bench. There are some promising diy esc boards elsewhere here that are cheap enough that if you blow it up it’s ok. Get yourself a small low voltage bldc, power supply or battery, and a cheap scope and go to town. Very helpful if it’s a VESC compatible board since that allows a good amount of control.

1 Like

Loving this topic. Still trying to wrap my head around the majority of the conversation tbh :rofl: but it’s certainly painted a clearer picture of the differences between the two for me.

My first duty cycle control experience was at esk8con on a Stooge Spine and while I didnt get to test it at max speed, i was instantly hooked on that “jumpy” feeling you described. While I still manage to get a pretty decent take off on the start line on my vesc board, I’d love to have that “jump” at any given point during the ride, especially while at speed - if that was even possible using current control.

My current throttle expo is on 20% but i might experiment with increasing it further. I understand there will likely be limitations as to how far it can be pushed. I’m already getting a tonne of wheel spin on all 4 wheels when trying to punch it on the straight :sweat_smile:

3 Likes

@Tasventouras That sounds like a nice problem to have. I’m not a VESC guru, but throttle expo, punch control, and “P” gain in the current control modes should all affect that “jumpy” feeling. I’m not sure how much difference you will notice if you’re already spinning the wheels though. Going the other way, you could conceivably eliminate wheel spin by softening the response.

1 Like

PID tuning is where i think reducing the response lag could come form.

in this other thread about BLDC vs FOC @Tony_Stark got into tuning PID on FOC to see if it resolved some of the apparent punch difference.

messing with PID is where my experiments stalled out.

4 Likes

:skateboard:

1 Like

are you using the lisp interface?

can you point us at any code?

What’s “max torque” in this situation? is it vesc’s motor current max? is the idea behind switching to duty_cycle control from current control that you ignore motor current limits briefly?

Max torque is basically synonymous with max current. The control modes operate on the same limits so duty control does legitimately kick harder than current control. The reason, I suspect, comes down to math inherent to its function. I believe with duty control it is more direct demand, whereas, in current control, duty is a result of some calculation.

While looking through the code I found this interesting comment:

Run the BLDC speed controller in current mode instead of duty cycle mode. This will
make it behave like the FOC speed controller. The duty cycle mode has the advantage
that it does not require the extra current controller since bldc inherently runs
with duty cycle control. The current controller also outputs a duty cycle in the
end, and then the speed controller might as well do the same without the current
controller dynamics in between. FOC on the other hand is inherently based on current
control.

I think the speed control is another thing from current and duty control. I think the PID factors that are at play with FOC are found in Motor Cfg->FOC->General-> Current Kp, Current Ki. But I don’t really understand yet how these different PID loops come together in the code so there might be some interaction with speed control.

I write VESC packages which work through the lisp interface but most of the code is C++. vesc_pkg/tnt/tnt/remote_input.c at tnt129 · Izzygit/vesc_pkg · GitHub This package is big so here is a small section to look at. Function update_remote in this section checks for remote type, reads the throttle value, applies deadband, and outputs the throttle value.

This file contains all the functions that you can use in vesc packages to interact with the motor, IMU, etc. vesc_pkg/c_libs/vesc_c_if.h at main · vedderb/vesc_pkg · GitHub

6 Likes

well that’s super interesting. and another hint that the BLDC vs FOC debate might have just been a duty_cycle control vs current control one.

damn you’ve given me homework. wonder if I’ll get it done. super excited tho. thanks! :slight_smile:

3 Likes

Just want to share this awesome video, it’s what made PID loops “click” for me when I was learning them

6 Likes

I kinda went wild and changed these to 0.05 and 0.1 and didn’t really feel much of a difference which is why om wondering if this setting actually does anything for current PID

Are we sure this isn’t for position control mode?

I want motors go reeeeeeeeeeeeeee plz

Seriously,
Duty control is what I want… Throttle position = rpm/speed

Example:
In ken block’s electrikhana 2, The vehicle has basically an electronic system acting as a transmission limiting the rotation of the wheels when he is sliding, drifting, etc… basically controlled loss of traction

In ken block’s og electrikhana, he had issues with losing traction and then having the wheels spin up to Max speed… which I can totally relate to

Anyway… Reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

3 Likes

Haha, if you like that, it’s a small step from here (https://www.youtube.com/watch?v=jaeLt8fTG-U) to having a script that augments your screeeeeeeeeeeeeee assuming you run vesc tool on your phone. Next Benjamin will be playing V8 sound tracks on his boards that match the throttle.

2 Likes

I think some kind of hybrid would be best like mentioned earlier

What boards with less watts overperform?

I find production boards almost always outperform a VESC board doing the same amount of amps. @davidpilny and I run pretty similar setups with top speeds ~55kph mark, though he’s basically maxing out his two unties, I more or less keep up/occasionally out drag him on a Exway Atlas which only pushes ~30a per motor.

2 Likes

Vedder might be able to answer some of these questions. Maybe someone here is close enough to him to ask?

1 Like

There’s a VESC discord if I remember correctly

1 Like