Vehicles Wizard assets usage in standalone env

Hello, I am trying to use the vehicle wizard extension for vehicle creation to use them in my custom standalone environment, but created assets do not properly work when used in standalone simulation

Isaac Sim Version

4.2.0

Isaac Lab Version (if applicable)

1.2

Operating System

Windows 11

Topic Description

Detailed Description

Vehicles work fine in the simulation that is started in the omniverse Isaac sim, however, when I spawn vehicle assets using standalone AppLauncher vehicle physics start to behave randomly shaking and flying

Steps to Reproduce

  1. Create a new vehicle using Vehicle Wizard with wheels collisions enabled, save it as usd (or use one provided in the post)
  2. Use the provided code, and change the path to a usd asset (vehicle_path)
  3. Run the code in Isaac lab
  4. The vehicle starts to fly randomly and shake

Screenshots or Videos

Video of the issue

Additional Information

What I’ve Tried

For the test, I have created a vehicle with basic settings from the vehicle wizard

Basic vehicle asset usd

When spawning it through AppLauncher I ran into a set of problems that I think was solved in my code

  1. Simulation has to be run on CPU, as far as I understand GPU is not supported for PhysX vehicles (if this is not true please tell me how to correctly enable it)
    This is done with the following in my code
    sim_cfg = sim_utils.SimulationCfg(device="cpu", dt=0.005, physx=sim_utils.PhysxCfg())
    sim = SimulationContext(sim_cfg)
  1. The physics scene has to have Vehicle Context
    # Set up vehicle context before simulation starts
    stage = omni.usd.get_context().get_stage()
    physics_path = "/physicsScene"
    physics_scene = UsdPhysics.Scene.Define(stage, physics_path)
    
    # Set gravity direction (Z-up means gravity in -Z)
    physics_scene.CreateGravityDirectionAttr(Gf.Vec3f(0.0, 0.0, -1.0))
    physics_scene.CreateGravityMagnitudeAttr(9.81)
    
    # Apply vehicle context
    vehicle_context = PhysxSchema.PhysxVehicleContextAPI.Apply(physics_scene.GetPrim())
    vehicle_context.CreateUpdateModeAttr(PhysxSchema.Tokens.velocityChange)
    vehicle_context.CreateVerticalAxisAttr(PhysxSchema.Tokens.posZ)
    vehicle_context.CreateLongitudinalAxisAttr(PhysxSchema.Tokens.posX)

Full code for the standalone app

vehicle_path = "E:/assets/outr_truck_sr2.usd"

"""Launch Isaac Sim Simulator first."""

import argparse
from omni.isaac.lab.app import AppLauncher

# add argparse arguments
parser = argparse.ArgumentParser(description="Test environment for truck.")
parser.add_argument("--num_envs", type=int, default=1, help="Number of environments to spawn.")
# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
# parse the arguments
args_cli = parser.parse_args()

# launch omniverse app
app_launcher = AppLauncher(args_cli)
simulation_app = app_launcher.app

# Move all Omniverse/PXR imports here, after simulation_app initialization
import omni.isaac.lab.sim as sim_utils
from omni.isaac.lab.assets import AssetBaseCfg
from omni.isaac.lab.scene import InteractiveScene, InteractiveSceneCfg
from omni.isaac.lab.sim import SimulationContext
from omni.isaac.lab.utils import configclass
from pxr import Usd, UsdGeom, Gf, PhysxSchema, UsdPhysics, Sdf
import omni.usd

@configclass
class TruckSceneCfg(InteractiveSceneCfg):
    """Configuration for a truck scene."""

    # ground plane
    ground = AssetBaseCfg(prim_path="/World/defaultGroundPlane", spawn=sim_utils.GroundPlaneCfg())

    # lights
    dome_light = AssetBaseCfg(
        prim_path="/World/Light", spawn=sim_utils.DomeLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
    )

    # truck
    truck = AssetBaseCfg(
        prim_path="{ENV_REGEX_NS}/Truck",
        spawn=sim_utils.UsdFileCfg(usd_path=vehicle_path)
    )

def main():
    """Main function."""
    # Load kit helper
    sim_cfg = sim_utils.SimulationCfg(device="cpu", dt=0.005, physx=sim_utils.PhysxCfg())
    sim = SimulationContext(sim_cfg)
    # Design scene
    scene_cfg = TruckSceneCfg(num_envs=args_cli.num_envs, env_spacing=10.0)
    scene = InteractiveScene(scene_cfg)

    # Set up vehicle context before simulation starts
    stage = omni.usd.get_context().get_stage()
    physics_path = "/physicsScene"
    physics_scene = UsdPhysics.Scene.Define(stage, physics_path)
    
    # Set gravity direction (Z-up means gravity in -Z)
    physics_scene.CreateGravityDirectionAttr(Gf.Vec3f(0.0, 0.0, -1.0))
    physics_scene.CreateGravityMagnitudeAttr(9.81)
    
    # Apply vehicle context
    vehicle_context = PhysxSchema.PhysxVehicleContextAPI.Apply(physics_scene.GetPrim())
    vehicle_context.CreateUpdateModeAttr(PhysxSchema.Tokens.velocityChange)
    vehicle_context.CreateVerticalAxisAttr(PhysxSchema.Tokens.posZ)
    vehicle_context.CreateLongitudinalAxisAttr(PhysxSchema.Tokens.posX)

    # Play the simulator
    sim.reset()
    # Now we are ready!
    print("[INFO]: Setup complete...")
    
    # Simple simulation loop
    while simulation_app.is_running():
        sim.step()
        scene.update(sim.get_physics_dt())

if __name__ == "__main__":
    # run the main function
    main()
    # close sim app
    simulation_app.close()

bump, still can’t fix this issue, repeats with load order changes, other vehicle assets

Thanks for posting this. It seems your vehicle bounces as it falls to the ground. Have you tried spawning the vehicle at ground level?

Hi, yes, I’ve tried to spawn it at the ground level, in this case, it sometimes starts to bounce, and sometimes fells below the ground level

try to play around with material property of wheels, add rigid body to material and adjust dynamic and static friction also check ground material. you better go through demo scenes.