vimmoos@Thor commited on
Commit
903d8df
·
1 Parent(s): 4e7a203

add previous frame to avoid lag

Browse files
Files changed (1) hide show
  1. udrl/app/sim.py +2 -1
udrl/app/sim.py CHANGED
@@ -62,6 +62,7 @@ def next_epoch(state: State):
62
 
63
 
64
  def update_frame(state: State):
 
65
  state.frame = resize(state.env.render(), (400, 600, 3))
66
  while len(state.frame) < 1:
67
  state.frame = resize(state.env.render(), (400, 600, 3))
@@ -192,7 +193,7 @@ def make_viz(state):
192
  st.header("Environment Visualization", divider=True)
193
  image_placeholder = st.empty()
194
  image_placeholder.image(
195
- state.frame,
196
  caption=f"Environment Visualization {'(Paused)' if state.paused else ''}",
197
  use_column_width=True,
198
  )
 
62
 
63
 
64
  def update_frame(state: State):
65
+ state.prev_frame = state.frame
66
  state.frame = resize(state.env.render(), (400, 600, 3))
67
  while len(state.frame) < 1:
68
  state.frame = resize(state.env.render(), (400, 600, 3))
 
193
  st.header("Environment Visualization", divider=True)
194
  image_placeholder = st.empty()
195
  image_placeholder.image(
196
+ state.frame if len(state.frame) > 2 else state.prev_frame,
197
  caption=f"Environment Visualization {'(Paused)' if state.paused else ''}",
198
  use_column_width=True,
199
  )