-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add command to set target speed and max current - needed for EScooters #628
Comments
I think that the speed is not surging because of the regen algorithm. When you do one-pedal driving it will naturally produce that behavior, whilst still controlling the motor torque. You can try my implemetantion of it to see if thats what you're after. https://github.com/luna-cycle/vesc_pkg/tree/one_pedal_driving/one_pedal_driving |
@nitrousnrg I appreciate your answer. I must say that I did took as reference the EBike app for Bafang M600, on the VESC firmware, thank you. I did the same for my Bafang M500, but using Pyhton firmware instead -- see here: https://opensourceebike.github.io/ Ah, that LISP is ugly for my eyes :) I just did the pull request to add the command I was looking for. I tested in a few testing rides on the street and it seems to work well. Well, anyway, I replicated a CAN command that was already setting only the motor max current. |
Oh for sure. Try installing that vesc package, it includes a graph that shows what it does. |
@nitrousnrg , I am being trying to understand your algorithm. Why do you relate battery current and motor current?? What I am struggling to understand is only this part: 1-Calculate max braking and accel current for the current speed Thank you. |
That's a secondary feature for systems constrained by battery current. Imagine a motor that can flow 400Apk but with a battery rated for 50Adc. In those cases at very low speed your phase current gets limited by battery current. At high speed your throttle range would be 0-400A, but the controller won't drive more than 50Amps or so. That feels bad, as 75% of the throttle range does nothing at high speed. In any case, give the vesc package a try and see if you like it |
I got it, thanks!! |
simply use the same current fro battery and phase and you will get almost the same response on the complete rpm range of the motor. I think the problem of the issue creator is non-existent as common automotive systems don't use such approach, the maximum they do in modern control systems is to provide a limit for the acceleration of the wheels, but you can do that in VESC too by tuning varius parameters, a simply way to smoothen this out could be to tune rising time of throttle |
@Gabrielerusso , thanks for the feedback. I am using VESC only to control the motor, and an external board to read the sensors, control things as the lights, the battery BMS switch, send the motor commands to VESC and control the display - and I do all this in ESP32 Pyhton firmware, including wireless communication with the display and battery BMS switch. And I am playing with the VESC speed controller PID values to see if it is enough for my needs, and maybe you are correct. |
If your throttle controls directly the battery current, at zero rpm you can do 400 phase amps with like 10% throttle, its impossible to control torque. casainho probably saw the same behavior that I saw, you give little throttle to an scooter and it doesn't shoot to max rpm like the default vesc does, and he thought there is a speed limiter in place. I thought the same at that time, until I recently realized that the behavior is 100% related to the regen algorithm. |
Nope, vesc in FOC mode allows you to limit the phase current and battery current separately, so if you put the same current limit for battery and phase you will get an almost constant torque response. As said commercial vehicles also do this and use acceleration limits to prevent unwanted or dangerous situations. |
My Fiido Q1S 12 inches wheel, seated micro scooter, with a hub direct drive motor that has very low torque and very high speed motor, runs at 160 kms/h(1)!! Is very dangerous to rotate the throttle by accident so I need to set the motor speed in RPM (COMM_SET_RPM) but also set the motor max current simultaneous. This is the way I think electric motorcycles work, even my Xiaomi M365, a popular stand up EScooter.
So, if I rotate a little the throttle, like 10%, I will send this new command COMM_SET_RPM_CURRENT to VESC, with 10% of EScooter max speed value as also 10% of max motor current value.
(1) https://www.youtube.com/watch?v=USxNeejr6yk
The text was updated successfully, but these errors were encountered: