Oscillation near joint position limits
Hi, Thanks for your great library.
I’ve been seeing some oscillations when a joint reaches its position limit. For example when a joint hits the limit, it doesn’t remain there, instead, it starts oscillating, moving slightly away and then back to the limit repeatedly.
This behavior doesn’t appear in sim where tracking is perfect, but I’ve observed it on hardware where tracking isn’t as good. I was wondering if you’ve had this issue before.
It depends on some implementation choices when running on hardware. One big difference is:
- Open loop: integrate configurations open-loop and send joint position targets to the actuators.
- Closed loop: update the configuration from joint encoder measurements, run Pink, send joint velocities to the actuators.
The open-loop approach is easier to get working in my experience. If you are getting to grips with differential IK I'd recommend starting with that one.
Some details on closed-loop differential IK
The closed-loop approach is not documented in Pink right now. For instance, all current examples run configuration-space integrators. We could add examples that run e.g. in closed-loop in PyBullet, a non-perfect integrator compared to configuration.integrate_inplace, or examples that add sensor noise after integrating. (I don't have the bandwidth to add such examples right now, but I can happily help review and merge PRs if external contributors are interested in this.)
One thing to pay attention to when sliding on constraints is that joint encoders can measure angles beyond limits (e.g. due to sensor noise), even when the actual joint is at the limit. If fed directly to the configuration this would result in an unfeasible QP for Pink. When working in closed-loop, it then makes sense to have a state estimator that is aware of constraints as well (e.g. clipping joint angles at or slightly before joint limits).
Hoping this helps!