Object default state changes while running simulation

The name and docstring says the default state will be used after world.reset()
However, default state is changed inside initialize() function to reflect current pose, which makes the default state I set completely ignored.
How do I set default state properly?
I attach the code and paste the log here for reproducible.

create_new_stage()
world = World(physics_dt=1.0/30, rendering_dt=1.0/30)
cube = DynamicCuboid('/World/cube')
world.scene.add(cube)

cube.set_default_state([0, 0, 10], [1, 0, 0, 0], [0, 0, 0], [0, 0, 0])
print('before hard_reset: default', str(cube.get_default_state()))

world.reset(soft=False)
print('after hard_reset: default', str(cube.get_default_state()))
print('after hard_reset: current', str(cube.get_current_dynamic_state()))

world.reset(soft=True)
print('after soft reset, default:', str(cube.get_default_state()))
print('after soft reset, current:', str(cube.get_current_dynamic_state()))
for _ in range(5):
  world.step()

world.reset(soft=True)
print('after soft reset, default:', str(cube.get_default_state()))
print('after soft reset, current: ', str(cube.get_current_dynamic_state()))
for _ in range(5):
  world.step()
=========
before hard_reset: default DynamicState(pos=[ 0.  0. 10.], rot=[1. 0. 0. 0.], lin_vel=[0. 0. 0.], ang_vel=[0. 0. 0.])
after hard_reset: default DynamicState(pos=[ 0.      0.     -0.0327], rot=[1. 0. 0. 0.], lin_vel=[ 0.          0.         -0.65400004], ang_vel=[0. 0. 0.])
after hard_reset: current DynamicState(pos=[ 0.      0.     -0.0327], rot=[1. 0. 0. 0.], lin_vel=[ 0.          0.         -0.65400004], ang_vel=[0. 0. 0.])
after soft reset, default: DynamicState(pos=[ 0.      0.     -0.0327], rot=[1. 0. 0. 0.], lin_vel=[ 0.          0.         -0.65400004], ang_vel=[0. 0. 0.])
after soft reset, current: DynamicState(pos=[ 0.      0.     -0.0327], rot=[1. 0. 0. 0.], lin_vel=[ 0.          0.         -0.65400004], ang_vel=[0. 0. 0.])
after soft reset, default: DynamicState(pos=[ 0.      0.     -0.3052], rot=[1. 0. 0. 0.], lin_vel=[ 0.     0.    -2.289], ang_vel=[0. 0. 0.])
after soft reset, current:  DynamicState(pos=[ 0.      0.     -0.3052], rot=[1. 0. 0. 0.], lin_vel=[ 0.     0.    -2.289], ang_vel=[0. 0. 0.])

Thank you.
test_rigid.py.txt (1.5 KB)

This behavior, where the default state changes during simulation, has indeed been reported by other users as well. I appreciate you bringing this to our attention with a clear, reproducible example.

I’ve forwarded your report to our development team for investigation. They will look into why the set_default_state() method isn’t persisting through resets as it should.

We’ll update this thread as soon as we have more information or a solution. If you discover any additional insights or workarounds, please feel free to share them here.