stripe_kit Module
STRIPE-kit is a kit of utilities wrapping over various Isaac Lab and Isaac Sim utilities. The core idea, is that you define your scene by inheriting and utilizing different classes provided here, ideally in a separate module, and then after providing the task specification simply register it with gymnasium and run your Isaac Lab RL training.
Here’s a step-by-step guide to get you started:
- Create your SceneSpec
This is where you define how the scene should be generated. Create a new class that inherits from SceneSpec and implement the methods as needed.
- Define your task
This is done via standard Isaac Lab configclasses, so you define your reward terms, termination terms, etc…
- Couple your task with your scene
This is done by creating a new instance of TrainingSpec, which takes in a SceneSpec and all the necessary parameters for the task.
- Register your task with gymnasium
TrainingSpec can be transformed into a TaskEnvCfg, which can be directly registered with gymnasium.
- Run your training
Once your task is registered, any training script that uses gymnasium works just fine. We actually have a convenient pre-built script for that, which once the package is installed should be accessible via the CLI as skrl_train.
There are a few core concepts you need to understand when working with this module.
Spec: A specification, that defines how something should be generated
Scene: An instance of a generated scene
Mesh: A 3d mesh (3d model) that can be used in a scene
configclass: The preferred Isaac Lab way of creating things, is via creating a subclass or instance of a configclass
- class stripe_kit.AssetInstance(asset_class: AssetSpec | None, mesh: AssetMesh, name: str, position: tuple[float, float, float], rotation: tuple[float, float, float, float], additional_tags: dict[str, str], asset_cfg_class: type[isaaclab.assets.AssetBaseCfg] = isaaclab.assets.AssetBaseCfg, global_collisions: bool = False)
Bases:
SceneAssetA specification for an asset to be placed in a scene
- additional_tags: dict[str, str]
Additional tags for the asset
- asset_cfg_class: type[isaaclab.assets.AssetBaseCfg]
The configuration class for the asset
- get_name() str
Get the name of the asset
- Returns:
The name of the asset
- Return type:
str
- global_collisions: bool = False
- name: str
The name of the asset
- position: tuple[float, float, float]
The position of the asset
- rotation: tuple[float, float, float, float]
The rotation of the asset
- to_cfg() isaaclab.assets.AssetBaseCfg
Create a config class object from an AssetInstance object. The returned type is determined by the asset_cfg_class attribute.
- Parameters:
scene_name (str, optional) – The name of the scene to place the asset into. Defaults to “World”.
- Returns:
The IsaacLab cfg object
- Return type:
- class stripe_kit.AssetMesh
Bases:
ABCA mesh that can be spawned within Isaac Sim
- abstractmethod to_cfg(**kwargs: Any) isaaclab.sim.spawners.SpawnerCfg
Create a SpawnerCfg object from an AssetMesh object
Logically this should return a new object, thus nullifying any effects of instancing. If you wish to prevent this behavior, use the instancable decorator.
- Parameters:
**kwargs – Additional keyword arguments, passed to the SpawnerCfg constructor
- Returns:
The IsaacLab cfg object
- Return type:
SpawnerCfg
- class stripe_kit.AssetSpec(name: str, asset_cfg_class: type[isaaclab.assets.AssetBaseCfg] = isaaclab.assets.AssetBaseCfg)
Bases:
ABCA specification for a class of assets to be placed in a scene. SceneSpec class uses this to generate AssetInstance objects to be placed on the terrain.
- asset_cfg_class: type[isaaclab.assets.AssetBaseCfg]
The configuration class for the asset.
- create_instance(name: str, asset: AssetMesh, position: tuple[float, float, float], rotation: tuple[float, float, float, float], tags: dict[str, str] | None = None, global_collisions: bool = False) AssetInstance
Create an AssetInstance object from an AssetSpec object
- Parameters:
name (str) – The name of the asset instance
asset (AssetMesh) – The mesh of the asset instance
position (tuple[float, float, float]) – The position of the asset instance
rotation (tuple[float, float, float, float]) – The rotation of the asset instance
tags (dict[str, str], optional) – Additional tags to add to the asset instance. Defaults to None.
- Returns:
The AssetInstance object
- Return type:
- abstractmethod generate(terrain: TerrainInstance) list[AssetInstance]
Generate instances of the asset to be placed on the terrain
- Parameters:
terrain (TerrainInstance) – The terrain to place the asset on
- Returns:
A list of instances of the asset to be placed on the terrain
- Return type:
list[AssetInstance]
- name: str
The name of the asset. For example, “Tree” or “Rock”.
- class stripe_kit.DynamicMesh(mesh: trimesh.Trimesh, visual_material_path: str | None = None, visual_material: isaaclab.sim.spawners.VisualMaterialCfg = <factory>, physics_material: isaaclab.sim.spawners.RigidBodyMaterialCfg = <factory>)
Bases:
AssetMeshA dynamic mesh asset defined by a Trimesh object
- mesh: trimesh.Trimesh
The Trimesh object that defines the mesh
- physics_material: isaaclab.sim.spawners.RigidBodyMaterialCfg
The physics material configuration for the mesh
- to_cfg(**kwargs: Any) isaaclab.sim.spawners.SpawnerCfg
Converts the dynamic mesh to a SpawnerCfg object
- Parameters:
**kwargs – Additional keyword arguments, passed to the SpawnerCfg constructor
- Returns:
A SpawnerCfg object representing the dynamic mesh
- Return type:
SpawnerCfg
- visual_material: isaaclab.sim.spawners.VisualMaterialCfg
The visual material configuration for the mesh
- visual_material_path: str | None = None
Path to the visual material file, needed for MDL materials only
- class stripe_kit.IdenticalAssetSpec(name: str, mesh: AssetMesh, asset_cfg_class: type[isaaclab.assets.AssetBaseCfg] = isaaclab.assets.AssetBaseCfg, rotation: tuple[float, float, float, float] = (0, 0, 0, 1))
Bases:
AssetSpec,ABCA specification for an asset class, that will be identical across all instances
- create_identical_instance(name: str, position: tuple[float, float, float], rotation: tuple[float, float, float, float], tags: dict[str, str] | None = None) AssetInstance
Create an AssetInstance object from an AssetSpec object
- Parameters:
name (str) – The name of the asset instance
position (tuple[float, float, float]) – The position of the asset instance
rotation (tuple[float, float, float, float]) – The rotation of the asset instance
tags (dict[str, str] | None, optional) – The tags to assign to the asset instance. Defaults to None.
- Returns:
The AssetInstance object
- Return type:
- abstractmethod find_positions(terrain: TerrainInstance) list[tuple[float, float, float]]
Find positions to place the asset on the terrain. This is essentially a devolved generate() that returns a list of positions instead of creating instances.
- Parameters:
terrain (TerrainInstance) – The terrain to place the asset on
- Returns:
A list of positions to place the asset on the terrain
- Return type:
list[tuple[float, float, float]]
- generate(terrain: TerrainInstance) list[AssetInstance]
Generate instances of the asset to be placed on the terrain
Internally, this method calls self.find_positions(terrain) to find positions to place the asset on the terrain, and then self.create_instance(name, position, rotation) to create instances of the asset.
- Parameters:
terrain (TerrainInstance) – The terrain to place the asset on
- Returns:
A list of instances of the asset to be placed on the terrain
- Return type:
list[AssetInstance]
- class stripe_kit.SceneCfgFactory(terrain: TerrainInstance, num_envs: int = 1, env_spacing: float = 0.0, **kwargs: bool)
Bases:
objectA factory class for creating InteractiveSceneCfg objects from TerrainInstance and SceneAsset objects.
Logically, this represents a generated scene, that for some reason you might want to alter or create multiple instances of.
- add_asset(asset: SceneAsset) None
Add an AssetInstance object to the factory
- Parameters:
asset (AssetInstance) – The AssetInstance object to add
- Raises:
ValueError – If an asset with the same name already exists
- add_sensor(name: str, sensor: isaaclab.sensors.SensorBaseCfg) None
Add sensors to the scene
- Parameters:
name (str) – The name of the sensor
sensor (SensorBaseCfg) – The sensor configuration
- get_scene(robot: isaaclab.assets.AssetBaseCfg) isaaclab.utils.configclass
Gets the scene configuration
- Returns:
Shallow copy of the NFLInteractiveSceneCfg object
- Return type:
NFLInteractiveSceneCfg
- robot_name: str = 'robot'
- class stripe_kit.SceneSpec(size: tuple[float, float], palette: list[~stripe_kit.asset.AssetSpec], distant_light: ~stripe_kit.asset.DistantLightSpec = <factory>, dome_light: ~stripe_kit.asset.DomeLightSpec = <factory>)
Bases:
ABCA specification for a scene to be generated.
You can think of this like a factory of scenes, which it is. Here you define how big the scenes will be, what type of assets they will have and what light should be added to the scene.
You have to implement the generate method, which is used to generate the terrain for the scene. Beyond that, for more complex scenes it’s a good idea to implement create_instance on your own, but for simpler use cases that shouldn’t be necessary.
The idea is, that your scene should have a logical palette of asset types. Think of it this way: a forest, will have trees, rocks, bushes etc… Logically you would create an AssetSpec for trees, rocks and bushes, and these would go to the palette. If you need contextual generation, you should place them in a single AssetSpec.
- add_asset(asset: AssetSpec)
Add an asset to the scene palette.
The default implementation of create_instance will use that palette to generate instances of the assets to be placed in the scene.
- Parameters:
asset (AssetSpec) – The asset to add
- create_instance(num_envs: int = 1, env_spacing: float = 0.0, debug_models: bool = False, **kwargs: bool) SceneCfgFactory
Create a SceneCfgFactory object from the SceneSpec object.
The default implementation, generates the terrain using the generate method, and then generates the assets using the asset specifications in the palette. The generated scene is then returned.
- Parameters:
num_envs (int) – The number of environments to generate
env_spacing (float) – The spacing between environments
**kwargs – Additional keyword arguments to pass to the SceneCfgFactory
- Returns:
The SceneCfgFactory object
- Return type:
- distant_light: DistantLightSpec
- dome_light: DomeLightSpec
The light specification for the scene
- abstractmethod generate() TerrainInstance
Generate a terrain instance. This method is used to generate the terrain for the scene.
While implementing this method, you can store extra data in the returned object, that then can be used by the asset specifications, thus allowing for more performant scene generation, where interesting spots encountered during terrain generation can be used to place assets.
- Returns:
The generated terrain instance
- Return type:
- size: tuple[float, float]
The size of the scene
- class stripe_kit.TaskEnvCfg(*args: Any, **kwargs: Any)
Bases:
ManagerBasedRLEnvCfgConfiguration for a task environment, usually created by TrainingSpec.
- register(id: str, **kwargs: str)
Registers the environment within gymnasium.
An instance of this class is stored within globals of this module, as globals()[id]. Gymnasium is then instructed to get this instance, and pass it to NflEnvMixin.
- Parameters:
id (str) – The id of the environment to register.
**kwargs (str) – Additional keyword arguments to pass to gymnasium.register.
- scene: isaaclab.utils.configclass
- class stripe_kit.TerrainInstance(mesh: list[tuple[trimesh.Trimesh, list[tuple[str, str]]]], origin: tuple[float, float, float], size: tuple[float, float], color: tuple[float, float, float], material: str | None = None)
Bases:
objectA specification for a terrain to be placed in a scene.
Logically, the terrain should cover the entire declared size, meaning holes are allowed, but that implies non-continuous terrain.
Terrain consists of multiple meshes that are combined to form a single terrain. Each mesh can have specific semantic tags attached to it.
- color: tuple[float, float, float]
The color of the terrain
- material: str | None = None
Path to the material mdl file
- mesh: list[tuple[trimesh.Trimesh, list[tuple[str, str]]]]
The mesh of the terrain and the tags to add to the mesh
- origin: tuple[float, float, float]
The position where the robot should spawn
- size: tuple[float, float]
The size of the terrain in meters
- to_asset_cfg() list[isaaclab.assets.AssetBaseCfg]
Create a asset Cfg object from a TerrainInstance object
- Returns:
The AssetBaseCfg object
- Return type:
AssetBaseCfg
- to_cfg() isaaclab.terrains.TerrainGeneratorCfg
Create a TerrainGeneratorCfg object from a TerrainInstance object
Please note that this method does not apply semantic tags to the terrain.
- Returns:
The TerrainGeneratorCfg object
- Return type:
TerrainGeneratorCfg
- class stripe_kit.TrainingSpec(scene: SceneSpec, robot: isaaclab.assets.ArticulationCfg, *, sensors: Mapping[str, isaaclab.sensors.SensorBaseCfg] | None = None, **kwargs: Any)
Bases:
objectA complete specification for training a robot in a scene.
Having defined your scene using a SceneSpec, you then have to define your task, by deciding which robot to use, what sensors you need, and your rewards, terminations, commands, etc… Consult the Isaac Lab documentation for more information how to do it properly.
After creating your TrainingSpec, you can create a ManagerBasedRLEnv instance using the to_env_cfg method. This custom environment is best registered in gymnasium using the register method.
- to_env_cfg(view_cfg: isaaclab.envs.ViewerCfg, decimation: int = 4, episode_length_s: float = 100.0) TaskEnvCfg
- class stripe_kit.USDMesh(usd_path: str)
Bases:
AssetMeshA mesh derived from a USD file
- to_cfg(**kwargs: Any) isaaclab.sim.spawners.UsdFileCfg
Create a UsdFileCfg object from an AssetMesh object
- Parameters:
**kwargs – Additional keyword arguments, passed to the UsdFileCfg constructor
- Returns:
The IsaacLab cfg object
- Return type:
UsdFileCfg
- usd_path: str