You are close. I think what you are looking for is described here in part c)
Poses are really relative to the world coordinates. So Pw_g is the pose of gauge in world coordinates. Pw_tcp is TCP in world. To get the pose of gauge relative to tcp, you need Ptcp_g. pose_trans() is a composition, so the Pw_g = Pw_tcp * Ptcp_g (ie pose_trans(Pw_tcp, Ptcp_g) ) and the tcp subscripts match up. Likewise Ptcp_g = Ptcp_w * Pw_g (ie pose_trans(Ptcp_w, Pw_g) ). Lastly pose_inv() switches the direction of the pose, so Ptcp_w is the location of the world (ie base) relative to the TCP and Ptcp_w = pose_inv(Pw_tcp).
Here is a script to demonstrate it. Values will show up on the log tab. check just applies the relative back to the tcp in world to confirm you get back to the Pw_g.
Pw_g = p[0.42155,0.06483,0.30493,-0.00004,0.00003,1.73676]
Pw_tcp = p[0.23634,0.16249,0.26557,2.00009,-0.74194,2.05458]
Ptcp_w = pose_inv(Pw_tcp)
Ptcp_g = pose_trans(Ptcp_w, Pw_g)
textmsg("relative ", Ptcp_g)
textmsg("check ", pose_trans(Pw_tcp, Ptcp_g))
Pw_g = p[0,0,3,0,0,3.14]
Pw_tcp = p[1,1,3,0,0,0]
Ptcp_w = pose_inv(Pw_tcp)
Ptcp_g = pose_trans(Ptcp_w, Pw_g)
textmsg("relative ", Ptcp_g)
textmsg("check ", pose_trans(Pw_tcp, Ptcp_g))