Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control motor current instead of battery current #113

Open
AckmaniacSoftware opened this issue Sep 3, 2019 · 5 comments
Open

Control motor current instead of battery current #113

AckmaniacSoftware opened this issue Sep 3, 2019 · 5 comments
Milestone

Comments

@AckmaniacSoftware
Copy link

AckmaniacSoftware commented Sep 3, 2019

Wouldn't it be better to have control about the motor current instead of the battery current. Because then you have direct control about the torque the motor generates. I see that the max motor current is set to 30 so it could be a smooth transition to watts or battery current once the max speed of the motor is reached.
Sadly i don't have the motor yet but when i see the code it seems that the feeling later on will be very powerful and a bit jerky at low speeds and less powerful at higher speeds. Even if you apply the same torque all the time.
I know i sound stupid because i did not ride the motor yet but i come from electric longboards where i optimized the firmware for hundreds of hours.
There i introduced the watt control mode which provides exactly the described behavior. It starts with motor current control and then when the motor is close to it's maximum speed it switches smoothly over to watt control.

Guess that could all be implemented in the ebike_app.apply_torque_assist() function.

By that the reaction could be a lot smoother and that saves energy, generates less heat and less wear. Only downside is that it feels less powerful because the motor doesn't react like a terrier at low speeds but it applies additional torque (not power) linear to your torque input.

Edit: looks that apply_power_assist() for POWER_ASSIST_MODE is a multiplied of the human watts and could work a bit like my described behavior.
Could somebody please tell how the the 2 modes feel like compared to each other in real life?

@casainho
Copy link
Contributor

casainho commented Sep 3, 2019

Well, motor current is left constant while someone want to start play with it. Maybe you can be the developer to try improve the behavior, make tests and then propose your change.

@AckmaniacSoftware
Copy link
Author

AckmaniacSoftware commented Sep 4, 2019

Please have a look at this commit, did not compile it but i hope you understand the idea (as said before i do not have the motor yet so can't test myself)
AckmaniacSoftware@02f58d0

Edit: fixed the fmapf issue as well
AckmaniacSoftware@ac81288

@casainho
Copy link
Contributor

casainho commented Sep 5, 2019

Currently, this is not a priority for me. I will back to this later. Thank you.

@Frans-Willem
Copy link

Trying to look through your code, and I have one request:
If you are asking people to review, please clean up your commits. Make sure that all the green/red stuff I see is relevant to the change you're making. Doing this will greatly increase your chances of people actually taking the time to look through your proposed changes.

Some examples of things that (in my opinion) should've been cleaned up:

Apart from this, I haven't had the time to look in-depth at your proposal, but will try to later.

@casainho casainho added this to the 0.21.0 milestone Nov 6, 2019
@casainho
Copy link
Contributor

casainho commented Nov 6, 2019

Let's see if this goes to future V0.21.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants