### Physics::Joint::GetAngle() returning incorrect values close to 0

I'm modeling elastic links by revolute joints with a certain spring stiffness, where the interest lies in the oscillation of the links. Information about the joint coordinates have to be sent to MATLAB, for which I am using ROS. To access the joint coordinates, I have a Gazebo Plugin that calls `joint->GetAngle(0).Radian()`

and publishes the returned value as a ROS message.

The problem I am facing lies in the reported values when the joint is close to 0. Within a certain range from -phi to phi (where phi is some small value in the order of 0.01 rad), all values get reported as either phi or -phi (seemingly randomly).

To visualize this, here is a plot of reported values over time while exhibiting some damped oscillation:

The excitation of oscillation takes place at roughly 5s, the thick "blocks" are rapidly, randomly alternating jumps from -0.0137 to 0.0137.

I understand that these small angles may not be all that relevant for typical robotic joints, but with small oscillations they become very significant and prohibit me from acquiring sensible data. What can I do to get accurate values?

Some things I can say so far:

- The value of phi is not fixed. It changes with each launch of gazebo and depends on things like inertia
- It also varies very slightly within the same setting
- I can definitely rule out MATLAB or ROS as the cause
- On a link with no attached masses, phi is several orders of magnitude smaller