flexbe_behavior_engine icon indicating copy to clipboard operation
flexbe_behavior_engine copied to clipboard

question about behavior_checksum and behavior_id

Open zengxiaolei opened this issue 4 years ago • 2 comments

Hi, I noticed the behavior_id of topic /flexbe/status is equal to the behavior_checksum of topic /flexbe/start_behavior, but different with behavior_id of /flexbe/start_behavior. I wonder why, is this intentional?

zengxiaolei avatar Jul 06 '20 05:07 zengxiaolei

This is indeed intentional, although I agree that the naming is not perfect when looking at this particular combination. Some explanations:

  • In general, there are two checksums used: (1) A checksum that is unique and consistent for each behavior and (2) a checksum unique for the actual content/source code of a behavior.
  • When commanding the execution, (1) needs to be used to tell the onboard machine which behavior it should load. This would not be possible via (2).
  • After loading, onboard verifies its own version of (2) depending on the actual locally loaded content with the (2) provided by the start command to ensure that the exact same version is running as expected, that's why the checksum is included in the start command.
  • When running, the status topic always refers uniquely to the actually running version and thus uses (2). In particular, when modifying a behavior on-the-fly and one version of a behavior should be replaced by an update, both version have the same (1), but different (2). Thus, it is important to distinguish them by using the content-specific version as identifier.

It's a rather involved topic, but I hope this helps to clarify.

pschillinger avatar Jul 24 '20 11:07 pschillinger

Thanks for your reply, it's helpful for me to understand more about flexbe!

zengxiaolei avatar Jul 30 '20 05:07 zengxiaolei