Omitir al contenido
  • MySensors
  • OpenHardware.io
  • Categories
  • Recientes
  • Etiquetas
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Inicio
  2. Development
  3. Discussion: Reliable delivery

Discussion: Reliable delivery

Programado Fijo Cerrado Movido Development
protocol
54 Mensajes 10 Posters 16.6k Visitas 17 Watching
  • Más antiguo a más nuevo
  • Más nuevo a más antiguo
  • Mayor número de Votos
Responder
  • Responder como tema
Accede para responder
Este tema ha sido borrado. Solo los usuarios que tengan privilegios de administración de temas pueden verlo.
  • mfalkviddM Desconectado
    mfalkviddM Desconectado
    mfalkvidd
    Mod
    escribió en Última edición por
    #21

    ok. I can create the PR. From where can I clone the repo?

    1 Respuesta Última respuesta
    0
    • mfalkviddM Desconectado
      mfalkviddM Desconectado
      mfalkvidd
      Mod
      escribió en Última edición por
      #22

      After a quick chat with hek I now know that I should add code comments to the relevant functions in the code and he'll manually update the API documentation. I'll post a link to the PR when I'm done.

      1 Respuesta Última respuesta
      0
      • R Desconectado
        R Desconectado
        robosensor
        escribió en Última edición por
        #23

        Seems like it is impossible now to distinguish for which message we have received acknowledgement. For example, when you just sent two identical messages. Message should contain message ID field (also called packet id or sequence id, unique for sending side) either in protocol headers (need to change protocol and break compatibility) or in user-defined message body (also breaks compatibility).

        mfalkviddM 1 Respuesta Última respuesta
        0
        • R robosensor

          Seems like it is impossible now to distinguish for which message we have received acknowledgement. For example, when you just sent two identical messages. Message should contain message ID field (also called packet id or sequence id, unique for sending side) either in protocol headers (need to change protocol and break compatibility) or in user-defined message body (also breaks compatibility).

          mfalkviddM Desconectado
          mfalkviddM Desconectado
          mfalkvidd
          Mod
          escribió en Última edición por
          #24

          @robosensor Yes it is impossible to distinguish between acks for two identical messages. But in which use case is that a problem?

          R 1 Respuesta Última respuesta
          0
          • mfalkviddM mfalkvidd

            @robosensor Yes it is impossible to distinguish between acks for two identical messages. But in which use case is that a problem?

            R Desconectado
            R Desconectado
            robosensor
            escribió en Última edición por
            #25

            @mfalkvidd for example, to know last actuator state.

            Imagine that you are sending three commands:

            1. ON
            2. OFF
            3. ON

            Then you receive two confirmations: ON and OFF. For which one ON ack is received? Is current actuator state after receiving two confirmations ON or OFF? How to determine which message (first or third) is lost and what you need to resend?

            mfalkviddM 1 Respuesta Última respuesta
            0
            • R robosensor

              @mfalkvidd for example, to know last actuator state.

              Imagine that you are sending three commands:

              1. ON
              2. OFF
              3. ON

              Then you receive two confirmations: ON and OFF. For which one ON ack is received? Is current actuator state after receiving two confirmations ON or OFF? How to determine which message (first or third) is lost and what you need to resend?

              mfalkviddM Desconectado
              mfalkviddM Desconectado
              mfalkvidd
              Mod
              escribió en Última edición por
              #26

              @robosensor good example. As you said before, there is no way to solve that with the current protocol. However, the example can be made even simpler, it is enough to just send OFF then ON. In-order delivery is not guaranteed so you don't know which message was received last.

              R 1 Respuesta Última respuesta
              0
              • mfalkviddM mfalkvidd

                @robosensor good example. As you said before, there is no way to solve that with the current protocol. However, the example can be made even simpler, it is enough to just send OFF then ON. In-order delivery is not guaranteed so you don't know which message was received last.

                R Desconectado
                R Desconectado
                robosensor
                escribió en Última edición por
                #27

                @mfalkvidd yes, I understand that this feature will break everything.

                Also, message id field can help to filter out duplicate messages on receiving side (due to message acknowledgement is not received by sending side) and can help to re-order incoming messages in right way using increasing message ids.

                Even more, sending acknowledgement with only numeric id instead of full message data can help to remove load from MCU (need to parse full message), from RAM (need to store full message), and from 'network' (both wired and wireless, data channel will be busy less time).

                mfalkviddM 1 Respuesta Última respuesta
                0
                • R robosensor

                  @mfalkvidd yes, I understand that this feature will break everything.

                  Also, message id field can help to filter out duplicate messages on receiving side (due to message acknowledgement is not received by sending side) and can help to re-order incoming messages in right way using increasing message ids.

                  Even more, sending acknowledgement with only numeric id instead of full message data can help to remove load from MCU (need to parse full message), from RAM (need to store full message), and from 'network' (both wired and wireless, data channel will be busy less time).

                  mfalkviddM Desconectado
                  mfalkviddM Desconectado
                  mfalkvidd
                  Mod
                  escribió en Última edición por
                  #28

                  @robosensor yes, I agree.

                  1 Respuesta Última respuesta
                  0
                  • mfalkviddM mfalkvidd

                    Very cool! Thanks a lot @hek! Can't believe I have read several hundred forum posts about the protocol design and ack problems the last two weeks without realizing that what I needed was already included in the library.

                    From the discussions I've read it looks like almost no-one else has understood either.

                    Some ideas to help people understand how to use the built-in features for reliable delivery:

                    1. Add an example that has a complete implementation of end-to-end ack usage. This includes
                    • setting up timer(s) for re-sending
                    • storing sent messages so they can be re-sent
                    • determining which message was acked when an ack message is received (there might be several messages that haven't been acked yet)
                    • removing acked message from the sent message store and clearing the timer(s)
                    • re-sending when the timers expire
                    1. Update the documentation for bool send(MyMessage &msg, bool ack); (and similar functions) to explain that the bool returned is the result of the next-hop ack.
                    2. Rename the bool ack parameter to bool end-to-end-ack or something similar to make it clear(er) that there are two types of acks
                    3. In the documentation for send() (and similar functions), refer to the example in (1) for information on how to use end-to-end ack.
                    4. When the example in (1) is good enough, add some of the required code to the MySensors library so people don't need to copy-paste a lot of code into their sketches. Surround the code with ifdefs to make it optional.

                    (2) and (3) should be quite easy to do. Can it be done with a pull request or how are documentation improvements handled?

                    I'm willing to do 1 (will post the sketch in the forum for public scrutiny/feedback of course).

                    4 can be done when the community think the example is "good enough"

                    5 can wait until the example has been thoroughly vetted.

                    mfalkviddM Desconectado
                    mfalkviddM Desconectado
                    mfalkvidd
                    Mod
                    escribió en Última edición por
                    #29

                    I got ready to do a PR for this:

                    1. Update the documentation for bool send(MyMessage &msg, bool ack); (and similar functions) to explain that the bool returned is the result of the next-hop ack.

                    But the code for 1.5.4 already contains this:

                    @return true Returns true if message reached the first stop on its way to destination.
                    

                    so the problem seems to be the that @return statements didn't make it to http://www.mysensors.org/download/sensor_api_15
                    @hek: It seems like a PR won't help in this case?

                    YveauxY 1 Respuesta Última respuesta
                    0
                    • mfalkviddM mfalkvidd

                      I got ready to do a PR for this:

                      1. Update the documentation for bool send(MyMessage &msg, bool ack); (and similar functions) to explain that the bool returned is the result of the next-hop ack.

                      But the code for 1.5.4 already contains this:

                      @return true Returns true if message reached the first stop on its way to destination.
                      

                      so the problem seems to be the that @return statements didn't make it to http://www.mysensors.org/download/sensor_api_15
                      @hek: It seems like a PR won't help in this case?

                      YveauxY Desconectado
                      YveauxY Desconectado
                      Yveaux
                      Mod
                      escribió en Última edición por
                      #30

                      @mfalkvidd @return is doxygen formatting info, while the link points to documentation manually written. For 2.0 doxygen is on the agenda, and maybe the manual docs will be replaced by doxygen generated docs. Probably @hek has better insight on the subject.

                      http://yveaux.blogspot.nl

                      mfalkviddM 1 Respuesta Última respuesta
                      0
                      • YveauxY Yveaux

                        @mfalkvidd @return is doxygen formatting info, while the link points to documentation manually written. For 2.0 doxygen is on the agenda, and maybe the manual docs will be replaced by doxygen generated docs. Probably @hek has better insight on the subject.

                        mfalkviddM Desconectado
                        mfalkviddM Desconectado
                        mfalkvidd
                        Mod
                        escribió en Última edición por
                        #31

                        @Yveaux yes he has. As mentioned above hek said he would manually update the documentation after I had created a PR but it seems like a PR is not needed.

                        1 Respuesta Última respuesta
                        0
                        • hekH Desconectado
                          hekH Desconectado
                          hek
                          Admin
                          escribió en Última edición por
                          #32

                          It's already building, but only @Anticimex has been a good boy adding the correct doxygen comments to his code .
                          http://ci.mysensors.org/job/MySensorsArduino/branch/development/Doxygen_HTML/

                          1 Respuesta Última respuesta
                          0
                          • Mark SwiftM Desconectado
                            Mark SwiftM Desconectado
                            Mark Swift
                            escribió en Última edición por
                            #33

                            Has there been any progress on this guys?

                            mfalkviddM 1 Respuesta Última respuesta
                            0
                            • Mark SwiftM Mark Swift

                              Has there been any progress on this guys?

                              mfalkviddM Desconectado
                              mfalkviddM Desconectado
                              mfalkvidd
                              Mod
                              escribió en Última edición por
                              #34

                              @Mark-Swift thanks for asking. Number 3 and 4 in this post were actually already in place in the code and documentation before this thread was started, but it seems like updating the site to reflect that is quite hard. I don't know how updating the site works unfortunately. The only advice I can give is "Don't look at the online documentation, dig through the source code instead".

                              number 1 is blocked by me getting enough motivation to do the work required to get the development channel working without screwing up my existing projects. There are so many changes to folder locations and similar that I am unable to compile anything if I switch to the development version and I'm not looking forward to figuring out how to handle that.

                              BartEB 1 Respuesta Última respuesta
                              0
                              • mfalkviddM mfalkvidd

                                @Mark-Swift thanks for asking. Number 3 and 4 in this post were actually already in place in the code and documentation before this thread was started, but it seems like updating the site to reflect that is quite hard. I don't know how updating the site works unfortunately. The only advice I can give is "Don't look at the online documentation, dig through the source code instead".

                                number 1 is blocked by me getting enough motivation to do the work required to get the development channel working without screwing up my existing projects. There are so many changes to folder locations and similar that I am unable to compile anything if I switch to the development version and I'm not looking forward to figuring out how to handle that.

                                BartEB Desconectado
                                BartEB Desconectado
                                BartE
                                Contest Winner
                                escribió en Última edición por
                                #35

                                @mfalkvidd said:

                                Add an example that has a complete implementation of end-to-end ack usage. This includes
                                setting up timer(s) for re-sending
                                storing sent messages so they can be re-sent
                                determining which message was acked when an ack message is received (there might be several messages that haven't been acked yet)
                                removing acked message from the sent message store and clearing the timer(s)
                                re-sending when the timers expire

                                Are you referring to this number 1 post?

                                Does this functionality need to be part of the bool send(MyMessage &msg, bool ack); function or become a layer over the send() function?

                                Maybe i can have a look one of these days...

                                mfalkviddM 1 Respuesta Última respuesta
                                0
                                • BartEB BartE

                                  @mfalkvidd said:

                                  Add an example that has a complete implementation of end-to-end ack usage. This includes
                                  setting up timer(s) for re-sending
                                  storing sent messages so they can be re-sent
                                  determining which message was acked when an ack message is received (there might be several messages that haven't been acked yet)
                                  removing acked message from the sent message store and clearing the timer(s)
                                  re-sending when the timers expire

                                  Are you referring to this number 1 post?

                                  Does this functionality need to be part of the bool send(MyMessage &msg, bool ack); function or become a layer over the send() function?

                                  Maybe i can have a look one of these days...

                                  mfalkviddM Desconectado
                                  mfalkviddM Desconectado
                                  mfalkvidd
                                  Mod
                                  escribió en Última edición por
                                  #36

                                  @BartE I'm referring to the post that starts with "Very cool! Thanks a lot @hek!"

                                  1 Respuesta Última respuesta
                                  0
                                  • Mark SwiftM Desconectado
                                    Mark SwiftM Desconectado
                                    Mark Swift
                                    escribió en Última edición por
                                    #37

                                    I'd love to see some examples of how we can implement a reliable delivery method into critical nodes, especially now 2.0.0 is out in the wild.

                                    1 Respuesta Última respuesta
                                    0
                                    • Mark SwiftM Desconectado
                                      Mark SwiftM Desconectado
                                      Mark Swift
                                      escribió en Última edición por
                                      #38

                                      Any news on this, guys? Do we have some good examples?

                                      1 Respuesta Última respuesta
                                      0
                                      • mfalkviddM mfalkvidd

                                        @hek said:

                                        No, only the findal destination node will answer with a soft ack message.

                                        Note, the (soft) ack message has to be picked up by yourself in your incomingMessage function.

                                        Thanks for explaining. Just checking if my understanding is correct:

                                        bool send(MyMessage &msg, bool ack);
                                        

                                        will return the result of the hardware ack, regardless if the second parameter is true or false?

                                        So my post above should have been like this:

                                        Hardware ack is always on

                                        • Hardware ack is hop-to-hop acknowledgment
                                        • Sending is a blocking function which returns true if an hardware ack was received, and false if ~70ms passed without receiving an hardware ack.
                                        • Sending hardware ack (when the message has reached the next-hop node) is handled automatically by the library(/radio)
                                        • Receiving an hardware ack is handled automatically by the library, by setting the return value from the send call mentioned above
                                        • Up to 15 tries are made automatically by the library. Further re-send needs to be handled manually in each sketch (a while-loop with a counter counting up to maxRetries and using wait() between each resend seems to be the most common solution)

                                        Software ack is what I get when using send(msg, true) (and is also supported by some other functions like present(), sendSketchInfo() and sendBatteryLevel()

                                        • Software ack is end-to-end acknowledgment
                                        • Sending is a non-blocking function
                                        • Sending ack (when the message has reached its final destination) is handled automatically by the library
                                        • Re-send needs to be handled manually in each sketch (setting up a timer when sending the original message might be a good solution)
                                        • Receiving an ack needs to be handled manually in each sketch (by checking msg.isAck() in incomingMessage and clearing the timer mentioned above)
                                        rozpruwaczR Desconectado
                                        rozpruwaczR Desconectado
                                        rozpruwacz
                                        escribió en Última edición por
                                        #39

                                        @mfalkvidd I just came across this post and I am very supprised by the fact that this information is not written anywhere in the documentation ... I believe this is one of the most important stuff everyone should know to actually use MySensors in a real world application - not just diy/hobby project :/ till now I was sure that return value of send funtion (which is NOT explained in the documentation !) is the end-to-end confirmation ...

                                        mfalkviddM 1 Respuesta Última respuesta
                                        1
                                        • rozpruwaczR rozpruwacz

                                          @mfalkvidd I just came across this post and I am very supprised by the fact that this information is not written anywhere in the documentation ... I believe this is one of the most important stuff everyone should know to actually use MySensors in a real world application - not just diy/hobby project :/ till now I was sure that return value of send funtion (which is NOT explained in the documentation !) is the end-to-end confirmation ...

                                          mfalkviddM Desconectado
                                          mfalkviddM Desconectado
                                          mfalkvidd
                                          Mod
                                          escribió en Última edición por
                                          #40

                                          @rozpruwacz Yes. Unfortunately I can't do much more than agree with you :(

                                          1 Respuesta Última respuesta
                                          0
                                          Responder
                                          • Responder como tema
                                          Accede para responder
                                          • Más antiguo a más nuevo
                                          • Más nuevo a más antiguo
                                          • Mayor número de Votos


                                          31

                                          Conectado

                                          11.7k

                                          Usuarios

                                          11.2k

                                          Temas

                                          113.1k

                                          Mensajes


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Conectarse

                                          • ¿Aún no tienes cuenta? Registrarse

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recientes
                                          • Etiquetas
                                          • Popular