Exporting object's rigid body sim XYZ coordinates
Bake, then use the matrix world translation
As proposed here Is there any way to export the last frame of a physics simulation from command line?
bake the sim, then in this case instead of exporting, run thru the objects in the scene and print their global translation.  in lieu of Formatting and writing  data to a text file
Make the origin of the physics objects the center of mass when setting up.
import bpy
context = bpy.context

scene = context.scene
rbw = scene.rigidbody_world
pc = rbw.point_cache

# match bake to animation
print(pc.frame_start, pc.frame_end)


bpy.ops.ptcache.bake({&quot;point_cache&quot;: pc}, bake=True)

scene.frame_set(250)
#bpy.ops.export_scene.obj(filepath=&quot;test.obj&quot;)

for ob in scene.objects:
    print(ob.name, ob.matrix_world.translation)

Result on default file, cube made a default rigid and dropped
Cube &lt;Vector (0.0000, 0.0000, -460.8643)&gt;
Lamp &lt;Vector (1.7122, 1.0489, 8.5606)&gt;
Camera &lt;Vector (5.1171, -6.4642, 8.0004)&gt;