An low battery / prolonging battery / skate feature request! The Mellow Boards Endless mode is quite nice. It would be great to have this option available. Take a look at their official YouTube-channel that introduces the mode: https://www.youtube.com/watch?v=AWWLP7TwsDU
So how I understand the feature is that as long as the throttle or brake is not activated, the ESC listens to the RPM. In my simple mind without knowing much about the bldc-code, I thought the following logic:
# Pseudo code
// User is not using the remote
If !throttle_active and !brake_active and endless_mode {
// The board is moving forward in less than 25 kmh
If Current_RPM > 0 and Current_RPM < RPM_25_kmh {
// The last measured RPM is bigger than the registered target.
// That means that the user has pushed the board and increased
// the speed or that it is a downhill. Plus 3 is to not update
// current RPM if it just reduced the speed (every 0.1 second).
If Current_RPM > (Target_RPM + 3) {
// Set the new target RPM for which the VESC shall keep for 0.1 second
Target_RPM = Current_RPM
// Reset the timer
Timer = now()
}
// Timer reach threshold - reduce the RPM.
If Timer >= 100 ms {
// Reduced the Target_RPM with a rate of 30 RPM per second
Target_RPM = Target_RPM - 3
// Reset timer
Timer = now()
}
// Give sufficient power to keep the Target_RPM
Give_power( Target_RPM )
}
}
I tried to implement this as a custom app, but it has a few problems.
One problem is overshoot, when setting the RPM the vesc uses a PID controller to set the current based on the rpm error. Now when someone jumps off the board for example the rpm will overshoot quickly causing the endless mode to continuously accelerate.
Another problem is discriminating between pushing and going down a hill for example, this can be ignored if the user brakes.
But I'm currently searching for a solution to the overshoot problem. So if anyone has any ideas, please tell me
Interesting! I am not familiar with the bldc code - it is a lot of reading up on. Do you have your code on github, then I can try to understand your implementation?
In the Nunchuck app there is some code to maintain speed while using cruise control. https://github.com/vedderb/bldc/blob/79bfbe62344a29817c5e3ea982a2c27d34c6c881/applications/app_nunchuk.c#L268
So I haven't tested the cruise control, so I do not know what happens if jumping off - will it accelerate or just keep the speed? I would have guessed that the PID keeps the speed, but that is just a guess. I had a quick look at the code and didn't see anything coping with this specific case.
When it comes to downhill or pushing I would say the behavior is equal, so no need to separate those cases. Shouldn't it be the same? I think it is important give a max speed option of this feature. It should be user configurable, but in pushing scenarios I'd say 20 or 25 kmh is enough. But making it user configurable it does not matter what I mean :)
The cruise control mode does indeed work, it just maintains a set speed. This means that when jumping off the PID controller will try to maintain the speed as best as it can, but will generaly overshoot (even just a very small amount) as it can't respond immediately.
This becomes a problem when implementing endless mode, as my method was to change the set point when the current speed is bigger than the set speed. But when overshooting this cause the setpoint to rise, causing the board to accelerate a little bit causing more overshoot and so on.
Also, driving down a hill would require braking as I can't distinguish between pushing and accelerating due to gravity.
I'm curious how mellow boards handle this (mainly when jumping off the board in endless mode).
So I revisit this every now and then - I don't have enough time too really get into VESC programming yet. But it helps to gain some knowledge.
It looks like it is this line which sets the pid:https://github.com/vedderb/bldc/blob/79bfbe62344a29817c5e3ea982a2c27d34c6c881/applications/app_nunchuk.c#L317 I guess this is known to you @timower, but just to get the discussion further.
So if what I wrote is correct, we could do something like:
There must of course be more logic around this, like the pseudo code I wrote in the first post.
But, this cannot be correct, because where would the overshooting occur in this example? There must be some knowledge I don't have that is limiting my answers!
The key here is oing to be properly tuning the PID controller for speed. You are going to need a damped speed controller that has no overshoot in order to achieve what you want. Increasing the derivative term or decreasing the P and I terms will achieve this.
Jeff
I've been working on this by taking a look at how nunchuck and adc implement cruise control. 1 question I have is:
I noticed that app_adc does not keep record of the previous current like app_nunchuck does. Is app_adc able to achieve a smooth transition and not get a spike due to something else or is the spiking and unsmooth transition only relevant to app_nunchuck?