Skip to content

Commit

Permalink
play mcap in loop
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasw committed Aug 23, 2024
1 parent 55e029a commit e343411
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion one2z/scripts/ros1_play_mcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@

def main():
rospy.init_node("play_mcap")
while not rospy.is_shutdown():
play_mcap(sys.argv[1])
rospy.loginfo("looping")
rospy.sleep(1.0)

def play_mcap(name):
decoder = DecoderFactory()
protobuf_decoder = ProtobufDecoderFactory()
with open(sys.argv[1], "rb") as f:
with open(name, "rb") as f:
reader = make_reader(f, decoder_factories=[decoder])
schemas = reader.get_summary().schemas
for schema_id, schema in schemas.items():
Expand Down Expand Up @@ -103,6 +109,7 @@ def main():
pubs[channel.topic] = rospy.Publisher(channel.topic, msg_type, queue_size=3)
# second part of avoided decoding, is avoiding encoding via AnyMsg
msg = AnyMsg()
# print(f"{[d for d in message.data]}")
msg._buff = message.data
pubs[channel.topic].publish(msg)

Expand Down

0 comments on commit e343411

Please sign in to comment.