Replies: 8 comments 8 replies
-
|
It works better if you can send "state" rather than "commands". I.e. instead of sending a command to tell it to go faster, just send the desired speed as the state. If you want it to stop, just change the speed to 0 instead of sending a stop command. If you don't have too much state, you can just send it all at once with a single You can also implement a timeout that if it doesn't receive new data for X amount of time, then maybe we should stop. |
Beta Was this translation helpful? Give feedback.
-
|
Hi Bert yes I do forget to disconnect while developing quite frequently! The 5% miss rate is not so bad I just need a way to make the application resilient so that it can absorb these missed broadcasts. One way would be to repeat the broadcasts blindly , alternatively for the observer to confirm receipt before the broadcaster actions. This then becomes the same conundrum in reverse. A central hub would perhaps help coordinate but the essential issue is how to , for example , issue dc=0 to both hubs. There are some dual hub scripts out there I will see if they use any feeeback. Also the blocks example Pybricks code for dual hubs.Cheers PSent from my iPhoneOn 29 Apr 2025, at 23:16, Bert ***@***.***> wrote:
Paul,
You probably know, but I add this here anyway:
The broadcasting and observing hubs do it a lot worse it they are also connected to another device (as a PC and such).
Tested with a robot Inventor hub to broadcast an incremented counter at 100 msec interval on channel 5.
Used a cityhub to observe at that channel with a 50 msec interval.
On a non connected run I saw: obs:3000 missed:139 interv:50 4.63%
On a connected run a bit shorter: obs:300 missed:970 interv:50 323.33%
Quite a difference.
The hubs are close to each other 10 - 20 cm so there is no problem.
Other wifi and bluetooth devices are in the neighborhood and can interfere.
Bert
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Could you try broadcast 100 observe 50 ? I am thinking observe really needs to be as fast as possible. PSent from my iPhoneOn 30 Apr 2025, at 21:05, Bert ***@***.***> wrote:
In my test I changed the broadcast interval to 250 and that got us (NOT connected to pc):
obs:1500 missed:0 interv:100 0.00%
So:
broadcast interval 250 msec
observe interval 100 msec
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
How did you get the log ? Sent from my iPhoneOn 30 Apr 2025, at 21:05, Bert ***@***.***> wrote:
In my test I changed the broadcast interval to 250 and that got us (NOT connected to pc):
obs:1500 missed:0 interv:100 0.00%
So:
broadcast interval 250 msec
observe interval 100 msec
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Bert - doesn’t hub.ble.broadcast() automatically run a separate thread/task every 100ms for 1 second ?I thought I stumbled across that in Pybricks api Sent from my iPhoneOn 30 Apr 2025, at 21:42, Bert ***@***.***> wrote:
wrote the log to memory and re-read in the REPL with hub.system.storage(0,128)
Could you try broadcast 100 observe 50 ? I am thinking observe really needs to be as fast as possible.
That was the data a few posts back:
Used a cityhub to observe at that channel with a 50 msec interval.
On a non connected run I saw: obs:3000 missed:139 interv:50 4.63%
Bert
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
You would think polling as fast as possible would reduce latency but may well introduce errors if broadcasts are granular - but they can be excepted no ? However does memory become an issue for rapid polling on the observer ? Or even battery drain ? PSent from my iPhoneOn 30 Apr 2025, at 21:42, Bert ***@***.***> wrote:
wrote the log to memory and re-read in the REPL with hub.system.storage(0,128)
Could you try broadcast 100 observe 50 ? I am thinking observe really needs to be as fast as possible.
That was the data a few posts back:
Used a cityhub to observe at that channel with a 50 msec interval.
On a non connected run I saw: obs:3000 missed:139 interv:50 4.63%
Bert
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
That’s all very useful thanks - always seems like waiting 1000ms or 100ms or 10ms seems kind - to allow something to breathe - but in fact wait(0) costs nothing really.
n 30 Apr 2025, at 22:29, David Lechner ***@***.***> wrote:
…
However does memory become an issue for rapid polling on the observer ?
No, it shouldn't as long as you aren't doing something like appending every value read to a list.
Or even battery drain ?
No, CPU and Bluetooth usage are negligible compared to the amount of power that motors and lights use.
—
Reply to this email directly, view it on GitHub <#2172 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKHCFE6NGLIXUEYMMYLLSFD24EXBBAVCNFSM6AAAAAB4DWOATKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEOJZHA2DGNI>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
|
Nice to know ! 🚀
… On 30 Apr 2025, at 22:43, David Lechner ***@***.***> wrote:
always seems like waiting 1000ms or 100ms or 10ms seems kind - to allow something to breathe
On ev3dev that runs Linux, this is true! But not needed on the Powered Up hubs.
—
Reply to this email directly, view it on GitHub <#2172 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKHCFEYXRHSWOGGQM3G4ERT24EYXJAVCNFSM6AAAAAB4DWOATKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEOJZHA2TAOI>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am struggling to work out how to reliably communicate with a 2nd hub. There is no return value or feedback from the observer. It would only take one missed broadcast, to stop() for example, to break any app. Is there some clever logic to back and forth one-way broadcasts that allow commands to be confirmed?
I believe BLE uses advertising to send data - there is no pairing - so it is kind of like smoke signals with no way to be sure both groups have seen the signal.
Beta Was this translation helpful? Give feedback.
All reactions