Closed JustAskDave closed 4 years ago
Well, I wouldn't exactly call this a bug as it is working the way it's designed and has been this way for quite a while. But it is true that it can be improved. I'll look at changing the calculation to be based on the setpoint throttle which is the final modified value (after applying throttle limit and other modifiers) used in the mixer rather than input throttle percentage. But as an improvement it will be part of 4.2 as changing the behavior in the middle of a release could catch people out as they might experience different results for the virtual current sensor.
Ok cool. I just assumed that no one was using switchable settings of throttle scaling that came in v4.0 and also using virtual current sensors. The virtual current sensor becomes useless if you change the throttle scaling. I had it set with no throttle scaling working great. Set throttle scale to 40% testing and hover went from about 3amps to 12amps and I managed to use almost 2000ma from my 850ma battery! That’s why I presumed it as a bug as I can’t see how anyone could be using the two like that
@JustAskDave: I think the distinction here (and it's not a hard and fast one) is that you can use the virtual current sensor with throttle scaling, as long as you always use the same throttle scaling, and calibrate the sensor after setting up throttle scaling. This does not work for what you want to do, but there is probably other users out there that use it in this form, and we cannot change this without breaking these users, and probably a bunch of other users of the virtual current sensor, who will have to change the calibration of the sensor after it's been switched to be based off the setpoint throttle. This is something we try to avoid in patch releases - users should be able to update patch releases without having to change their configuration.
Ahh gotcha, yes that makes perfect sense, didn’t think of it that way. Could always add a selection in the virtual current sensor settings to select actual throttle position (default as it does now) or optionally scaled throttle position for fools like me with wierd requests! Wouldn’t affect anyone when it was released that way
@JustAskDave: Or you could wait for @etracer65's change that solves your issue, and then start using a 4.2 nightly build that solves your problem. :wink:
@JustAskDave See #9153
Can you please test? Without throttle limiting, etc. the virtual current meter should perform similarly to now. Although there other factors like throttle boost that will now be (correctly) taken into account when they weren't before. So it's possible with the same calibration you might see slightly higher (but more accurate) current consumption. Although throttle boost effects are generally quicker than the resolution of the current sensor task so there may not be any noticeable difference. When throttle limiting is in effect you should now see it properly reducing the virtual current calculation.
Describe the bug The virtual Current Sensor uses the throttle position to calculate the approximate current draw. This does not seem to take into account if the throttle is scaled in the PID Rate Profile.
I am using little 3in drones in Schools to teach build/program/fly and I have the throttle setup on a 3pos switch via "Adjustments" for the Rate Profile Selection. I have the throttle down to 45% on Pos1, 55% for Pos 2 and unrestricted on Pos 3. This is to give the brand new students stick time with very little sensitivity at first. The Xrotor Nano doesn't have a current sensor so I set up the Virtual Current Sensor which worked great until I introduced the throttle scaling.
To Reproduce Steps to reproduce the behavior: Setting the scale for the virtual current sensor to get an accurate reading with throttle scale at 100% works great. Change PID Rate Profile Throttle Limit to Scale 50% to reduce max available power, the current meter is still reading the actual throttle position and not he scaled throttle position. This causes the virtual current sensor to read much higher than it should.
Expected behavior A clear and concise description of what you expected to happen. Throttle position for the Virtual Current sensor needs to refer to the throttle position applied to the motors using the scaled throttle output and not throttle stick position.
Flight controller configuration Create a
diff
and post it here in a code block. Put`` (three backticks) at the start and end of the
diff` block (instructions on how to do a diff: https://oscarliang.com/use-diff-not-dump-betaflight/)Use
resource show all
to create a resource allocation list and post it here in a code block. Put ``` (three backticks) at the start and end of the output block.Setup / Versions
Flight Controller is a HobbyWing XRotor Nano F4 (OMNIBUSF4SD) ESC is HobbyWing XRotor Nano 20 amp 4 in 1 Receiver is FlySky FS-A8S micro powered from FC 5v VTX is Turbowing TX1769 powered from VBAT
Additional context Add any other context about the problem here. I that covers it all!