Skip to content

novaphy.RecordedKeyframe

Single per-body keyframe captured by SimulationExporter.capture_frame. One keyframe entry per body per frame — the exporter appends one RecordedKeyframe for every body that has a known transform when the frame is captured.

Attributes

Attribute Description
time Simulation time [s] of the captured frame.
body_index Index of the body in the Model.
position World-space position of the body's COM [m].
rotation World-space rotation as a quaternion [qx, qy, qz, qw].
linear_velocity Body linear velocity [m/s].
angular_velocity Body angular velocity [rad/s].

Example

import novaphy

exporter = novaphy.SimulationExporter()
# ... drive the simulation and call exporter.capture_frame ...

# Build a per-body trajectory from the recorded keyframes.
trajectories = {}
for kf in exporter.keyframes:
    trajectories.setdefault(kf.body_index, []).append((kf.time, kf.position))

See Also