Skip to content

IK real time from markers#4248

Open
Seeeeeyo wants to merge 3 commits into
opensim-org:mainfrom
Seeeeeyo:feature_rt_ik_clean
Open

IK real time from markers#4248
Seeeeeyo wants to merge 3 commits into
opensim-org:mainfrom
Seeeeeyo:feature_rt_ik_clean

Conversation

@Seeeeeyo

@Seeeeeyo Seeeeeyo commented Feb 7, 2026

Copy link
Copy Markdown

Hi,

Brief summary of changes

This PR adds support for real-time inverse kinematics from streaming marker data, by introducing a marker reference that can be fed live data and wiring the IK solver to use it when present.

  • BufferedMarkersReference (new): A MarkersReference subclass that buffers marker data so clients can push frames via putValues(time, dataRow) and the IK solver can consume them via getNextValuesAndTime(values) and hasNext(), mirroring the pattern used by BufferedOrientationsReference. It can be constructed from a TimeSeriesTable (e.g. from a TRC) or used empty and filled at runtime.
  • InverseKinematicsSolver: When the solver’s marker reference is a BufferedMarkersReference and hasNext() is true, it uses the streaming path (time advanced from the buffer via getNextValuesAndTime); otherwise it keeps the existing behavior (getValuesAtTime). This applies both when _advanceTimeFromReference is true (e.g. for track()) and in the non-advancing path.
  • MarkersReference and related headers/bindings are updated so the new class and streaming usage are correctly declared and exposed.
  • Build: BufferedMarkersReference is added to the Simulation library and CMake; Python/SWIG bindings are updated so the new class is available from the API.

Existing IK usage (e.g. from a TimeSeriesTable or file-based MarkersReference) is unchanged; the new behavior is only used when a BufferedMarkersReference is supplied and has data in its buffer.

Testing I've completed

  • Tested it with motion capture real-time and visualized the results with the opensim visualizer.

Looking for feedback on...

  • API design of BufferedMarkersReference (e.g. putValues / getNextValuesAndTime / hasNext and constructor overloads).
  • Naming, placement of the new class, and any documentation you’d like added.

CHANGELOG.md (choose one)

  • didn't update yet.

This change is Reviewable

#include <OpenSim/Simulation/Model/OffsetFrame.h>
#include <OpenSim/Simulation/Model/PhysicalOffsetFrame.h>
#include <OpenSim/Simulation/Model/StationDefinedFrame.h>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it the intention to remove this unrelated header from here?

@aymanhab aymanhab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to merge branch main into this branch to avoid downstream complications or unintended diffs. Thank you

@aymanhab made 1 comment.
Reviewable status: 0 of 8 files reviewed, 1 unresolved discussion (waiting on Seeeeeyo).

@aymanhab aymanhab left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aymanhab resolved 1 discussion.
Reviewable status: 0 of 8 files reviewed, all discussions resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants