Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements joint position limits by reading the following fields from a parsed SDF model:
joint/axis/limit/stiffness
joint/axis/limit/dissipation
Despite we read both parameters, the model used by the physics just uses the$k_{limit}$ . This is because the stiffness/dissipation parameters could be mapped respectively to a spring/damper model, and the implemented model is equivalent to a pure spring. This means that the joint velocity is not used, and the torque is computed just as a term proportional to the joint position error wrt the limit.
dissipation
parameter asI've tried also two different spring/damper models:
and
Beyond requiring to tune an additional$k_{spring}$ parameter, both models do not give interesting additions. Particularly, $\tau_{limit}^{(1)}$ produces very often $\tau_{limit}^{(2)}$ enforces linearity by smoothing the spring gain with the position error, but beyond being having a less physical explanation, it works only with small $k_{spring}$ in order to prevent
NaNs
due to the discontinuous behavior (that would also affect differentiability #4). Instead,NaNs
.For the time being, I prefer keeping things simple. More advanced models can be introduced in the future. Note that a more advanced methodology exploits a constraint solver for joint limits, based on the Gauss principle of least constraint. Since it would make the forward step of the simulation much heavier, let's begin supporting the simple model of this PR.
Here below an example with a simple pendulum. GIFs are recorded with a real-time factor of 0.2.
Closes #20.