-
Notifications
You must be signed in to change notification settings - Fork 152
ManiSkill Integration #446
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
lola831
wants to merge
8
commits into
main
Choose a base branch
from
ManiSkill
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 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7c8d779
ManiSkill Scenic Integration (#400)
Maciej4 615eb74
Fix ManiSkill docs build and extras install (#432)
lola831 7b10805
Merge main and resolve conflicts
lola831 81b485a
Add ManiSkill simulator docs section
lola831 d223090
Support ManiSkill scenes without robots
lola831 c5ef2f6
Avoid crash when closing ManiSkill viewer
lola831 ccee9b9
Use degree literals in ManiSkill example
lola831 c96d94e
improve ManiSkill macOS docs and make shader pack configurable
lola831 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # ManiSkill Examples | ||
|
|
||
| This directory contains example scenarios for the [ManiSkill](https://github.com/haosulab/ManiSkill) robotics simulator. |
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,31 @@ | ||
| model scenic.simulators.maniskill.model | ||
|
|
||
| import math | ||
| pi = math.pi | ||
|
|
||
| # Create ground plane | ||
| ground = new Ground with position (0, 0, -0.920) | ||
|
|
||
| # Create Panda robot arm with a neutral pose | ||
| # Joint angles: [joint1, joint2, joint3, joint4, joint5, joint6, joint7, gripper_left, gripper_right] | ||
| panda = new Robot, | ||
| with uuid "panda", | ||
| with jointAngles [0.0, pi/8, 0.0, -pi/2, 0.0, pi*5/8, pi/4, 0.04, 0.04] | ||
|
|
||
| # Create camera positioned to view the robot and cube | ||
| camera = new Camera, | ||
| at (-0.64, -0.4, 0.758), | ||
| with name "base_camera", | ||
| with img_width 640, | ||
| with img_height 480, | ||
| with fov 1.0 | ||
|
|
||
| # Create a cube in front of the robot (within reach) | ||
| cube = new ManiskillObject on ground, | ||
| at (0.4, 0.0, 0.035), | ||
| with name "target_cube", | ||
| with shape BoxShape(), | ||
| with width 0.05, | ||
| with length 0.05, | ||
| with height 0.05, | ||
| with color [1.0, 0.5, 0.0, 1.0] # Orange cube | ||
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,33 @@ | ||
| model scenic.simulators.maniskill.model | ||
|
|
||
| # Create ground plane | ||
| ground = new Ground with position (0, 0, -0.920) | ||
|
|
||
| # Create three cubes stacked on top of each other | ||
| # Bottom cube (red) | ||
| cube1 = new ManiskillObject on ground, | ||
| at (0, 0, 0.035), | ||
| with name "cube1", | ||
| with shape BoxShape(), | ||
| with width 0.07, | ||
| with length 0.07, | ||
| with height 0.07, | ||
| with color [0.9, 0.1, 0.1, 1.0] | ||
|
|
||
| # Middle cube (green) | ||
| cube2 = new ManiskillObject on cube1, | ||
| with name "cube2", | ||
| with shape BoxShape(), | ||
| with width 0.07, | ||
| with length 0.07, | ||
| with height 0.07, | ||
| with color [0.1, 0.9, 0.1, 1.0] | ||
|
|
||
| # Top cube (blue) | ||
| cube3 = new ManiskillObject on cube2, | ||
| with name "cube3", | ||
| with shape BoxShape(), | ||
| with width 0.07, | ||
| with length 0.07, | ||
| with height 0.07, | ||
| with color [0.1, 0.1, 0.9, 1.0] |
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
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,13 @@ | ||
| """ | ||
| Interface to the ManiSkill robotics simulator. | ||
| """ | ||
|
|
||
| # Check if mani_skill is installed and import ManiSkillSimulator only if it is | ||
| mani_skill = None | ||
| try: | ||
| import mani_skill | ||
| except ImportError: | ||
| pass | ||
| if mani_skill: | ||
| from .simulator import ManiSkillSimulator | ||
| del mani_skill |
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 @@ | ||
| """Scenic world model for robotic manipulation scenarios in ManiSkill. | ||
|
|
||
| Global Parameters: | ||
| render (bool): Whether to render the simulation in a window. If True, it will open | ||
| a window and display the simulation. If False (default), the simulation runs headless. | ||
| stride (int): Number of simulation steps between action updates. Default is 1. | ||
| """ | ||
|
|
||
| try: | ||
| from scenic.simulators.maniskill.simulator import ManiSkillSimulator | ||
| except ModuleNotFoundError: | ||
| # for convenience when testing without the mani_skill package | ||
| from scenic.core.simulators import SimulatorInterfaceWarning | ||
| import warnings | ||
| warnings.warn('The "mani-skill" package is not installed; ' | ||
| 'will not be able to run dynamic simulations', | ||
| SimulatorInterfaceWarning) | ||
|
|
||
| def ManiSkillSimulator(*args, **kwargs): | ||
| """Dummy simulator to allow compilation without the 'mani-skill' package. | ||
|
|
||
| :meta private: | ||
| """ | ||
| raise RuntimeError('the "mani-skill" package is required to run simulations ' | ||
| 'from this scenario') | ||
|
|
||
| param render = False | ||
| param stride = 1 | ||
|
|
||
| simulator ManiSkillSimulator( | ||
| render=bool(globalParameters.render), | ||
| stride=int(globalParameters.stride), | ||
| ) | ||
|
|
||
| class ManiskillObject(Object): | ||
| """Base class for ManiSkill objects. | ||
|
|
||
| Properties: | ||
| visualFilename (str or None): Path to a visual mesh file (e.g., .glb, .obj, .usdz). | ||
| visualScale (tuple): Scale factor for the visual mesh as (x, y, z). | ||
| visualOffset (tuple): Offset for the visual mesh as (x, y, z) to match visual and collision meshes. | ||
| kinematic (bool): If True, the object is kinematic (fixed in place). | ||
| """ | ||
| visualFilename: None | ||
| visualScale: (1, 1, 1) | ||
| visualOffset: (0, 0, 0) | ||
| width: 1 | ||
| length: 1 | ||
| height: 1 | ||
| color: [0.8, 0.8, 0.8, 1.0] | ||
| kinematic: False | ||
|
|
||
| class Ground(ManiskillObject): | ||
| """The default ground plane from ManiSkill. | ||
|
|
||
| This creates a large flat ground plane using ManiSkill's built-in ground builder. | ||
| The ground is always kinematic (fixed in place). | ||
| """ | ||
| name: "ground" | ||
| shape: BoxShape() | ||
| width: 100 | ||
| length: 100 | ||
| height: 0.001 | ||
| position: (0, 0, -0.0005) | ||
| kinematic: True | ||
| visualFilename: None | ||
| isSimpleGround: True # Specify to ManiSkill that this is the ground plane | ||
|
|
||
| class Robot(Object): | ||
| """Robot object (Panda arm by default). | ||
|
|
||
| This class represents a robot in the scene. The robot is not physically generated | ||
| in the scene (skipGeneration=True) but is used to configure the robot's initial state. | ||
|
|
||
| Properties: | ||
| uuid (str): Robot type identifier. Default is "panda" for the Franka Emika Panda arm. | ||
| jointAngles (list): Initial joint angles for the robot. If empty, uses a default configuration. | ||
| """ | ||
| position: (10, 0, 0) # Make scenic ignore it for collision checking for now | ||
| name: "actor" | ||
| uuid: "panda" | ||
| jointAngles: [] | ||
| skipGeneration: True # Don't generate this object in the scene | ||
|
|
||
| class Camera(OrientedPoint): | ||
| """Camera configuration for the scene. | ||
|
|
||
| Cameras are not physical objects but define viewpoints for rendering and observation. | ||
|
|
||
| Properties: | ||
| img_width (int): Image width in pixels. Default is 640. | ||
| img_height (int): Image height in pixels. Default is 480. | ||
| fov (float): Field of view in radians. Default is 1.0. | ||
| near (float): Near clipping plane distance. Default is 0.01. | ||
| far (float): Far clipping plane distance. Default is 100.0. | ||
| shader_pack (str): Shader pack to use for rendering. Default is "rt" (ray tracing). | ||
| """ | ||
| name: "camera" | ||
| img_width: 640 | ||
| img_height: 480 | ||
| fov: 1.0 | ||
| near: 0.01 | ||
| far: 100.0 | ||
| shader_pack: "rt" | ||
| skipGeneration: True # Don't generate this as a physical object |
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.
Uh oh!
There was an error while loading. Please reload this page.