-
Notifications
You must be signed in to change notification settings - Fork 20
feat(gen_sim): add Scene Engine and Gradio workspace #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
XuanchaoPENG
wants to merge
52
commits into
main
Choose a base branch
from
xuanchao/gradio
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
61001a7
Add a new feature: gen_sim/scene_engine
MuziWong ad708e8
Using vhacd by default in the simulation environment
MuziWong b664562
RAN black
MuziWong fe6c1af
style(geometry-generation): fix CI formatting
MuziWong 4c0cfc7
Updated geometry generation client
MuziWong a67ac77
Modified the gym export to scene export
MuziWong c630f16
Make the 2D AABB optimization more robust
MuziWong 8ae888d
Add optional --config in cli
MuziWong c38c0fc
Register scene-engine and preview-scene in embodichain.__main__.COMMANDS
MuziWong b86c3b5
Fixed with the suggestion from Copilot
MuziWong c99182c
Added __init__.py and ran black.
MuziWong e7f3fbe
Merge branch 'main' of github.com:DexForce/EmbodiChain into muzi/feat…
XuanchaoPENG 79442f5
Fix import bug
MuziWong a0f6797
Add Viser support
XuanchaoPENG db438e7
Merge branch 'muzi/feat_scene_engine' of github.com:DexForce/EmbodiCh…
XuanchaoPENG d1b363a
test(scene_engine): add unit coverage
MuziWong 23947e5
Add test for the newly-modified scene-preview
MuziWong b0774a4
docs(scene_engine): add usage documentation
MuziWong ede8172
Change logger
MuziWong 73e285e
Correct the table id verification comment, make it more clear
MuziWong 244ab1b
Delete a bad comment line in scene_segmentation_utils.py
MuziWong 930af9b
Align the doc with the scene_engine_config
MuziWong 05f8a1a
Align the scene_engine config setup with the simready_pipeline
MuziWong d0d39ca
fix(scene_engine): validate geometry output object IDs
MuziWong 114734d
fix(scene_engine): restrict preview mesh paths
MuziWong b61ef2f
Add Gradio UI with managed Viser previews
XuanchaoPENG 693e1eb
add conda support
XuanchaoPENG ab2ad30
add scene engine
XuanchaoPENG 93096a5
add .env
XuanchaoPENG 93abb7a
add clean process
XuanchaoPENG a6a3219
Changed support region detection algo + Changed the 2d-aabbs-optimiza…
MuziWong 3b1abc2
Reformatted the gravity settlement
MuziWong dd66de8
Reformatted assets group table aligner + Reformatted simready tools
MuziWong e4bc9e3
add env config
XuanchaoPENG bbf2a06
Modified the scene segmentation: 1. Bold the asset outline 2. Avoid t…
MuziWong c45be97
Reformatted the scene export
MuziWong fbe72ee
add reset
XuanchaoPENG c3f672d
Merge branch 'muzi/feat_scene_engine' into xuanchao/gradio
XuanchaoPENG 2436a37
Update the datastructure + Reformatted the pipeline
MuziWong 5eb9134
Read .env for now
MuziWong 2c9477d
Deleted all docs and all tests
MuziWong 2d64a80
Deleted json config in setup.py
MuziWong f51bc5d
Merge remote-tracking branch 'origin/main' into muzi/feat_scene_engin…
MuziWong 82acb65
Added md + rst in docs/
MuziWong 8979f68
Modified help, description and epilog
MuziWong 4f4102b
Added test files
MuziWong d710331
Added extra dependencies in gen_sim: scene_engine + Added CI
MuziWong 4347d6e
Merge remote-tracking branch 'origin/muzi/feat_scene_engine' into xua…
XuanchaoPENG 44539f3
fix bug
XuanchaoPENG 9b0c5eb
run black
XuanchaoPENG 3ef309e
Merge branch 'main' into xuanchao/gradio
XuanchaoPENG 3e3c50b
add log
XuanchaoPENG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Shared GenSim configuration | ||
| # Copy this file to .env and set deployment-specific values. Values exported | ||
| # by the shell, container, or CI environment take precedence over this file. | ||
|
|
||
| # Common OpenAI-compatible LLM endpoint used by Scene Engine. | ||
| OPENAI_API_KEY="" | ||
| OPENAI_MODEL="" | ||
| OPENAI_BASE_URL="" | ||
| SCENE_ENGINE_OPENAI_DEFAULT_QUERY="{}" | ||
| OPENAI_MAX_ATTEMPTS=3 | ||
|
|
||
| # Scene Engine services. | ||
| SCENE_ENGINE_IMAGE_SEGMENTATION_BASE_URL="" | ||
| SCENE_ENGINE_IMAGE_SEGMENTATION_TIMEOUT_S=30 | ||
| SCENE_ENGINE_IMAGE_SEGMENTATION_MAX_ATTEMPTS=3 | ||
| SCENE_ENGINE_IMAGE_SEGMENTATION_HEALTH_PATH="/health" | ||
| SCENE_ENGINE_IMAGE_SEGMENTATION_SINGLE_OBJECT_PATH="/predict" | ||
| SCENE_ENGINE_GEOMETRY_GENERATION_BASE_URL="" | ||
| SCENE_ENGINE_GEOMETRY_GENERATION_TIMEOUT_S=600 | ||
| SCENE_ENGINE_GEOMETRY_GENERATION_MAX_ATTEMPTS=3 | ||
| SCENE_ENGINE_GEOMETRY_GENERATION_HEALTH_PATH="/health" | ||
| SCENE_ENGINE_GEOMETRY_GENERATION_OBJECTS_PATH="/generate_multiple_objects" | ||
|
|
||
| # Gradio application and local workbench settings. The EmbodiChain repository | ||
| # root is derived automatically from the installed source tree. | ||
| GRADIO_SERVER_NAME="0.0.0.0" | ||
| GRADIO_SERVER_PORT=7860 | ||
| SCENE_ENGINE_VISER_PORT=8080 | ||
| ARTICRAFT_VISER_PORT=8081 | ||
| ARTICRAFT_ROOT="" | ||
| ARTICRAFT_REPOSITORY_URL="https://github.com/mattzh72/articraft.git" | ||
| ARTICRAFT_CONDA_ENV="articraft" | ||
| ARTICRAFT_OUTPUT_ROOT="" | ||
|
|
||
| # Optional SimReady endpoint. These values are mapped to OPENAI_* only for | ||
| # SimReady subprocesses, leaving Scene Engine settings unchanged. | ||
| SIMREADY_OPENAI_API_KEY="" | ||
| SIMREADY_OPENAI_MODEL="" | ||
| SIMREADY_OPENAI_BASE_URL="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # ---------------------------------------------------------------------------- | ||
| # Copyright (c) 2021-2026 DexForce Technology Co., Ltd. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # ---------------------------------------------------------------------------- | ||
|
|
||
| """Load the shared GenSim environment configuration.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| from pathlib import Path | ||
| from typing import MutableMapping | ||
|
|
||
| __all__ = ["find_gen_sim_env_file", "get_embodichain_root", "load_gen_sim_env"] | ||
|
|
||
|
|
||
| def get_embodichain_root() -> Path: | ||
| """Return the repository containing the installed GenSim source tree. | ||
|
|
||
| The Gradio app always launches its local tools from this directory. It is | ||
| derived from this module instead of a machine-specific dotenv value, so a | ||
| checkout continues to work after it is moved or cloned elsewhere. | ||
| """ | ||
| return Path(__file__).resolve().parents[2] | ||
|
|
||
|
|
||
| def find_gen_sim_env_file() -> Path: | ||
| """Return the configured shared ``.env`` file path. | ||
|
|
||
| ``EMBODICHAIN_ENV_FILE`` is useful for deployments that keep secrets outside | ||
| the source tree. Otherwise GenSim uses ``embodichain/gen_sim/.env``. The | ||
| repository-root ``.env`` remains a backward-compatible fallback. | ||
| """ | ||
| configured_path = os.environ.get("EMBODICHAIN_ENV_FILE") | ||
| if configured_path: | ||
| return Path(configured_path).expanduser().resolve() | ||
| default_path = Path(__file__).resolve().parent / ".env" | ||
| if default_path.is_file(): | ||
| return default_path | ||
|
|
||
|
|
||
| def load_gen_sim_env(env: MutableMapping[str, str] | None = None) -> Path | None: | ||
| """Load missing variables from the shared GenSim ``.env`` file. | ||
|
|
||
| Existing process environment variables are never overwritten so container, | ||
| CI, and shell-provided settings retain precedence over the local file. | ||
|
|
||
| Args: | ||
| env: Environment mapping to populate. Defaults to :data:`os.environ`. | ||
|
|
||
| Returns: | ||
| The loaded path, or ``None`` when no local ``.env`` file exists. | ||
|
|
||
| Raises: | ||
| ValueError: If the file contains an invalid ``KEY=VALUE`` entry. | ||
| """ | ||
| target_env = os.environ if env is None else env | ||
| env_path = find_gen_sim_env_file() | ||
| if not env_path.is_file(): | ||
| return None | ||
|
|
||
| for line_number, raw_line in enumerate( | ||
| env_path.read_text(encoding="utf-8").splitlines(), start=1 | ||
| ): | ||
| parsed = _parse_env_line(raw_line) | ||
| if parsed is None: | ||
| continue | ||
| key, value = parsed | ||
| if not key.isidentifier(): | ||
| raise ValueError( | ||
| f"Invalid environment variable name at {env_path}:{line_number}: {key!r}" | ||
| ) | ||
| target_env.setdefault(key, value) | ||
| return env_path | ||
|
|
||
|
|
||
| def _parse_env_line(line: str) -> tuple[str, str] | None: | ||
| """Parse one conventional dotenv line without requiring a third-party package.""" | ||
| stripped = line.strip() | ||
| if not stripped or stripped.startswith("#"): | ||
| return None | ||
| if stripped.startswith("export "): | ||
| stripped = stripped.removeprefix("export ").lstrip() | ||
| if "=" not in stripped: | ||
| raise ValueError(f"Expected KEY=VALUE entry, got: {line!r}") | ||
|
|
||
| key, value = stripped.split("=", maxsplit=1) | ||
| key = key.strip() | ||
| value = value.strip() | ||
| if len(value) >= 2 and value[0] == value[-1] and value[0] in {"'", '"'}: | ||
| value = value[1:-1] | ||
| elif " #" in value: | ||
| value = value.split(" #", maxsplit=1)[0].rstrip() | ||
| return key, value | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When neither
EMBODICHAIN_ENV_FILEnor the optional local.envexists,find_gen_sim_env_file()returnsNoneand the loader calls.is_file()on it, causing the Gradio workspace to fail during import with anAttributeError.Prompt To Fix With AI