Skip to content

Improve XLEVR_PATH by using automatic detection instead of hardcoded paths#6

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/improve-xlevr-path-settings
Draft

Improve XLEVR_PATH by using automatic detection instead of hardcoded paths#6
Copilot wants to merge 2 commits into
mainfrom
copilot/improve-xlevr-path-settings

Conversation

Copy link
Copy Markdown

Copilot AI commented Oct 8, 2025

Problem

The XLEVR_PATH variable was hardcoded to /home/vec/lerobot/new/XLeVR in both vr_monitor.py files, making the code non-portable across different systems and requiring manual editing for each user:

# Before: Hardcoded path specific to one developer's system
XLEVR_PATH = "/home/vec/lerobot/new/XLeVR"

This caused issues when:

  • Cloning the repository to a different location
  • Running on different user accounts or systems
  • Sharing code with collaborators

Solution

Implemented automatic path detection with environment variable override support:

XLeVR/vr_monitor.py

# Now automatically detects the script's directory
XLEVR_PATH = os.environ.get('XLEVR_PATH', str(Path(__file__).parent.resolve()))

simulation/Maniskill/examples/vr_monitor.py

# Calculates path relative to repository root (3 levels up)
_script_dir = Path(__file__).parent.resolve()
_default_xlevr_path = _script_dir.parent.parent.parent / "XLeVR"
XLEVR_PATH = os.environ.get('XLEVR_PATH', str(_default_xlevr_path))

Additional Improvements

  • Updated error messages from "Please update XLEVR_PATH in the script" to "Please set the XLEVR_PATH environment variable to the correct path"
  • Fixed comment typo: changed "检查telegrip路径" to "检查XLeVR路径"

Benefits

  • Zero configuration: Scripts work out-of-the-box in any repository clone
  • Portable: Works across different systems, directories, and user accounts
  • Flexible: Environment variable allows easy override for custom setups
  • Maintainable: No hardcoded paths to update when moving the repository

Usage

Default behavior (automatic detection)

cd XLeRobot/XLeVR
python3 vr_monitor.py
# Automatically detects and uses the correct XLeVR path

Custom path override

export XLEVR_PATH=/custom/xlevr/path
python3 vr_monitor.py
# Uses the custom path

Testing

All changes have been verified:

  • ✅ Python syntax validation passes
  • ✅ Automatic path detection works correctly for both scripts
  • ✅ Environment variable override functions properly
  • ✅ Scripts run and correctly identify paths (tested with missing dependencies)

Files Changed

  • XLeVR/vr_monitor.py (3 lines modified)
  • simulation/Maniskill/examples/vr_monitor.py (7 lines modified)

No migration action required from users - changes are fully backward compatible!

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve XLEVR_PATH by avoiding manual setting in the code</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #5

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…port

Co-authored-by: tc-huang <137322177+tc-huang@users.noreply.github.com>
Copilot AI changed the title [WIP] Update XLEVR_PATH to automate settings configuration Improve XLEVR_PATH by using automatic detection instead of hardcoded paths Oct 8, 2025
Copilot AI requested a review from tc-huang October 8, 2025 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve XLEVR_PATH by avoiding manual setting in the code

2 participants