Skip to content

[Bug Report] Runtime error when using randomize_joint_parameters event #4050

Closed

Description

@GiulioRomualdi

Describe the bug

When adding an event using randomize_joint_parameters to randomize actuator parameters at startup, the environment initialization fails with a shape mismatch RuntimeError when writing joint friction coefficients to simulation buffers.

Steps to reproduce

Minimal configuration:

@configclass
class CustomEventsCfg(EventCfg):
    randomize_actuator_parameters = EventTerm(
        func=mdp.randomize_joint_parameters,
        mode="startup",
        params={
            "asset_cfg": SceneEntityCfg("robot"),
            "friction_distribution_params": (0.9, 1.1),
            "armature_distribution_params": (0.9, 1.1),
            "operation": "scale",
            "distribution": "uniform",
        },
    )

The error occurs during environment creation:

RuntimeError: shape mismatch: value tensor of shape [4, 1, 12] 
cannot be broadcast to indexing result of shape [4, 12]

This happens inside:

self.asset.write_joint_friction_coefficient_to_sim(
  ...
  self._data.joint_friction_coeff[env_ids, joint_ids] = joint_friction_coeff

indicating a mismatch between the expected and produced joint parameter tensor shapes.

System Info

Additional context

The failure appears during event_manager.apply(mode="startup").
It seems the randomizer produces a tensor of shape [num_envs, 1, num_joints], but the writer expects shape [num_envs, num_joints]. Possibly missing a squeeze or incorrect broadcast inside randomize_joint_parameters.

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

  • The randomize_joint_parameters event runs without errors at startup

Activity

  1. GiulioRomualdi commented on Nov 20, 2025

    @GiulioRomualdi
    ContributorAuthor

    The error seems affecting also the latest main c627940

  2. GiulioRomualdi commented on Nov 20, 2025

    @GiulioRomualdi
    ContributorAuthor

    #4051 attempts to fix the problem

  3. RandomOakForest commented on Nov 21, 2025

    @RandomOakForest
    Collaborator

    Thank you for posting this and adding the PR. The team will review it.

  4. added
    bug
    on Nov 21, 2025
  5. added a commit that references this issue on Dec 28, 2025
    37acd83
  6. added a commit that references this issue on Jan 6, 2026
    e64b3c6
  7. added a commit that references this issue on Jan 14, 2026
    d7c314b
  8. added a commit that references this issue on Feb 5, 2026
    665b246
  9. added a commit that references this issue on Jul 8, 2026
    c9e30f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions