Skip to content

Commit

Permalink
Increase damping planar hsa simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoelzle committed Oct 27, 2023
1 parent f1c8ebc commit c66f04b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/simulate_planar_hsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from jax import config as jax_config

jax_config.update("jax_enable_x64", True) # double precision
from diffrax import diffeqsolve, Euler, ODETerm, SaveAt
from diffrax import diffeqsolve, Euler, ODETerm, SaveAt, Tsit5
from jax import Array, jit, vmap
from jax import numpy as jnp
from functools import partial
Expand Down Expand Up @@ -32,11 +32,16 @@
phi = jnp.array([jnp.pi, jnp.pi / 2]) # motor actuation angles

# set simulation parameters
dt = 1e-4 # time step
dt = 5e-5 # time step
ts = jnp.arange(0.0, 5, dt) # time steps
skip_step = 100 # how many time steps to skip in between video frames
video_ts = ts[::skip_step] # time steps for video

# increase damping for simulation stability
params["zetab"] = 5 * params["zetab"]
params["zetash"] = 5 * params["zetash"]
params["zetaa"] = 5 * params["zetaa"]

# video settings
video_width, video_height = 700, 700 # img height and width
video_path = Path(__file__).parent / "videos" / "planar_hsa.mp4"
Expand Down Expand Up @@ -292,7 +297,7 @@ def chi2u(chi: Array) -> Array:

sol = diffeqsolve(
ode_term,
solver=Euler(),
solver=Tsit5(),
t0=ts[0],
t1=ts[-1],
dt0=dt,
Expand Down

0 comments on commit c66f04b

Please sign in to comment.