Skip to content

Commit

Permalink
Throw error if /tf messages are not tf2. (#617)
Browse files Browse the repository at this point in the history
Closes #613
  • Loading branch information
MichaelGrupp authored Jan 4, 2024
1 parent cda8b4b commit 329fdd6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions evo/tools/tf_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

logger = logging.getLogger(__name__)

SUPPORTED_TF_MSG = "tf2_msgs/msg/TFMessage"


class TfCacheException(EvoException):
pass
Expand Down Expand Up @@ -91,6 +93,10 @@ def from_bag(self, reader: Rosbag1Reader, topic: str = "/tf",
]
for connection, _, rawdata in reader.messages(
connections=connections):
if connection.msgtype != SUPPORTED_TF_MSG:
raise TfCacheException(
f"Expected {SUPPORTED_TF_MSG} message type for topic "
f"{tf_topic}, got: {connection.msgtype}")
msg = deserialize_cdr(ros1_to_cdr(rawdata, connection.msgtype),
connection.msgtype)
for tf in msg.transforms:
Expand Down

0 comments on commit 329fdd6

Please sign in to comment.