Look into the API documentation http://gazebosim.org/api
You didn't mention your version of Gazebo, so for example from Gazebo 9 API
virtual JointWrench GetForceTorque (
unsigned int _index ) pure
virtual
get internal force and torque values
at a joint.
The force and torque values are
returned in a JointWrench data
structure. Where
JointWrench.body1Force contains the
force applied by the parent Link on
the Joint specified in the parent Link
frame, and JointWrench.body2Force
contains the force applied by the
child Link on the Joint specified in
the child Link frame. Note that this
sign convention is opposite of the
reaction forces of the Joint on the
Links.
FIXME TODO: change name of this
function to something like:
GetNegatedForceTorqueInLinkFrame and
make GetForceTorque call return
non-negated reaction forces in
perspective Link frames.
Note that for ODE you must set
<provide_feedback>true<provide_feedback>
in the joint sdf to use this.
Parameters
[in] _index Not used right now
Returns
The force and torque at the joint, see above for details on conventions.
Implemented in ODEJoint, SimbodyJoint,
BulletJoint, and DARTJoint.
So using following instruction should give you the force and wrench.
myJointPtr->GetForceTorque(0)
The index 0
denotes the axis of the joint. I don't know why, but generarly whenever the gazebo API method wants an index of the axis, it always is 0, no matter if the axis is x, y or z.