@palmerini
The depth values can be obtained from depth stream of the StereoDepth node. With it, you receive an array with each point distance in mm.
The example I've shared uses disparity output, as it's better for visualizations
stereo.disparity.link(depthOut.input)
But you can add a depth stream there too to obtain raw depth info.
The example erik shared uses depth stream by default, so no change there is needed
stereo.depth.link(sdn.inputDepth)
So to get the Z coordinate of an X/Y point, you need to take the depth frame (self.depth inside calc_spatials) and check what the depth value at X/Y index