Support for Capstan Friction in Spatial Tendons #3021
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.
Description
This PR implements the necessary data exposure to support capstan friction models (e.g., Euler-Eytelwein formula) for spatial tendons. It exposes the internally computed wrap geometry (wrap length, entry point, exit point) which was previously discarded.
Fixes #3005
Changes
mjdata.h
Added new fields to mjData to store per-wrap-segment geometry:
mjtNum* wrap_length: Arc length of the wrap on the geometry surface.
mjtNum* wrap_entry: 3D position of the tendon entry tangent point.
mjtNum* wrap_exit: 3D position of the tendon exit tangent point.
mjxmacro.h
Updated MJDATA_POINTERS to include the new fields, ensuring automatic memory allocation and pointer initialization in
mj_makeData
.
engine_core_smooth.c
Modified
mj_tendon
to populate the new wrap_length, wrap_entry, and wrap_exit fields using the values computed by
mju_wrap
.
Motivation
Currently, users cannot implement physically accurate capstan friction models (T_high = T_low * exp(mu * theta)) because the wrap angle theta (or arc length) is not accessible via the API, even though it is computed internally. This change exposes that data, enabling advanced cable-driven robot simulation.