I recently updated the Node position code such that it only updates every once in a while. What I forgot is that the softSubCallback function is a static function and therefore called by all SoftSensor class objects. I had made the node_position variable a static variable within the softSubCallback thinking that each class object had its own softSubCallback. But what this really meant was that the node_position for one node was being used by every node. So in this PR I made the node_position and last_timestamp part of the Soft_t, RbrCoda_t, and Aanderaa_t classes so that each subscription tracks its own data.
Here is an example of lines in a log captured during a test where we have a node_position for one node override every other nodes positions:
Here is an example of it working after these changes:
We get the node_position on the first sample for both nodes and we can see in the following lines that the node_positions stay 1 and 2 for the respective nodes.
Here we can see after I unplugged the nodes from the bridge that we detect a time difference of > 500ms and we update the node positions.
I recently updated the Node position code such that it only updates every once in a while. What I forgot is that the
softSubCallback
function is a static function and therefore called by all SoftSensor class objects. I had made thenode_position
variable a static variable within thesoftSubCallback
thinking that each class object had its ownsoftSubCallback
. But what this really meant was that thenode_position
for one node was being used by every node. So in this PR I made thenode_position
andlast_timestamp
part of theSoft_t
,RbrCoda_t
, andAanderaa_t
classes so that each subscription tracks its own data.Here is an example of lines in a log captured during a test where we have a node_position for one node override every other nodes positions:
Here is an example of it working after these changes: We get the node_position on the first sample for both nodes and we can see in the following lines that the node_positions stay 1 and 2 for the respective nodes.
Here we can see after I unplugged the nodes from the bridge that we detect a time difference of > 500ms and we update the node positions.
https://app.shortcut.com/sofar/story/199921/node-position-sticks-between-sensors