Sometimes you might need to get the robot’s actual position to compare your state estimation code. Copy paste the contents of this file (plugin_code) into your urdf description file. It should publish the ground truth to “/ground_truth/state”.
This tag basically tells gazebo to publish an additional topic using the p3d plugin.
*Note: For ROS kinetic, the script needs to be updated to say ‘Offset’ instead of ‘Offsets’. (thank to Devon below for bringing this to notice)