diff --git a/bt_view/src/bt_view/bt_view.py b/bt_view/src/bt_view/bt_view.py
index 7fae556..a628586 100644
--- a/bt_view/src/bt_view/bt_view.py
+++ b/bt_view/src/bt_view/bt_view.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from hashlib import sha256
from math import log
import os
from typing import Dict, List, Optional, Union
@@ -56,6 +57,10 @@
COLORS_PER_RETURN_STATE_VALUE[None] = COLORS_PER_RETURN_STATE[None]
+def my_hash(s: object) -> str:
+ return sha256(str(s).encode()).hexdigest()[:20]
+
+
def _colormap(cm_name: str, value: Optional[float]) -> str:
if value is None:
# grey for missing values
@@ -135,7 +140,7 @@ def _make_return_value_bargraph(
return None
if not os.path.exists(BG_IMG_FOLDER):
os.makedirs(BG_IMG_FOLDER)
- img_hash = hash(tuple(retvalues_counts))
+ img_hash = my_hash(tuple(retvalues_counts))
img_path = os.path.join(
BG_IMG_FOLDER,
f'{img_hash}.png')
@@ -164,7 +169,7 @@ def _make_history_image(
return None
if not os.path.exists(BG_IMG_FOLDER):
os.makedirs(BG_IMG_FOLDER)
- img_hash = hash(tuple(states))
+ img_hash = my_hash(tuple(states))
img_path = os.path.join(
BG_IMG_FOLDER,
f'h{img_hash}.png')
diff --git a/bt_view/test/_test_data/reference/bt_trace1_demo.svg b/bt_view/test/_test_data/reference/bt_trace1_demo.svg
index 30b6a4f..a28ee62 100644
--- a/bt_view/test/_test_data/reference/bt_trace1_demo.svg
+++ b/bt_view/test/_test_data/reference/bt_trace1_demo.svg
@@ -12,7 +12,7 @@
25
-
+
NavigateWithReplanning
category: NODECAT.ROOT
@@ -20,7 +20,7 @@
26
-
+
RateController
@@ -33,7 +33,7 @@
32
-
+
FollowPath
@@ -46,7 +46,7 @@
27
-
+
ComputePathToPose
@@ -59,7 +59,7 @@
33
-
+
FollowPath
@@ -72,7 +72,7 @@
34
-
+
FollowPathRecoveryFallback
@@ -85,7 +85,7 @@
28
-
+
ComputePathToPose
@@ -98,7 +98,7 @@
29
-
+
ComputePathToPoseRecoveryFallback
@@ -111,7 +111,7 @@
30
-
+
GoalUpdated
@@ -124,7 +124,7 @@
31
-
+
ClearGlobalCostmap-Context
@@ -137,7 +137,7 @@
35
-
+
GoalUpdated
@@ -150,7 +150,7 @@
36
-
+
ClearLocalCostmap-Context
diff --git a/bt_view/test/_test_data/reference/bt_trace1_fbl_log_states.svg b/bt_view/test/_test_data/reference/bt_trace1_fbl_log_states.svg
index d4c9a1e..c08d63b 100644
--- a/bt_view/test/_test_data/reference/bt_trace1_fbl_log_states.svg
+++ b/bt_view/test/_test_data/reference/bt_trace1_fbl_log_states.svg
@@ -12,7 +12,7 @@
25
-
+
NavigateWithReplanning
category: NODECAT.ROOT
values: S: 0 F: 0 R: 1 I: 1
@@ -21,7 +21,7 @@
26
-
+
RateController
values: S: 16 F: 0 R: 17 I: 0
@@ -35,7 +35,7 @@
32
-
+
FollowPath
values: S: 0 F: 0 R: 1 I: 0
@@ -49,7 +49,7 @@
27
-
+
ComputePathToPose
values: S: 16 F: 0 R: 16 I: 0
@@ -63,7 +63,7 @@
33
-
+
FollowPath
values: S: 0 F: 0 R: 1 I: 1
@@ -90,7 +90,7 @@
28
-
+
ComputePathToPose
values: S: 16 F: 0 R: 16 I: 0
diff --git a/bt_view/test/_test_data/reference/bt_trace2_demo.svg b/bt_view/test/_test_data/reference/bt_trace2_demo.svg
index 30b6a4f..a28ee62 100644
--- a/bt_view/test/_test_data/reference/bt_trace2_demo.svg
+++ b/bt_view/test/_test_data/reference/bt_trace2_demo.svg
@@ -12,7 +12,7 @@
25
-
+
NavigateWithReplanning
category: NODECAT.ROOT
@@ -20,7 +20,7 @@
26
-
+
RateController
@@ -33,7 +33,7 @@
32
-
+
FollowPath
@@ -46,7 +46,7 @@
27
-
+
ComputePathToPose
@@ -59,7 +59,7 @@
33
-
+
FollowPath
@@ -72,7 +72,7 @@
34
-
+
FollowPathRecoveryFallback
@@ -85,7 +85,7 @@
28
-
+
ComputePathToPose
@@ -98,7 +98,7 @@
29
-
+
ComputePathToPoseRecoveryFallback
@@ -111,7 +111,7 @@
30
-
+
GoalUpdated
@@ -124,7 +124,7 @@
31
-
+
ClearGlobalCostmap-Context
@@ -137,7 +137,7 @@
35
-
+
GoalUpdated
@@ -150,7 +150,7 @@
36
-
+
ClearLocalCostmap-Context
diff --git a/bt_view/test/_test_data/reference/bt_trace2_fbl_log_states.svg b/bt_view/test/_test_data/reference/bt_trace2_fbl_log_states.svg
index 2520524..6c83841 100644
--- a/bt_view/test/_test_data/reference/bt_trace2_fbl_log_states.svg
+++ b/bt_view/test/_test_data/reference/bt_trace2_fbl_log_states.svg
@@ -12,7 +12,7 @@
25
-
+
NavigateWithReplanning
category: NODECAT.ROOT
values: S: 0 F: 0 R: 1 I: 0
@@ -21,7 +21,7 @@
26
-
+
RateController
values: S: 18 F: 0 R: 19 I: 0
@@ -35,7 +35,7 @@
32
-
+
FollowPath
values: S: 0 F: 0 R: 1 I: 0
@@ -49,7 +49,7 @@
27
-
+
ComputePathToPose
values: S: 18 F: 0 R: 19 I: 0
@@ -63,7 +63,7 @@
33
-
+
FollowPath
values: S: 0 F: 0 R: 1 I: 0
@@ -90,7 +90,7 @@
28
-
+
ComputePathToPose
values: S: 19 F: 1 R: 20 I: 0
@@ -104,7 +104,7 @@
29
-
+
ComputePathToPoseRecoveryFallback
values: S: 1 F: 0 R: 0 I: 0
@@ -118,7 +118,7 @@
30
-
+
GoalUpdated
values: S: 0 F: 1 R: 0 I: 0
@@ -132,7 +132,7 @@
31
-
+
ClearGlobalCostmap-Context
values: S: 1 F: 0 R: 0 I: 0
diff --git a/bt_view/test/_test_data/reference/bt_trace_other_demo.svg b/bt_view/test/_test_data/reference/bt_trace_other_demo.svg
index aa70b11..806e8ee 100644
--- a/bt_view/test/_test_data/reference/bt_trace_other_demo.svg
+++ b/bt_view/test/_test_data/reference/bt_trace_other_demo.svg
@@ -12,7 +12,7 @@
25
-
+
NavigateWithReplanning
category: NODECAT.ROOT
@@ -20,7 +20,7 @@
26
-
+
RateController
@@ -33,7 +33,7 @@
32
-
+
FollowPath
@@ -46,7 +46,7 @@
27
-
+
ComputePathToPose
@@ -59,7 +59,7 @@
33
-
+
FollowPath
@@ -72,7 +72,7 @@
34
-
+
FollowPathRecoveryFallback
@@ -85,7 +85,7 @@
28
-
+
ComputePathToPose
@@ -98,7 +98,7 @@
29
-
+
ComputePathToPoseRecoveryFallback
@@ -111,7 +111,7 @@
30
-
+
ClearGlobalCostmap-Context
@@ -124,7 +124,7 @@
31
-
+
GoalUpdated
@@ -137,7 +137,7 @@
35
-
+
GoalUpdated
@@ -150,7 +150,7 @@
36
-
+
ClearLocalCostmap-Context
diff --git a/bt_view/test/_test_data/reference/bt_trace_other_fbl_log_states.svg b/bt_view/test/_test_data/reference/bt_trace_other_fbl_log_states.svg
index 426b27d..1bf5bc1 100644
--- a/bt_view/test/_test_data/reference/bt_trace_other_fbl_log_states.svg
+++ b/bt_view/test/_test_data/reference/bt_trace_other_fbl_log_states.svg
@@ -12,7 +12,7 @@
25
-
+
NavigateWithReplanning
category: NODECAT.ROOT
values: S: 0 F: 0 R: 1 I: 1
@@ -21,7 +21,7 @@
26
-
+
RateController
values: S: 6 F: 0 R: 7 I: 0
@@ -35,7 +35,7 @@
32
-
+
FollowPath
values: S: 0 F: 0 R: 1 I: 0
@@ -49,7 +49,7 @@
27
-
+
ComputePathToPose
values: S: 6 F: 0 R: 6 I: 0
@@ -63,7 +63,7 @@
33
-
+
FollowPath
values: S: 0 F: 0 R: 1 I: 1
@@ -90,7 +90,7 @@
28
-
+
ComputePathToPose
values: S: 6 F: 0 R: 6 I: 0
diff --git a/bt_view/test/systemtests/test_bt_view_main.py b/bt_view/test/systemtests/test_bt_view_main.py
index fa860ea..fb1908d 100644
--- a/bt_view/test/systemtests/test_bt_view_main.py
+++ b/bt_view/test/systemtests/test_bt_view_main.py
@@ -30,8 +30,6 @@ def __init__(self, *args, **kwargs):
self.no_exts = ['1', '2', '_other']
# data extensions of the different output files
self.log_data_exts = ['count', 'states']
- # data extensions on static behavior trees
- self.bt_data_exts = ['demo']
# image extensions of the different output files
self.img_exts = ['png', 'svg']