haosulab / SAPIEN

SAPIEN Embodied AI Platform
https://sapien.ucsd.edu/
MIT License
403 stars 40 forks source link

Request to Natively Support PID Joint Controllers in SAPIEN #178

Open dwaitbhatt opened 4 hours ago

dwaitbhatt commented 4 hours ago

Currently, SAPIEN only provides a PD joint controller. While using ManiSkill for manipulation tasks, I've often encountered steady-state errors while setting joint angles, particularly noticeable with common edge cases for gripper control (for example, after a collision which forces joint angles to go out of limits). Although there's a basic PID implementation example in the documentation, having native, optimized PID controller support would help improve accuracy and stability in manipulation tasks, and enhance the overall control capabilities of SAPIEN-based robotics libraries.

fbxiang commented 3 hours ago

I actually did some investigations on this topic. The built-in PD controller relies o PhysX's constraint solver, and thus it is more stable than a hand-written explicit PD. A "built-in" PID with similar stability to the PD can be best achieved by accumulating error on the user end and modifying target position based on the error (modify the position target by accu_err * Ki/Kp). An end user should be able to implement this algorithm, so I think it is more suitable for a downstream library to implement this feature to keep SAPIEN simple. I can look into adding it to ManiSkill in the future. For now, I think you can modify your codebase based on the suggestions above.