Skip to content

[Question] Only during training, encounter "PhysX error: PxRigidBody::setMass(): mass must be non-negative!" despite non-negative/non-zero masses #518

Closed

Description

@Easternspork

Quesiton

During training only, I encounter a PhysX error: PxRigidBody::setMass(): mass must be non-negative! error despite having non-negative/non-zero masses. The training does start, however, but the mean episode length is 1, so no there is no training being done, and thus I am assuming that this is the culprit.

I have tried to isolate the issue by creating a seperate scene with all of the same configs as the training environment and running it, and I have no issues running there. (So I assume this is not an issue with my configs/USD file?)

Please let me know if this is a Isaac Sim bug instead, so I can ask in their forums - however because it only occurs during training, I am suspecting it is an issue with Isaac Sim.

Steps to reproduce

Because of such a vague error message, I can't really trace it to anything, so I'm having a hard time coming up with a minimal example, so I have listed the output, USD files, as well as some code snippets that are maybe relevant to the issue. Please let me know if there are other pieces of code/outputs I should submit.

terminal_out.txt
mistletoe_usd.zip

Articulation Config

HAA_ACTUATOR_CFG = DCMotorCfg(
    joint_names_expr=[".*HAA"],
    saturation_effort=24,
    effort_limit=24,
    velocity_limit=7.5,
    stiffness={".*": 40.0},
    damping={".*": 5.0},
)

KFE_ACTUATOR_CFG = DCMotorCfg(
    joint_names_expr=[".*KFE"],
    saturation_effort=9,
    effort_limit=9,
    velocity_limit=7.5,
    stiffness={".*": 40.0},
    damping={".*": 5.0},
)

HFE_ACTUATOR_CFG = DCMotorCfg(
    joint_names_expr=[".*HFE"],
    saturation_effort=9,
    effort_limit=9,
    velocity_limit=7.5,
    stiffness={".*": 40.0},
    damping={".*": 5.0},
)

#Articulation Configs

MISTLETOE_CFG = ArticulationCfg(
    spawn=sim_utils.UsdFileCfg(
        usd_path= dirname + '/assets/mistletoe_usd/mistletoe.usd',
        
        # Adapted from Anymal Velocity Tracking Example's Config
        activate_contact_sensors=True,
        
        rigid_props=sim_utils.RigidBodyPropertiesCfg(
            disable_gravity=False,
            retain_accelerations=False,
            linear_damping=0.0,
            angular_damping=0.0,
            max_linear_velocity=1000.0,
            max_angular_velocity=1000.0,
            max_depenetration_velocity=1.0,
        ),

        articulation_props=sim_utils.ArticulationRootPropertiesCfg(
            enabled_self_collisions=True, solver_position_iteration_count=4, solver_velocity_iteration_count=0
        ),


    ),
    init_state=ArticulationCfg.InitialStateCfg(
        pos=(0.0, 0.0, 0.15),
        joint_pos={
            ".*HAA": 0.0,  # all HAA
            "LEG_[14]_HFE": 0.8,  # both front HFE
            "LEG_[23]_HFE": -0.8,  # both hind HFE
            "LEG_[23]_KFE": -0.8,  # both front KFE
            "LEG_[14]_KFE": 0.8,  # both hind KFE
        },
    ),

    actuators={
        "HAA": HAA_ACTUATOR_CFG,
        "HFE": HFE_ACTUATOR_CFG,
        "KFE": KFE_ACTUATOR_CFG
    },

    soft_joint_pos_limit_factor=0.95
)

Environment Config

@configclass
class MistletoeRoughEnvCfg(LocomotionVelocityRoughEnvCfg):
    def __post_init__(self):
        # post init of parent
        super().__post_init__()
        # switch robot to anymal-c
        self.scene.robot = MISTLETOE_CFG.replace(prim_path="{ENV_REGEX_NS}/Robot")


@configclass
class MistletoeRoughEnvCfg_PLAY(MistletoeRoughEnvCfg):
    def __post_init__(self):
        # post init of parent
        super().__post_init__()

        # make a smaller scene for play
        self.scene.num_envs = 50
        self.scene.env_spacing = 2.5
        # spawn the robot randomly in the grid (instead of their terrain levels)
        self.scene.terrain.max_init_terrain_level = None
        # reduce the number of terrains to save memory
        if self.scene.terrain.terrain_generator is not None:
            self.scene.terrain.terrain_generator.num_rows = 5
            self.scene.terrain.terrain_generator.num_cols = 5
            self.scene.terrain.terrain_generator.curriculum = False

        # disable randomization for play
        self.observations.policy.enable_corruption = False
        # remove random pushing event
        self.events.base_external_force_torque = None
        self.events.push_robot = None

rsl_rl_cfg

class MistletoeRoughPPORunnerCfg(RslRlOnPolicyRunnerCfg):
    num_steps_per_env = 24
    max_iterations = 1500
    save_interval = 50
    experiment_name = "mistloe_rough"
    empirical_normalization = False
    policy = RslRlPpoActorCriticCfg(
        init_noise_std=1.0,
        actor_hidden_dims=[512, 256, 128],
        critic_hidden_dims=[512, 256, 128],
        activation="elu",
    )
    algorithm = RslRlPpoAlgorithmCfg(
        value_loss_coef=1.0,
        use_clipped_value_loss=True,
        clip_param=0.2,
        entropy_coef=0.005,
        num_learning_epochs=5,
        num_mini_batches=4,
        learning_rate=1.0e-3,
        schedule="adaptive",
        gamma=0.99,
        lam=0.95,
        desired_kl=0.01,
        max_grad_norm=1.0,
    )

System Info

Describe the characteristic of your environment:

  • Commit: b468546
  • Isaac Sim Version: 4.0.0
  • OS: Ubuntu 22.04.3
  • GPU: RTX 3070
  • CUDA: 11.5
  • GPU Driver: 535.171.04

Additional context

The code I wrote is very similar to that of Anymal's environment, but running Anymal's environment seems to work, but mine doesn't.

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

Activity

  1. changed the title [-][Bug Report] Only during training, encounter "PhysX error: PxRigidBody::setMass(): mass must be non-negative!" despite non-negative/non-zero masses[/-] [+][Question] Only during training, encounter "PhysX error: PxRigidBody::setMass(): mass must be non-negative!" despite non-negative/non-zero masses[/+] on Jun 15, 2024
  2. Easternspork commented on Jun 16, 2024

    @Easternspork
    Author

    Stupid mistake - the mass distribution parameter for randomizing rigid body mass was too large, causing the mass to be negative.

  3. zma69650 commented on Aug 21, 2024

    @zma69650

    @Easternspork Hello, I encountered this issue while training the Unitree B1 as well. Could you please tell me where to adjust the 'random mass' parameter?

  4. Easternspork commented on Sep 28, 2024

    @Easternspork
    Author

    Oops, sorry didn't realize this until now. Hope you figured it out, but just in case, the parameter would be set in your EventCfg on startup. ie.

    class EventCfg:
    
        # startup
        add_base_mass = EventTerm(
            func=mdp.randomize_rigid_body_mass,
            mode="startup",
            params={
                "asset_cfg": SceneEntityCfg("robot", body_names="base"),
                "mass_distribution_params": (-5.0, 5.0), # << this param here
                "operation": "add",
            },
        )```
    
  5. added a commit that references this issue on Dec 11, 2025
    c1ad81d
  6. added a commit that references this issue on Dec 29, 2025
    22864d3
  7. added a commit that references this issue on Jan 14, 2026
    9615cbe
  8. added a commit that references this issue on Feb 5, 2026
    8ef224d
  9. added a commit that references this issue on Jul 8, 2026
    dca84dd
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions