How to extract and save the position information from nav_msgs to a text file
I have a topic published named "cmd_local_waypoints" with two waypoints where the robot to go. I need to extract the X and Y position information from the topic and need to save it to a text file. The terminal response is shown below. You can see two position information available in the topic. I need to save it to a text file
Thanks in advance
header:
seq: 2219
stamp:
secs: 17116
nsecs: 995000000
frame_id: ''
poses: []
---
header:
seq: 2220
stamp:
secs: 17117
nsecs: 14000000
frame_id: base_link
poses:
-
header:
seq: 0
stamp:
secs: 17117
nsecs: 14000000
frame_id: base_link
pose:
position:
x: -2.32830643654e-05
y: -2.32830643654e-05
z: -2.32830643654e-05
orientation:
x: 3.4668537268e-310
y: 3.46685372677e-310
z: 0.0
w: 1.0
-
header:
seq: 0
stamp:
secs: 17117
nsecs: 14000000
frame_id: base_link
pose:
position:
x: -2.32830643654e-05
y: -2.32830643654e-05
z: -2.32830643654e-05
orientation:
x: 3.46686898944e-310
y: 3.46688499512e-310
z: 0.0
w: 1.0
Please don't use an image to display text. Copy and paste the text from the image to your question instead.