publish ros2 message from yaml file

Viewed 9

I am trying to run a single ros2 node which is part of the autoware universe. I recorded all input topics with ros2 bag record s.th. i now have several yaml files (cods snippet in the end) containing all sent messages. Now i want to publish those messages individually to run the node on its own. I cannot use ros2 bag play to run the simulation, but I need to write a publisher node which somehow gets the message from the yaml file and publishes it every x seconds e.g. Is there a way to do that? Thank you in advance!

header:
  stamp:
    sec: 1585897255
    nanosec: 366032919
  frame_id: map
child_frame_id: base_link
pose:
  pose:
    position:
      x: 89530.4904175517
      y: 42411.98934126079
      z: -3.608327379954426
    orientation:
      x: 0.003322876298139578
      y: -0.014172646821833243
      z: 0.8596727738629668
      w: 0.5106376567135674
  covariance:
  - 0.004823699025978851
  - 0.0014223050349292865
  - 0.0
  - 0.0
  - 0.0
  - -0.00033930002493972645
  - 0.0014223050349292876
  - 0.003066485845419473
  - 0.0
  - 0.0
  - 0.0
  - -0.00018709073063899757
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - -0.0003393000249397263
  - -0.00018709073063899755
  - 0.0
  - 0.0
  - 0.0
  - 6.080293039040077e-05
twist:
  twist:
    linear:
      x: 13.072203929530296
      y: 0.0
      z: 0.0
    angular:
      x: 0.0
      y: 0.0
      z: -0.008810670840086786
  covariance:
  - 0.03935738353508679
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - -5.688005653640222e-11
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - -5.688005653640594e-11
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0015608784670052972
0 Answers
Related