Skip to content

Supports vectorized environments for pick and place demo - #3996

Merged
kellyguo11 merged 2 commits into
isaac-sim:mainfrom
kellyguo11:fix/vectorize-pickandplace
Dec 11, 2025
Merged

kellyguo11 merged 2 commits into
isaac-sim:mainfrom
kellyguo11:fix/vectorize-pickandplace

Conversation

@kellyguo11

Copy link
Copy Markdown
Contributor

Description

Adds support for vectorizing the pick and place demo to test performance for multi-environments.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@kellyguo11
kellyguo11 requested a review from ooctipus as a code owner November 11, 2025 01:00
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Nov 11, 2025
@kellyguo11 kellyguo11 moved this to In review in Isaac Lab Nov 11, 2025
@greptile-apps

greptile-apps Bot commented Nov 11, 2025 •

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR successfully vectorizes the pick-and-place demo to support multiple environments simultaneously. The implementation converts scalar control flags to per-environment boolean tensors, updates keyboard event handlers to broadcast commands to all environments, and properly indexes tensors for selective environment updates.

Key changes:

  • Adds --num_envs CLI argument (default: 32) for configuring environment count
  • Converts go_to_cube and go_to_target from single booleans to per-environment boolean tensors
  • Updates _apply_action() to use if statements (not elif) for independent processing of cube/target tracking modes
  • Implements tensor masking (self.go_to_cube, self.go_to_target) to selectively update only relevant environments
  • Fixes gripper command shape by removing unnecessary unsqueeze(dim=1)
  • Adds simulation config parameters (use_fabric=True, enable_scene_query_support=True) required for multi-environment surface grippers

The previous comment correctly identified the elif → if issue which has been resolved.

Confidence Score: 4/5

  • Safe to merge with minor validation recommended - vectorization logic is sound
  • The implementation correctly handles tensor operations for vectorized environments. The elif → if fix ensures independent processing of control modes. Tensor indexing with boolean masks is properly implemented. Minor concern: no runtime testing mentioned in checklist, though code structure appears correct.
  • No files require special attention - the single file changed has straightforward vectorization updates

Important Files Changed

File Analysis

Filename Score Overview
scripts/demos/pick_and_place.py 4/5 Adds vectorized environment support with proper tensor indexing and if statements (was elif) for independent environment control

Sequence Diagram

sequenceDiagram
    participant User
    participant KeyboardHandler
    participant PickAndPlaceEnv
    participant Robot[N]
    participant Cube[N]
    participant Gripper[N]
    
    User->>KeyboardHandler: Press key (A/D/W/S/Q/E)
    KeyboardHandler->>PickAndPlaceEnv: _on_keyboard_event()
    PickAndPlaceEnv->>PickAndPlaceEnv: Update control flags for ALL envs<br/>(go_to_cube[:] or go_to_target[:])
    
    loop Simulation Step
        PickAndPlaceEnv->>PickAndPlaceEnv: _apply_action()
        
        alt go_to_cube.any()
            PickAndPlaceEnv->>Robot[N]: Get head positions [go_to_cube]
            PickAndPlaceEnv->>Cube[N]: Get cube positions [go_to_cube]
            PickAndPlaceEnv->>PickAndPlaceEnv: Calculate proportional control<br/>for selected envs
            PickAndPlaceEnv->>PickAndPlaceEnv: instant_controls[go_to_cube] = ...
        end
        
        alt go_to_target.any()
            PickAndPlaceEnv->>Robot[N]: Get head positions [go_to_target]
            PickAndPlaceEnv->>PickAndPlaceEnv: Calculate proportional control<br/>for selected envs
            PickAndPlaceEnv->>PickAndPlaceEnv: instant_controls[go_to_target] = ...
        end
        
        PickAndPlaceEnv->>Robot[N]: set_joint_effort_target(x, y, z)<br/>for ALL envs
        PickAndPlaceEnv->>Gripper[N]: set_grippers_command()<br/>for ALL envs
    end
Loading

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread scripts/demos/pick_and_place.py Resolved

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@ooctipus ooctipus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

dt=1 / 60,
device="cpu",
render_interval=decimation,
use_fabric=True,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe false?

@kellyguo11 kellyguo11 moved this from In review to Ready in Isaac Lab Nov 26, 2025
@kellyguo11 kellyguo11 moved this from Ready to Backlog in Isaac Lab Nov 26, 2025
@kellyguo11 kellyguo11 moved this from Backlog to In progress in Isaac Lab Dec 11, 2025
@kellyguo11 kellyguo11 moved this from In progress to In review in Isaac Lab Dec 11, 2025
@kellyguo11
kellyguo11 merged commit f915491 into isaac-sim:main Dec 11, 2025
@github-project-automation github-project-automation Bot moved this from In review to Done in Isaac Lab Dec 11, 2025
T-K-233 pushed a commit to ucb-bar/IsaacLab that referenced this pull request Dec 29, 2025
)

# Description

Adds support for vectorizing the pick and place demo to test performance
for multi-environments.

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
Edify0991 pushed a commit to Edify0991/IsaacLab that referenced this pull request Jan 14, 2026
)

# Description

Adds support for vectorizing the pick and place demo to test performance
for multi-environments.

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
nitesh-subedi pushed a commit to nitesh-subedi/IsaacLab that referenced this pull request Feb 5, 2026
)

# Description

Adds support for vectorizing the pick and place demo to test performance
for multi-environments.

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
csj-275 pushed a commit to csj-275/IsaacLab that referenced this pull request Jul 8, 2026
)

# Description

Adds support for vectorizing the pick and place demo to test performance
for multi-environments.

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants