Skip to content

Commit 70d988b

Browse files
authored
Merge branch 'main' into feature/spawn-events
Signed-off-by: Mayank Mittal <[email protected]>
2 parents 870ce8a + f6741f3 commit 70d988b

File tree

26 files changed

+1109
-109
lines changed

26 files changed

+1109
-109
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
runtime-versions:
6+
nodejs: 14
7+
pre_build:
8+
commands:
9+
- git config --global user.name "Isaac LAB CI Bot"
10+
- git config --global user.email "[email protected]"
11+
build:
12+
commands:
13+
- git remote set-url origin https://github.com/${TARGET_REPO}.git
14+
- git checkout $SOURCE_BRANCH
15+
- git push --force https://[email protected]/${TARGET_REPO}.git $SOURCE_BRANCH:$TARGET_BRANCH

.github/workflows/postmerge-ci-buildspec.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,42 @@ version: 0.2
33
phases:
44
build:
55
commands:
6-
- echo "Building a docker image"
7-
- docker login -u \$oauthtoken -p $NGC_TOKEN nvcr.io
8-
- docker build -t $IMAGE_NAME:latest-1.2 --build-arg ISAACSIM_VERSION_ARG=4.2.0 --build-arg ISAACSIM_ROOT_PATH_ARG=/isaac-sim --build-arg ISAACLAB_PATH_ARG=/workspace/isaaclab --build-arg DOCKER_USER_HOME_ARG=/root -f docker/Dockerfile.base .
9-
- echo "Pushing the docker image"
10-
- docker push $IMAGE_NAME:latest-1.2
11-
- docker tag $IMAGE_NAME:latest-1.2 $IMAGE_NAME:latest-1.2-b$CODEBUILD_BUILD_NUMBER
12-
- docker push $IMAGE_NAME:latest-1.2-b$CODEBUILD_BUILD_NUMBER
6+
- echo "Building and pushing Docker image"
7+
- |
8+
# Determine branch name or use fallback
9+
if [ -n "$CODEBUILD_WEBHOOK_HEAD_REF" ]; then
10+
BRANCH_NAME=$(echo $CODEBUILD_WEBHOOK_HEAD_REF | sed 's/refs\/heads\///')
11+
elif [ -n "$CODEBUILD_SOURCE_VERSION" ]; then
12+
BRANCH_NAME=$CODEBUILD_SOURCE_VERSION
13+
else
14+
BRANCH_NAME="unknown"
15+
fi
16+
17+
# Replace '/' with '-' and remove any invalid characters for Docker tag
18+
SAFE_BRANCH_NAME=$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9._-]/-/g')
19+
20+
# Use "latest" if branch name is empty or only contains invalid characters
21+
if [ -z "$SAFE_BRANCH_NAME" ]; then
22+
SAFE_BRANCH_NAME="latest"
23+
fi
24+
25+
# Get the git repository short name
26+
REPO_SHORT_NAME=$(basename -s .git `git config --get remote.origin.url`)
27+
if [ -z "$REPO_SHORT_NAME" ]; then
28+
REPO_SHORT_NAME="verification"
29+
fi
30+
31+
# Combine repo short name and branch name for the tag
32+
COMBINED_TAG="${REPO_SHORT_NAME}-${SAFE_BRANCH_NAME}"
33+
34+
docker login -u \$oauthtoken -p $NGC_TOKEN nvcr.io
35+
docker build -t $IMAGE_NAME:$COMBINED_TAG \
36+
--build-arg ISAACSIM_BASE_IMAGE_ARG=$ISAACSIM_BASE_IMAGE \
37+
--build-arg ISAACSIM_VERSION_ARG=4.2.0 \
38+
--build-arg ISAACSIM_ROOT_PATH_ARG=/isaac-sim \
39+
--build-arg ISAACLAB_PATH_ARG=/workspace/isaaclab \
40+
--build-arg DOCKER_USER_HOME_ARG=/root \
41+
-f docker/Dockerfile.base .
42+
docker push $IMAGE_NAME:$COMBINED_TAG
43+
docker tag $IMAGE_NAME:$COMBINED_TAG $IMAGE_NAME:$COMBINED_TAG-b$CODEBUILD_BUILD_NUMBER
44+
docker push $IMAGE_NAME:$COMBINED_TAG-b$CODEBUILD_BUILD_NUMBER

.github/workflows/premerge-ci-buildspec.yml

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,39 @@ phases:
44
pre_build:
55
commands:
66
- echo "Launching EC2 instance to run tests"
7-
- INSTANCE_ID=$(aws ec2 run-instances --image-id ami-0f7f7fb14ee15d5ae --count 1 --instance-type g5.2xlarge --key-name production/ssh/isaaclab --security-group-ids sg-02617e4b8916794c4 --subnet-id subnet-0907ceaeb40fd9eac --block-device-mappings 'DeviceName=/dev/sda1,Ebs={VolumeSize=500}' --output text --query 'Instances[0].InstanceId')
7+
- |
8+
INSTANCE_ID=$(aws ec2 run-instances \
9+
--image-id ami-0b3a9d48380433e49 \
10+
--count 1 \
11+
--instance-type g5.2xlarge \
12+
--key-name production/ssh/isaaclab \
13+
--security-group-ids sg-02617e4b8916794c4 \
14+
--subnet-id subnet-0907ceaeb40fd9eac \
15+
--block-device-mappings '[{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":500}}]' \
16+
--output text \
17+
--query 'Instances[0].InstanceId')
818
- aws ec2 wait instance-running --instance-ids $INSTANCE_ID
9-
- EC2_INSTANCE_IP=$(aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" "Name=instance-id,Values=$INSTANCE_ID" --query 'Reservations[*].Instances[*].[PrivateIpAddress]' --output text)
19+
- |
20+
EC2_INSTANCE_IP=$(aws ec2 describe-instances \
21+
--filters "Name=instance-state-name,Values=running" "Name=instance-id,Values=$INSTANCE_ID" \
22+
--query 'Reservations[*].Instances[*].[PrivateIpAddress]' \
23+
--output text)
1024
- mkdir -p ~/.ssh
11-
- aws ec2 describe-key-pairs --include-public-key --key-name production/ssh/isaaclab --query 'KeyPairs[0].PublicKey' --output text > ~/.ssh/id_rsa.pub
12-
- aws secretsmanager get-secret-value --secret-id production/ssh/isaaclab --query SecretString --output text > ~/.ssh/id_rsa
25+
- |
26+
aws ec2 describe-key-pairs --include-public-key --key-name production/ssh/isaaclab \
27+
--query 'KeyPairs[0].PublicKey' --output text > ~/.ssh/id_rsa.pub
28+
- |
29+
aws secretsmanager get-secret-value --secret-id production/ssh/isaaclab \
30+
--query SecretString --output text > ~/.ssh/id_rsa
1331
- chmod 400 ~/.ssh/id_*
1432
- echo "Host $EC2_INSTANCE_IP\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
15-
- aws ec2-instance-connect send-ssh-public-key --instance-id $INSTANCE_ID --availability-zone us-west-2a --ssh-public-key file://~/.ssh/id_rsa.pub --instance-os-user ubuntu
33+
- |
34+
aws ec2-instance-connect send-ssh-public-key \
35+
--instance-id $INSTANCE_ID \
36+
--availability-zone us-west-2a \
37+
--ssh-public-key file://~/.ssh/id_rsa.pub \
38+
--instance-os-user ubuntu
39+
1640
build:
1741
commands:
1842
- echo "Running tests on EC2 instance"
@@ -40,10 +64,20 @@ phases:
4064
retry_scp
4165
'
4266
- ssh ubuntu@$EC2_INSTANCE_IP "docker login -u \\\$oauthtoken -p $NGC_TOKEN nvcr.io"
43-
- ssh ubuntu@$EC2_INSTANCE_IP "cd $SRC_DIR;
44-
DOCKER_BUILDKIT=1 docker build -t isaac-lab-dev --build-arg ISAACSIM_VERSION_ARG=4.2.0 --build-arg ISAACSIM_ROOT_PATH_ARG=/isaac-sim --build-arg ISAACLAB_PATH_ARG=/workspace/isaaclab --build-arg DOCKER_USER_HOME_ARG=/root -f docker/Dockerfile.base . ;
45-
docker run --rm --entrypoint bash --gpus all --network=host --name isaac-lab-test isaac-lab-dev ./isaaclab.sh -t &&
46-
exit $?"
67+
- |
68+
ssh ubuntu@$EC2_INSTANCE_IP "
69+
cd $SRC_DIR
70+
DOCKER_BUILDKIT=1 docker build -t isaac-lab-dev \
71+
--build-arg ISAACSIM_BASE_IMAGE_ARG=$ISAACSIM_BASE_IMAGE \
72+
--build-arg ISAACSIM_VERSION_ARG=4.2.0 \
73+
--build-arg ISAACSIM_ROOT_PATH_ARG=/isaac-sim \
74+
--build-arg ISAACLAB_PATH_ARG=/workspace/isaaclab \
75+
--build-arg DOCKER_USER_HOME_ARG=/root \
76+
-f docker/Dockerfile.base .
77+
docker run --rm --entrypoint bash --gpus all --network=host \
78+
--name isaac-lab-test isaac-lab-dev ./isaaclab.sh -t && exit \$?
79+
"
80+
4781
post_build:
4882
commands:
4983
- echo "Terminating EC2 instance"

docker/.env.base

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
# Accept the NVIDIA Omniverse EULA by default
66
ACCEPT_EULA=Y
7+
# NVIDIA Isaac Sim base image
8+
ISAACSIM_BASE_IMAGE=nvcr.io/nvidia/isaac-sim
79
# NVIDIA Isaac Sim version to use (e.g. 4.2.0)
810
ISAACSIM_VERSION=4.2.0
911
# Derived from the default path in the NVIDIA provided Isaac Sim container

docker/Dockerfile.base

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
# Please check above link for license information.
88

99
# Base image
10+
ARG ISAACSIM_BASE_IMAGE_ARG
1011
ARG ISAACSIM_VERSION_ARG
11-
FROM nvcr.io/nvidia/isaac-sim:${ISAACSIM_VERSION_ARG} AS base
12+
FROM ${ISAACSIM_BASE_IMAGE_ARG}:${ISAACSIM_VERSION_ARG} AS base
1213
ENV ISAACSIM_VERSION=${ISAACSIM_VERSION_ARG}
1314

1415
# Set default RUN shell to bash

docker/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ services:
7979
context: ../
8080
dockerfile: docker/Dockerfile.base
8181
args:
82+
- ISAACSIM_BASE_IMAGE_ARG=${ISAACSIM_BASE_IMAGE}
8283
- ISAACSIM_VERSION_ARG=${ISAACSIM_VERSION}
8384
- ISAACSIM_ROOT_PATH_ARG=${DOCKER_ISAACSIM_ROOT_PATH}
8485
- ISAACLAB_PATH_ARG=${DOCKER_ISAACLAB_PATH}
547 KB
Loading

docs/source/api/lab/omni.isaac.lab.sim.spawners.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
sensors
1414
from_files
1515
materials
16+
wrappers
1617

1718
.. rubric:: Classes
1819

@@ -302,3 +303,27 @@ Physical Materials
302303
.. autoclass:: DeformableBodyMaterialCfg
303304
:members:
304305
:exclude-members: __init__, func
306+
307+
Wrappers
308+
--------
309+
310+
.. automodule:: omni.isaac.lab.sim.spawners.wrappers
311+
312+
.. rubric:: Classes
313+
314+
.. autosummary::
315+
316+
MultiAssetSpawnerCfg
317+
MultiUsdFileCfg
318+
319+
.. autofunction:: spawn_multi_asset
320+
321+
.. autoclass:: MultiAssetSpawnerCfg
322+
:members:
323+
:exclude-members: __init__, func
324+
325+
.. autofunction:: spawn_multi_usd_file
326+
327+
.. autoclass:: MultiUsdFileCfg
328+
:members:
329+
:exclude-members: __init__, func

docs/source/how-to/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ a fixed base robot. This guide goes over the various considerations and steps to
3636

3737
make_fixed_prim
3838

39+
Spawning Multiple Assets
40+
------------------------
41+
42+
This guide explains how to import and configure different assets in each environment. This is
43+
useful when you want to create diverse environments with different objects.
44+
45+
.. toctree::
46+
:maxdepth: 1
47+
48+
multi_asset_spawning
49+
3950
Saving Camera Output
4051
--------------------
4152

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
Spawning Multiple Assets
2+
========================
3+
4+
.. currentmodule:: omni.isaac.lab
5+
6+
Typical, spawning configurations (introduced in the :ref:`tutorial-spawn-prims` tutorial) copy the same
7+
asset (or USD primitive) across the different resolved prim paths from the expressions.
8+
For instance, if the user specifies to spawn the asset at "/World/Table\_.*/Object", the same
9+
asset is created at the paths "/World/Table_0/Object", "/World/Table_1/Object" and so on.
10+
11+
However, at times, it might be desirable to spawn different assets under the prim paths to
12+
ensure a diversity in the simulation. This guide describes how to create different assets under
13+
each prim path using the spawning functionality.
14+
15+
The sample script ``multi_asset.py`` is used as a reference, located in the
16+
``IsaacLab/source/standalone/demos`` directory.
17+
18+
.. dropdown:: Code for multi_asset.py
19+
:icon: code
20+
21+
.. literalinclude:: ../../../source/standalone/demos/multi_asset.py
22+
:language: python
23+
:emphasize-lines: 101-123, 130-149
24+
:linenos:
25+
26+
This script creates multiple environments, where each environment has a rigid object that is either a cone,
27+
a cube, or a sphere, and an articulation that is either the ANYmal-C or ANYmal-D robot.
28+
29+
.. image:: ../_static/demos/multi_asset.jpg
30+
:width: 100%
31+
:alt: result of multi_asset.py
32+
33+
Using Multi-Asset Spawning Functions
34+
------------------------------------
35+
36+
It is possible to spawn different assets and USDs in each environment using the spawners
37+
:class:`~sim.spawners.wrappers.MultiAssetSpawnerCfg` and :class:`~sim.spawners.wrappers.MultiUsdFileCfg`:
38+
39+
* We set the spawn configuration in :class:`~assets.RigidObjectCfg` to be
40+
:class:`~sim.spawners.wrappers.MultiAssetSpawnerCfg`:
41+
42+
.. literalinclude:: ../../../source/standalone/demos/multi_asset.py
43+
:language: python
44+
:lines: 99-125
45+
:dedent:
46+
47+
This function allows you to define a list of different assets that can be spawned as rigid objects.
48+
When :attr:`~sim.spawners.wrappers.MultiAssetSpawnerCfg.random_choice` is set to True, one asset from the list
49+
is randomly selected and spawned at the specified prim path.
50+
51+
* Similarly, we set the spawn configuration in :class:`~assets.ArticulationCfg` to be
52+
:class:`~sim.spawners.wrappers.MultiUsdFileCfg`:
53+
54+
.. literalinclude:: ../../../source/standalone/demos/multi_asset.py
55+
:language: python
56+
:lines: 128-161
57+
:dedent:
58+
59+
Similar to before, this configuration allows the selection of different USD files representing articulated assets.
60+
61+
62+
Things to Note
63+
--------------
64+
65+
Similar asset structuring
66+
~~~~~~~~~~~~~~~~~~~~~~~~~
67+
68+
While spawning and handling multiple assets using the same physics interface (the rigid object or articulation classes),
69+
it is essential to have the assets at all the prim locations follow a similar structure. In case of an articulation,
70+
this means that they all must have the same number of links and joints, the same number of collision bodies and
71+
the same names for them. If that is not the case, the physics parsing of the prims can get affected and fail.
72+
73+
The main purpose of this functionality is to enable the user to create randomized versions of the same asset,
74+
for example robots with different link lengths, or rigid objects with different collider shapes.
75+
76+
Disabling physics replication in interactive scene
77+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78+
79+
By default, the flag :attr:`scene.InteractiveScene.replicate_physics` is set to True. This flag informs the physics
80+
engine that the simulation environments are copies of one another so it just needs to parse the first environment
81+
to understand the entire simulation scene. This helps speed up the simulation scene parsing.
82+
83+
However, in the case of spawning different assets in different environments, this assumption does not hold
84+
anymore. Hence the flag :attr:`scene.InteractiveScene.replicate_physics` must be disabled.
85+
86+
.. literalinclude:: ../../../source/standalone/demos/multi_asset.py
87+
:language: python
88+
:lines: 221-224
89+
:dedent:
90+
91+
The Code Execution
92+
------------------
93+
94+
To execute the script with multiple environments and randomized assets, use the following command:
95+
96+
.. code-block:: bash
97+
98+
./isaaclab.sh -p source/standalone/demos/multi_asset.py --num_envs 2048
99+
100+
This command runs the simulation with 2048 environments, each with randomly selected assets.
101+
To stop the simulation, you can close the window, or press ``Ctrl+C`` in the terminal.

0 commit comments

Comments
 (0)