Skip to content

Conversation

@kellyguo11
Copy link
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
Copy link
Contributor

greptile-apps bot commented Nov 11, 2025

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 elifif 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 elifif 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

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

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

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

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

Copy link
Collaborator

@ooctipus ooctipus left a comment

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
Collaborator

Choose a reason for hiding this comment

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

maybe false?

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: In review

Development

Successfully merging this pull request may close these issues.

2 participants