-
Notifications
You must be signed in to change notification settings - Fork 41
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
Remove delay in wait_for_start_nonzero #190
base: develop
Are you sure you want to change the base?
Conversation
There's a 100ms delay in wait_for_start_nonzero because with PWM input you sometimes have glitch pulses from electrical noise, and you don't want to start the motor on a glitch. But bluejay no longer supports PWM input and is dshot-only, so glitches are no longer possible, particularly because there's a checksum in the dshot protocol. This 100ms delay is a major issue for applications which need to start a stopped motor, such as nerf blasters and robotics. Currently blheli_s and bluejay are unusable in these applications, and this one-line change would fix that
Build artifacts:
|
Hey, thank you! I need to check chat logs/comments, I think this delay had some other reason too according to Mathias, if I remember correctly. CC @damosvil - do you see any reason why we should not remove this delay? |
That delay exists as a safety measure in case the fc may send frames before
arming the drone. So on order to start the motor the esc shall reveive non
zero and no command frames for more than 100ms.
El mié, 3 abr 2024, 11:12, Chris L. ***@***.***> escribió:
… Hey, thank you!
I need to check chat logs/comments, I think this delay had some other
reason too according to Mathias, if I remember correctly.
CC @damosvil <https://github.com/damosvil> - do you see any reason why we
should not remove this delay?
—
Reply to this email directly, view it on GitHub
<#190 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWBQ62BD6XBNZRPWQLSDPDY3PBZLAVCNFSM6AAAAABFUMLCR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZUGAYDCOBYHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I appreciate every change that makes things faster! "This 100ms delay is a major issue for applications which need to start a stopped motor, such as nerf blasters and robotics" |
This 100ms delay is added every time the ESC is armed and starting from 0 speed. Keeping a 100ms delay when arming would be fine for nerf and robotics applications, I think there's a separate 100ms delay on arming at line 595? |
Holy shit.... I have timed the motor startup and watched it in super slowmotion. This pullrequest has my dearest desperate upvote then! |
This is for BB1 MCUs only. |
True, but there's also ones at lines 611 and 625 with different conditions, I think it covers all possible conditions? Also fyi, none of blheli_32, AM32, or simonk seem to have any delay once the ESC is armed, even though they all support PWM input, it's only blheli_s and derivatives. |
Yep, those are for DSHOT rate detection. The point is, for Bluejays intended purpose - controlling brushless motors in multirotors - those 100ms do not play a role whatsoever. I am having a hard time removing this delay without knowing what the possible side effects might be and super thorough testing. I do understand that it might matter for blasters and other applications (that are out of scope for this project). Still I am not willing to risk quads blowing up in peoples faces because we wanted to "save" 100ms. |
In fact for applications needing rapid motor start stop it is better to use reversible mode and a deadband instead of starting from a dead stop each time. Go live, put the motor in neutral then go full positive or full negative when firing. |
(Im not - yet - in any way fluent in assembler!)
As dshot only, we shouldn't get non 0 throttle by accident no more. A noisy signal that has a jumping throttle (with a correct checksum) would get through that check either way, no? |
Thanks for pointing that out! From neutral... can the motor just go full ham without having to 'probe' the correct motor rotation first? The only downside would be loosing a little(deadband) over 1000 steps of throttle resolution (in a usecase where only one direction is needed)? |
The 100ms wait on line 727 is after after arming, no? |
Sounds like the client code needs to appreciate that the design is to power-on, establish communication with the ESC then set motor levels multiple times. As opposed to powering on the ESC for every motor change. |
Hmm... I'd guess every somewhat thoughtful client to appreciate this design. But that doesn't make those additional 100ms disappear when starting from 0 throttle, does it? (Except - as you pointed out 🙏 - in 3D mode) In my case, client MCU and ESC's start together (same power) |
If you are armed and are at a very low non-zero throttle value in general, then it is possible to avoid the motor spinning while passing a non-zero value to the ESC. As long as input is zero at startup the ESC will go live, then you can select a non-zero deadband value even without reversible mode, and avoid the 100ms delay. |
Another possible workaround to note down, thanks! |
Not really, the heating effect should be very minimal. This is what will happen on multirotors after arming before take-off, there is some noise on the control channels and gimbals don't always read 0 at full deflection so multi-rotors will sit there with some low value non-zero throttle for some time. |
As others pointed out above - makes more sense to alter the client code for your use case instead of changing the behaviours of a core ESC safety code that may affect multirotor users. |
I like how that leftover of PWM days suddenly turned into 'core esc safety code'. I'll try to set up the environment to build this baby and test it. |
You normally have an idling speed somewhere around 3-5% where multirotors sit when armed and no throttle is applied by the pilot. |
BlueJay is designed for and working fine with multirotors, so introducing non-multirotor features that will change the behaviour for multirotor pilots seems like a quick way to cause unexpected issues for the 99% of people who are using BlueJay in multirotors. The safety aspects of not unexpectedly spinning a powerful 2207 or 2809 25V motor and propeller near people's fingers cannot be overstated here. |
Okay, let's wrap this up. Current:
After proposed change:
The 'unexpected issue' seems to be quite predictable: |
@PippoAe yeah, that wrap up covers the obvious. Still we need according testing to make sure it has no other side effects. We will consider this PR for our next bigger clean-up release, but please don't expect this anytime soon. If you need it "now", I would suggest running your own fork. The team is unfortunately currently a bit swamped private/work wise so our time is super limited right now. |
Thanks for the reply 🙏 Absolutely no stress on my side. Thanks for the great work! |
There's a 100ms delay in wait_for_start_nonzero because with PWM input you sometimes have glitch pulses from electrical noise, and you don't want to start the motor on a glitch. But bluejay no longer supports PWM input and is dshot-only, so glitch inputs are no longer possible, particularly because there's a checksum in the dshot protocol.
This 100ms delay is a major issue for applications which need to start a stopped motor, such as nerf blasters and robotics. Currently blheli_s and bluejay are unusable in these applications. I haven't tested to confirm, but Mathias told me that this one-line change should fix that