Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 40 additions & 33 deletions mujoco_warp/_src/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,25 +237,24 @@ def _advance(m: Model, d: Data, qacc: wp.array, qvel: Optional[wp.array] = None)
# TODO(team): can we assume static timesteps?

# advance activations
if m.na:
wp.launch(
_next_activation,
dim=(d.nworld, m.na),
inputs=[
m.opt.timestep,
m.actuator_dyntype,
m.actuator_actlimited,
m.actuator_dynprm,
m.actuator_actrange,
d.act,
d.act_dot,
1.0,
True,
],
outputs=[
d.act,
],
)
wp.launch(
_next_activation,
dim=(d.nworld, m.na),
inputs=[
m.opt.timestep,
m.actuator_dyntype,
m.actuator_actlimited,
m.actuator_dynprm,
m.actuator_actrange,
d.act,
d.act_dot,
1.0,
True,
],
outputs=[
d.act,
],
)

wp.launch(
_next_velocity,
Expand Down Expand Up @@ -429,13 +428,22 @@ def _rk_perturb_state(m: Model, d: Data, scale: float):
)

# activation
if m.na:
wp.launch(
_next_activation,
dim=(d.nworld, m.na),
inputs=[m.opt.timestep, d.act_t0, d.act_dot, scale, False],
outputs=[d.act],
)
wp.launch(
_next_activation,
dim=(d.nworld, m.na),
inputs=[
m.opt.timestep,
m.actuator_dyntype,
m.actuator_actlimited,
m.actuator_dynprm,
m.actuator_actrange,
d.act_t0,
d.act_dot,
scale,
False,
],
outputs=[d.act],
)


@wp.kernel
Expand Down Expand Up @@ -477,13 +485,12 @@ def _rk_accumulate(m: Model, d: Data, scale: float):
outputs=[d.qvel_rk, d.qacc_rk],
)

if m.na:
wp.launch(
_rk_accumulate_activation_velocity,
dim=(d.nworld, m.na),
inputs=[d.act_dot, scale],
outputs=[d.act_dot_rk],
)
wp.launch(
_rk_accumulate_activation_velocity,
dim=(d.nworld, m.na),
inputs=[d.act_dot, scale],
outputs=[d.act_dot_rk],
)


@event_scope
Expand Down
Loading
Loading