Skip to content

Commit

Permalink
update example longtrial
Browse files Browse the repository at this point in the history
  • Loading branch information
maximvochten committed Oct 29, 2024
1 parent 750f932 commit 1dfd5aa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/calculate_invariants_position_longtrial.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
stepsize = np.mean(np.diff(timestamps))

# Downsample the trajectory to 100 samples
downsampled_indices = np.linspace(0, len(trajectory) - 1, 200, dtype=int)
downsampled_indices = np.linspace(0, len(trajectory) - 1, 400, dtype=int)
trajectory = trajectory[downsampled_indices]/1000 # Convert to meters
timestamps = timestamps[downsampled_indices]
stepsize = np.mean(np.diff(timestamps))
Expand All @@ -52,6 +52,9 @@
ocp = OCP_calc_pos(window_len=len(trajectory),fatrop_solver=True,geometric=True)
invariants, reconstructed_trajectory, moving_frames = ocp.calculate_invariants(trajectory, stepsize)

invariants[:,1] = invariants[:,1]/invariants[:,0] # get geometric curvature
invariants[:,2] = invariants[:,2]/invariants[:,0] # get geometric torsion

# Plot the calculated invariants as subplots
fig, axs = plt.subplots(3, 1, figsize=(10, 8))

Expand Down

0 comments on commit 1dfd5aa

Please sign in to comment.