In Stretch we have a dictionary called status, from the Stretch Body, if you are using the robot class you just have to get this status with the information that you are trying to get, take a look at this example, in a terminal run ipython3 and try the following:
In [1]: import stretch_body.robot
r=stretch_body.robot.Robot()
r.startup()
In [2]: r.pimu.status['imu']
In [3]: r.base.status
In [4]: r.base.status['pos']
In [5]: r.arm.status
This are only some examples that you can retrieve data from, when you run the status without a flag it’s going to print you all the data from that specific class, like the input 3 and 4, with this you can search for the data that you want to save from one specific joint and sensor. The base status is the one that has x, y and theta (z) that you may be looking for. You can also take a look at this tutorial from our docs about Accessing the Status Dictionaries.
If you want to go further and replay your motion data check out this thread for the base motion, here is some information that may help you understand better.