repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
genesis-world | genesis/options/__init__.py | .py | from .misc import CoacdOptions, FoamOptions
from .profiling import ProfilingOptions
from .solvers import (
KinematicOptions,
BaseCouplerOptions,
FEMOptions,
IPCCouplerOptions,
LegacyCouplerOptions,
MPMOptions,
PBDOptions,
RigidOptions,
SAPCouplerOptions,
SFOptions,
SimOptions... | 40 | 791 |
genesis-world | genesis/options/vis.py | .py | from typing import TYPE_CHECKING, Annotated, Any, Literal, Mapping, Sequence, Union
from pydantic import StrictBool, StrictInt, Field, model_validator
import genesis as gs
from genesis.datatypes import List
from genesis.typing import IArrayType, PositiveFloat, PositiveInt, PositiveVec2IType, Vec3FType, UnitIntervalVec... | 212 | 10,060 |
genesis-world | genesis/options/profiling.py | .py | from pydantic import StrictBool
from .options import Options
class ProfilingOptions(Options):
"""
Profiling options
Parameters
----------
show_FPS : bool
Whether to show the frame rate each step. Default true
FPS_tracker_alpha: float
Exponential decay momentum for FPS moving ... | 20 | 405 |
genesis-world | genesis/options/recorders.py | .py | from typing import Annotated, Any
import av
from pydantic import BeforeValidator, Field, StrictBool
import genesis as gs
from genesis.typing import (
NonNegativeInt,
PathType,
PositiveFloat,
PositiveInt,
PositiveVec2IType,
StrArrayType,
Vec3FArrayType,
Vec3FType,
)
from .options impor... | 333 | 13,080 |
genesis-world | genesis/options/surfaces.py | .py | import math
from typing import Any, ClassVar, Literal
from typing_extensions import Self
import numpy as np
from pydantic import Field, StrictBool, model_validator
import genesis as gs
from genesis.typing import FArrayType, UnitInterval, ValidFloat
from genesis.utils import mesh as mu
from genesis.utils.misc import S... | 827 | 32,628 |
genesis-world | genesis/options/renderers.py | .py | from typing import TYPE_CHECKING, Annotated, Any, Literal, Mapping, Sequence
import numpy as np
from pydantic import Field, StrictBool, StrictInt, model_validator
import genesis as gs
from genesis.typing import PositiveFloat, UnitVec4FType, Vec3FType
from genesis.datatypes import List
from .options import Options
fr... | 155 | 5,158 |
genesis-world | genesis/options/sensors/options.py | .py | from typing import TYPE_CHECKING, Annotated, Any, Generic, NamedTuple, Sequence, TypeVar
import numpy as np
from pydantic import BeforeValidator, Field, StrictBool, StrictInt, field_validator
import genesis as gs
from genesis.typing import (
FArrayType,
Grid3DFloatType,
IArrayType,
LaxVec3FType,
N... | 669 | 30,823 |
genesis-world | genesis/options/sensors/raycaster.py | .py | import math
from dataclasses import dataclass
from typing import Sequence
import torch
import genesis as gs
from genesis.utils.geom import spherical_to_cartesian
@dataclass
class RaycastPattern:
"""
Base class for raycast patterns.
"""
def __init__(self):
self._return_shape: tuple[int, ...]... | 290 | 10,533 |
genesis-world | genesis/options/sensors/__init__.py | .py | from .camera import *
from .options import *
from .options import Raycaster as Lidar
from .raycaster import *
from .tactile import *
from .options import SensorOptions
class _SensorTypesNamespace:
"""Lazy mapping from sensor-options class names to opaque integer tags. Use the tag returned by
`gs.sensors.type... | 34 | 974 |
genesis-world | genesis/options/sensors/camera.py | .py | """
Camera sensor options for Rasterizer, Raytracer, and Batch Renderer backends.
"""
from typing import TYPE_CHECKING, Any, Literal
from pydantic import Field, StrictBool
import genesis as gs
from genesis.typing import (
Matrix4x4Type,
PositiveFloat,
PositiveInt,
PositiveVec2IType,
UnitVec4FType... | 153 | 5,519 |
genesis-world | genesis/options/sensors/tactile.py | .py | from typing import TYPE_CHECKING, Any, Literal
import numpy as np
from pydantic import Field, StrictBool
import genesis as gs
from genesis.typing import (
FArrayType,
FGridType,
IArrayType,
NonNegativeFloat,
NonNegativeInt,
PositiveFArrayType,
PositiveFloat,
PositiveInt,
PositiveVe... | 562 | 30,631 |
genesis-world | genesis/ext/_trimesh_patch.py | .py | import os
import re
import warnings
from collections import defaultdict, deque
import numpy as np
try:
# `pip install pillow`
# optional: used for textured meshes
from PIL import Image
except BaseException as E:
# if someone tries to use Image re-raise
# the import error so they can debug easily
... | 979 | 35,080 |
genesis-world | genesis/ext/pyrender/renderer.py | .py | """PBR renderer for Python.
Author: Matthew Matl
"""
import sys
import PIL
import pyglet
import numpy as np
from OpenGL.GL import *
from .constants import (
DEFAULT_Z_FAR,
DEFAULT_Z_NEAR,
GLTF,
MAX_N_LIGHTS,
SHADOW_TEX_SZ,
BufFlags,
ProgramFlags,
RenderFlags,
TexFlags,
TextAl... | 1,159 | 44,732 |
genesis-world | genesis/ext/pyrender/viewer.py | .py | """A pyglet-based interactive 3D scene viewer."""
import copy
import os
import shutil
import sys
import threading
import time
from contextlib import nullcontext
from threading import Event, RLock, Semaphore, Thread
from typing import TYPE_CHECKING, Optional
import numpy as np
import OpenGL
from OpenGL.GL import *
im... | 1,543 | 64,789 |
genesis-world | genesis/ext/pyrender/utils.py | .py | import numpy as np
from PIL import Image
def format_color_vector(value, length):
"""Format a color vector."""
if isinstance(value, int):
value = value / 255.0
if isinstance(value, float):
value = np.repeat(value, length)
if isinstance(value, list) or isinstance(value, tuple):
v... | 116 | 4,449 |
genesis-world | genesis/ext/pyrender/scene.py | .py | """Scenes, conforming to the glTF 2.0 standards as specified in
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene
Author: Matthew Matl
"""
import networkx as nx
import numpy as np
from .camera import Camera
from .light import DirectionalLight, Light, PointLight, SpotLight
from .mesh ... | 640 | 22,246 |
genesis-world | genesis/ext/pyrender/shader_program.py | .py | """OpenGL shader program wrapper."""
import numbers
import os
import re
import numpy as np
import OpenGL
from OpenGL.GL import *
from OpenGL.GL import shaders as gl_shader_utils
func = None
class ShaderProgramCache(object):
"""A cache for shader programs."""
def __init__(self, shader_dir=None):
s... | 277 | 9,623 |
genesis-world | genesis/ext/pyrender/__init__.py | .py | from .camera import Camera, PerspectiveCamera, OrthographicCamera, IntrinsicsCamera
from .light import Light, PointLight, DirectionalLight, SpotLight
from .sampler import Sampler
from .texture import Texture
from .material import Material, MetallicRoughnessMaterial
from .primitive import Primitive
from .mesh import Mes... | 41 | 985 |
genesis-world | genesis/ext/pyrender/constants.py | .py | DEFAULT_Z_NEAR = 0.05 # Near clipping plane, in meters
DEFAULT_Z_FAR = 100.0 # Far clipping plane, in meters
DEFAULT_SCENE_SCALE = 5.0 # Default scene scale
MAX_N_LIGHTS = 4 # Maximum number of lights of each type allowed
TARGET_OPEN_GL_MAJOR = 4 # Target OpenGL Major Version
TARGET_OPEN_GL_MINOR = 2 # Target Ope... | 171 | 4,970 |
genesis-world | genesis/ext/pyrender/mesh.py | .py | """Meshes, conforming to the glTF 2.0 standards as specified in
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-mesh
Author: Matthew Matl
"""
import copy
import numpy as np
import trimesh
from .constants import GLTF
from .material import MetallicRoughnessMaterial
from .primitive import ... | 318 | 12,167 |
genesis-world | genesis/ext/pyrender/offscreen.py | .py | """Wrapper for offscreen rendering.
Author: Matthew Matl
"""
import os
from OpenGL.GL import *
import genesis as gs
from .constants import RenderFlags
class OffscreenRenderer(object):
"""A wrapper for offscreen rendering.
Parameters
----------
viewport_width : int
The width of the main v... | 293 | 10,527 |
genesis-world | genesis/ext/pyrender/font.py | .py | """Font texture loader and processor.
Author: Matthew Matl
"""
import freetype
import numpy as np
import os
import OpenGL
from OpenGL.GL import *
from .constants import TextAlign, FLOAT_SZ
from .texture import Texture
from .sampler import Sampler
class FontCache(object):
"""A cache for fonts."""
def __in... | 298 | 9,284 |
genesis-world | genesis/ext/pyrender/texture.py | .py | """Textures, conforming to the glTF 2.0 standards as specified in
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-texture
Author: Matthew Matl
"""
import numpy as np
from OpenGL.GL import *
from OpenGL.GL.EXT import texture_filter_anisotropic
import genesis as gs
from .utils import for... | 346 | 10,761 |
genesis-world | genesis/ext/pyrender/primitive.py | .py | """Primitives, conforming to the glTF 2.0 standards as specified in
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-primitive
Author: Matthew Matl
"""
import numba as nb
import numpy as np
from OpenGL.GL import *
from .constants import FLOAT_SZ, GLTF, UINT_SZ, BufFlags
from .material imp... | 541 | 18,707 |
genesis-world | genesis/ext/pyrender/trackball.py | .py | """Trackball class for 3D manipulation of viewpoints."""
import numpy as np
import trimesh.transformations as transformations
EPSILON = np.finfo(np.float32).eps
class Trackball(object):
"""A trackball class for creating camera transforms from mouse movements."""
STATE_ROTATE = 0
STATE_PAN = 1
STA... | 257 | 8,853 |
genesis-world | genesis/ext/pyrender/camera.py | .py | """Virtual cameras compliant with the glTF 2.0 specification as described at
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-camera
Author: Matthew Matl
"""
import abc
import sys
from abc import ABCMeta
import numpy as np
from .constants import DEFAULT_Z_NEAR, DEFAULT_Z_FAR
class Came... | 392 | 10,884 |
genesis-world | genesis/ext/pyrender/material.py | .py | """Material properties, conforming to the glTF 2.0 standards as specified in
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-material
and
https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
Author: Matthew Matl
"""
from abc import AB... | 687 | 27,448 |
genesis-world | genesis/ext/pyrender/jit_render.py | .py | import contextlib
import os
import numpy as np
import numba as nb
import OpenGL.GL as GL
import OpenGL.constant as GL_constant
from .material import MetallicRoughnessMaterial, SpecularGlossinessMaterial
from .light import DirectionalLight, PointLight
from .constants import RenderFlags, MAX_N_LIGHTS
from .numba_gl_wr... | 1,189 | 53,681 |
genesis-world | genesis/ext/pyrender/sampler.py | .py | """Samplers, conforming to the glTF 2.0 standards as specified in
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-sampler
Author: Matthew Matl
"""
from .constants import GLTF
class Sampler(object):
"""Texture sampler properties for filtering and wrapping modes.
Parameters
-... | 94 | 2,552 |
genesis-world | genesis/ext/pyrender/light.py | .py | """Punctual light sources as defined by the glTF 2.0 KHR extension at
https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
Author: Matthew Matl
"""
import abc
from abc import ABCMeta
import numpy as np
from OpenGL.GL import *
from .utils import format_color_vector
from .textu... | 377 | 12,725 |
genesis-world | genesis/ext/pyrender/numba_gl_wrapper.py | .py | from numba import *
from numba import types
from numba.extending import (
models,
register_model,
make_attribute_wrapper,
typeof_impl,
as_numba_type,
unbox,
NativeValue,
)
from numba.core import cgutils
from contextlib import ExitStack
import OpenGL.GL as GL
from OpenGL._bytes import as_8_bi... | 147 | 5,927 |
genesis-world | genesis/ext/pyrender/node.py | .py | """Nodes, conforming to the glTF 2.0 standards as specified in
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-node
Author: Matthew Matl
"""
import numpy as np
import trimesh.transformations as transformations
from .camera import Camera
from .mesh import Mesh
from .light import Light
... | 256 | 7,190 |
genesis-world | genesis/ext/pyrender/overlay/types.py | .py | """Static joint/entity metadata containers and helpers used by the overlay panel."""
from typing import TYPE_CHECKING, NamedTuple
import numpy as np
import genesis as gs
if TYPE_CHECKING:
from genesis.engine.entities.rigid_entity import RigidEntity
QUATERNION_COMPONENT_LIMIT = 1.0
class EntityJointData(Name... | 97 | 3,495 |
genesis-world | genesis/ext/pyrender/overlay/__init__.py | .py | """ImGui overlay package. Re-exports :class:`ImGuiOverlayPlugin` so callers can keep importing
``from genesis.ext.pyrender.overlay import ImGuiOverlayPlugin``."""
from genesis.ext.pyrender.overlay.plugin import ImGuiOverlayPlugin
__all__ = ["ImGuiOverlayPlugin"]
| 7 | 265 |
genesis-world | genesis/ext/pyrender/overlay/style.py | .py | """ImGui style configuration for the Genesis overlay panel."""
def apply_dark_theme(imgui) -> None:
"""Apply the modern rounded dark theme used by the Genesis Control Panel."""
imgui.style_colors_dark()
style = imgui.get_style()
Col_ = imgui.Col_
sc = style.set_color_
# Geometry - modern roun... | 87 | 3,000 |
genesis-world | genesis/ext/pyrender/overlay/plugin.py | .py | """
ImGui overlay plugin for joint control and simulation controls.
Requires the ``render`` optional extras: ``pip install 'genesis-world[render]'``.
"""
import os
import time
from typing import TYPE_CHECKING, Any
import numpy as np
from scipy.spatial.transform import Rotation as R
import genesis as gs
import genes... | 1,327 | 63,953 |
genesis-world | genesis/ext/pyrender/platforms/egl.py | .py | import ctypes
import functools
import os
import OpenGL.platform
import genesis as gs
from .base import Platform
EGL_PLATFORM_DEVICE_EXT = 0x313F
EGL_DRM_DEVICE_FILE_EXT = 0x3233
_EGL_LOAD_ERROR = "EGL is required to create an offscreen OpenGL context, and it is unavailable on this system."
def _ensure_egl_loade... | 318 | 11,245 |
genesis-world | genesis/ext/pyrender/platforms/pyglet_platform.py | .py | from ..constants import TARGET_OPEN_GL_MAJOR, TARGET_OPEN_GL_MINOR, MIN_OPEN_GL_MAJOR, MIN_OPEN_GL_MINOR
from .base import Platform
import OpenGL
import pyglet
__all__ = ["PygletPlatform"]
class PygletPlatform(Platform):
"""Renders on-screen using a 1x1 hidden Pyglet window for getting
an OpenGL context.
... | 108 | 4,139 |
genesis-world | genesis/ext/pyrender/platforms/__init__.py | .py | """Platforms for generating offscreen OpenGL contexts for rendering.
Author: Matthew Matl
"""
from .base import Platform
| 7 | 123 |
genesis-world | genesis/ext/pyrender/platforms/osmesa.py | .py | from .base import Platform
__all__ = ["OSMesaPlatform"]
class OSMesaPlatform(Platform):
"""Renders into a software buffer using OSMesa. Requires special versions
of OSMesa to be installed, plus PyOpenGL upgrade.
"""
def __init__(self, viewport_width, viewport_height):
super().__init__(viewp... | 69 | 1,964 |
genesis-world | genesis/ext/pyrender/platforms/base.py | .py | import abc
from abc import ABCMeta
class Platform(metaclass=ABCMeta):
"""Base class for all OpenGL platforms.
Parameters
----------
viewport_width : int
The width of the main viewport, in pixels.
viewport_height : int
The height of the main viewport, in pixels
"""
def __i... | 79 | 2,355 |
genesis-world | genesis/ext/pyrender/platforms/cgl.py | .py | import ctypes
import functools
import OpenGL.contextdata
import OpenGL.platform
import pyglet
import genesis as gs
from .base import Platform
# CGL pixel format attributes and values, transliterated from the OpenGL framework headers, as PyOpenGL ships no CGL
# bindings.
CGL_PFA_DEPTH_SIZE = 12
CGL_PFA_ACCELERATED ... | 135 | 6,151 |
genesis-world | genesis/ext/isaacgym/terrain_utils.py | .py | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relat... | 403 | 16,659 |
genesis-world | genesis/ext/urdfpy/utils.py | .py | """Utilities for URDF parsing."""
import os
import xml.etree.ElementTree as ET
import trimesh
import numpy as np
import genesis as gs
def rpy_to_matrix(coords):
"""Convert roll-pitch-yaw coordinates to a 3x3 homogenous rotation matrix.
The roll-pitch-yaw axes in a typical URDF are defined as a
rotatio... | 304 | 9,228 |
genesis-world | genesis/ext/urdfpy/__init__.py | .py | from .urdf import (
URDFType,
Box,
Cylinder,
Capsule,
Sphere,
Mesh,
Geometry,
Texture,
Material,
Collision,
Visual,
Inertial,
JointCalibration,
JointDynamics,
JointLimit,
JointMimic,
SafetyController,
Actuator,
TransmissionJoint,
Transmissi... | 59 | 983 |
genesis-world | genesis/ext/urdfpy/urdf.py | .py | import copy
import os
import time
import xml.etree.ElementTree as ET
from collections import OrderedDict
from typing import List
import networkx as nx
import numpy as np
import PIL
import trimesh
from .utils import configure_origin, get_filename, load_meshes, parse_origin, unparse_origin
class URDFType(object):
... | 4,099 | 134,674 |
genesis-world | genesis/assets/meshes/bolt_nut/generate_bolt_nut.py | .py | """Procedurally generate a mating bolt + hex nut with ISO-metric-style threads.
The thread is built as a radial-displacement helical grid: at every (theta, z) the radius is a single-valued raised-
cosine function of the helical phase, so the resulting surface is watertight and star-shaped in every z-slice (caps are
si... | 163 | 6,781 |
genesis-world | genesis/assets/urdf/plane/generate_checker.py | .py | import numpy as np
from PIL import Image
size = 1024
half_size = int(size / 2)
img = np.zeros([size, size, 3]).astype(np.uint8)
img[:, :] = np.array([0.2, 0.3, 0.4]) * 255
img[:half_size, :half_size] = np.array([0.1, 0.2, 0.3]) * 255
img[half_size:, half_size:] = np.array([0.1, 0.2, 0.3]) * 255
img[:, :, :] = 16
hal... | 21 | 636 |
genesis-world | genesis/assets/tower/generate_tower.py | .py | #!/usr/bin/env python3
"""Generate stacking tower toy assets for physics simulation.
Produces for each piece: a visual GLB, a collision GLB, and a URDF.
- Visual meshes have angle-based smooth normals.
- Collision meshes are pre-decomposed into convex sub-meshes (no COACD needed).
- URDF files reference both visual an... | 425 | 14,463 |
genesis-world | tests/upload_benchmarks_table_to_wandb.py | .py | """
Upload benchmark results to Weights & Biases.
This script parses benchmark results files (memory or performance) generated
by monitor_test_mem.py or similar monitoring tools and uploads them to W&B.
Memory example:
env=franka | constraint_solver=None | gjk_collision=True | batch_size=30000 | backend=cuda | d... | 130 | 4,776 |
genesis-world | tests/monitor_test_mem.py | .py | import argparse
import os
import re
import time
from collections import defaultdict
import psutil
# This module is launched as a standalone script ('python tests/monitor_test_mem.py'), so its own directory is
# on sys.path and 'gpu_info' is imported as a top-level module rather than through the 'tests' package.
from ... | 145 | 4,720 |
genesis-world | tests/test_examples.py | .py | import os
import sys
import subprocess
from pathlib import Path
import pytest
EXAMPLES_DIR = Path(__file__).parents[1] / "examples"
ALLOW_PATTERNS = {
"collision/**/*.py",
"coupling/**/*.py",
"deformable/**/*.py",
"drone/interactive_drone.py",
"drone/fly_route.py",
"fluid/**/*.py",
"ipc/*... | 106 | 3,407 |
genesis-world | tests/gpu_info.py | .py | """Cross-vendor GPU information for the test infrastructure.
Each backend queries the GPUs through the vendor management library - NVIDIA Management Library (NVML) via
nvidia-ml-py for NVIDIA, AMD SMI (amdsmi) for AMD - rather than parsing command-line tools or reading the
driver proc/sysfs interface. The management l... | 181 | 7,929 |
genesis-world | tests/conftest.py | .py | import ctypes
import gc
import logging
import os
import shutil
import subprocess
import sys
import warnings
from argparse import SUPPRESS
from enum import Enum
from io import BytesIO
from pathlib import Path
import setproctitle
import psutil
import pyglet
import pytest
from _pytest.mark import Expression, MarkMatcher
... | 992 | 38,476 |
genesis-world | tests/sensors/test_api.py | .py | import importlib
import sys
import textwrap
import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
@pytest.mark.required
def test_lazy_sensor_discovery(show_viewer, tmp_path):
from genesis.en... | 766 | 32,545 |
genesis-world | tests/sensors/test_imu.py | .py | import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from ..utils.assertions import assert_allclose, assert_equal
@pytest.mark.required
@pytest.mark.parametrize("n_envs", [0, 2])
def test_sensor(show_viewer, tol, n_envs):
GRAVITY = -10.0
DT = 1e-2
BIAS = (0.... | 221 | 8,062 |
genesis-world | tests/sensors/test_camera.py | .py | import gc
import sys
import weakref
import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils.misc import tensor_to_array
from genesis.utils.geom import pos_lookat_up_to_T, trans_quat_to_T, trans_to_T
from ..conftest import SKIP_NO_LUISA, SKIP_NO_MADRONA
from ..utils.assertions import ass... | 718 | 22,691 |
genesis-world | tests/sensors/test_raycaster.py | .py | import textwrap
import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
@pytest.mark.required
# A raycast consumer refreshes the solver's forward kinematics before casting; under MuJoCo compatibil... | 951 | 39,648 |
genesis-world | tests/sensors/test_tactile.py | .py | import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from genesis.utils.misc import gaussian_crosstalk_kernel, tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
@pytest.mark.slow # ~200s
@pytest.mark.required
@pytest.mark.parametrize("n_envs"... | 1,815 | 71,665 |
genesis-world | tests/sensors/test_contact.py | .py | import numpy as np
import pytest
import genesis as gs
import genesis.utils.geom as gu
from ..utils.assertions import assert_allclose
@pytest.mark.slow # ~200s
@pytest.mark.required
@pytest.mark.parametrize("n_envs", [0, 2])
def test_gravity_force(n_envs, show_viewer, tol):
GRAVITY = -10.0
BIAS = (0.1, 0.2,... | 245 | 8,564 |
genesis-world | tests/sensors/test_temperature.py | .py | import pytest
import torch
import genesis as gs
from ..utils.assertions import assert_allclose, assert_equal
@pytest.mark.required
@pytest.mark.parametrize("n_envs", [0, 2])
def test_grid_sensor_contact_and_reset(show_viewer, tol, n_envs):
BOX_SIZE = 0.06
PLATFORM_SIZE = 0.2
FAR_POS = (PLATFORM_SIZE * 1... | 186 | 6,372 |
genesis-world | tests/sensors/test_joint_torque.py | .py | import xml.etree.ElementTree as ET
import numpy as np
import pytest
import torch
import genesis as gs
from ..utils.assertions import assert_allclose
@pytest.fixture(scope="session")
def joint_torque_pendulums():
# Four independent single-DOF pendulums (a point mass at distance 1 m from a hinge), one per gearbo... | 173 | 7,148 |
genesis-world | tests/grad/test_grad_tape.py | .py | import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
from .utils import make_diff_scene_pair
@pytest.mark.required
@pytest.mark.parametrize("model_name", ["grad_free", "grad_revolute", "grad_fre... | 123 | 4,441 |
genesis-world | tests/grad/utils.py | .py | from typing import NamedTuple
import numpy as np
import torch
import genesis as gs
from genesis.engine.entities import RigidEntity
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose
class DiffScenePair(NamedTuple):
scene_ana: "gs.Scene"
entity_ana: RigidEntity
... | 135 | 5,439 |
genesis-world | tests/grad/test_rigid_optim.py | .py | import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose
from .utils import make_diff_scene_pair
@pytest.mark.required
@pytest.mark.parametrize("backend", [gs.cpu, gs.gpu])
@pytest.mark.parametrize("control_targe... | 141 | 5,520 |
genesis-world | tests/grad/test_rigid_collision.py | .py | import xml.etree.ElementTree as ET
import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils import set_random_seed
from genesis.utils.geom import R_to_quat
from genesis.utils.misc import qd_to_numpy, qd_to_torch, tensor_to_array
from ..utils.assertions import assert_allclose
@pytest.ma... | 540 | 21,916 |
genesis-world | tests/grad/test_rigid_constraints.py | .py | import math
import numpy as np
import pytest
import genesis as gs
from genesis.utils.misc import qd_to_torch, tensor_to_array
from ..utils.assertions import assert_allclose
from .utils import assert_grad_matches_fd, make_diff_scene_pair
@pytest.mark.required
@pytest.mark.debug(False)
def test_joint_limit_grad_matc... | 260 | 9,389 |
genesis-world | tests/grad/test_rigid_dynamics.py | .py | import math
import numpy as np
import pytest
import genesis as gs
from .utils import assert_grad_matches_fd, make_diff_scene_pair
@pytest.mark.required
@pytest.mark.parametrize("backend", [gs.cpu, gs.gpu])
@pytest.mark.parametrize(
"model_name",
[
"grad_free",
"grad_revolute",
"grad... | 228 | 9,631 |
genesis-world | tests/grad/test_hybrid_push.py | .py | import pytest
import torch
import genesis as gs
@pytest.mark.slow # ~350s
@pytest.mark.required
@pytest.mark.debug(False)
def test_mpm_tool_push_grad(show_viewer):
HORIZON = 10
scene = gs.Scene(
sim_options=gs.options.SimOptions(
dt=2e-3,
substeps=10,
requires_gr... | 80 | 2,397 |
genesis-world | tests/grad/conftest.py | .py | import xml.etree.ElementTree as ET
import pytest
def _add_hinge_arm(parent, body_name, pos, axis="0 1 0", joint_pos=None, **joint_kwargs):
"""Add a 1-DOF hinge arm link (y-axis hinge by default, capsule geom, explicit inertia) and return its body
element."""
body = ET.SubElement(parent, "body", name=body... | 279 | 13,769 |
genesis-world | tests/coupling/test_hybrid.py | .py | import platform
import sys
import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose
from ..utils.assets import get_hf_dataset
@pytest.mark.slow # ~300s
@pytest.mark.required
def test_rigid_mpm_muscle(show_viewe... | 501 | 14,706 |
genesis-world | tests/coupling/test_sph_rigid.py | .py | import pytest
import genesis as gs
from genesis.utils.misc import qd_to_numpy
@pytest.mark.required
@pytest.mark.parametrize(
"n_envs, pressure_solver",
[
(0, "WCSPH"),
(0, "DFSPH"),
pytest.param(2, "WCSPH", marks=pytest.mark.slow), # ~150s
pytest.param(2, "DFSPH", marks=pyte... | 155 | 4,906 |
genesis-world | tests/particles/test_pbd.py | .py | import pytest
import numpy as np
import torch
import genesis as gs
from ..utils.assertions import assert_allclose
# Note that "session" scope must NOT be used because the material while be altered without copy when building the scene
@pytest.fixture(scope="function")
def pbd_material():
"""Fixture for common FE... | 268 | 8,657 |
genesis-world | tests/particles/test_sf.py | .py | import math
import numpy as np
import genesis as gs
def test_jets(show_viewer):
import quadrants as qd
res = 384
orbit_tau = 0.2
orbit_radius = 0.3
orbit_radius_vel = 0.0
jet_radius = 0.02
sub_orbit_radius = 0.03
sub_orbit_tau = 3.0
scene = gs.Scene(
sim_options=gs.op... | 113 | 3,468 |
genesis-world | tests/particles/test_sph.py | .py | # Tests for SPH simulation - initial density and pressure validation
#
# Background:
# SPH is sensitive to the initial particle distribution, as it directly determines the initial density and pressure fields.
# To ensure numerical stability, particles must be initialized using a regular sampler that enforces near-unifo... | 337 | 13,312 |
genesis-world | tests/particles/test_mpm.py | .py | import pytest
import torch
import genesis as gs
@pytest.mark.required
def test_particle_constraints(show_viewer):
scene = gs.Scene(
sim_options=gs.options.SimOptions(
dt=2e-3,
substeps=20,
),
mpm_options=gs.options.MPMOptions(
lower_bound=(-1.0, -1.0, 0... | 132 | 4,104 |
genesis-world | tests/parsers/test_mesh.py | .py | import io
import os
from contextlib import nullcontext
import numpy as np
import pygltflib
import pytest
import trimesh
from PIL import Image
import coacd
import genesis as gs
import genesis.utils.geom as gu
import genesis.utils.gltf as gltf_utils
import genesis.utils.mesh as mu
from ..utils.assertions import asser... | 916 | 33,746 |
genesis-world | tests/parsers/test_usd.py | .py | """
Test USD parsing and comparison with compared scenes.
This module tests that USD files can be parsed correctly and that scenes
loaded from USD files match equivalent scenes loaded from compared files.
"""
import os
import xml.etree.ElementTree as ET
import numpy as np
import pytest
try:
from pxr import Usd
... | 594 | 24,157 |
genesis-world | tests/parsers/conftest.py | .py | import io
import os
import xml.etree.ElementTree as ET
from functools import partial
import numpy as np
import pygltflib
import pytest
import trimesh
from PIL import Image
import genesis as gs
import genesis.utils.geom as gu
from genesis.utils.misc import get_assets_dir
from ..utils.assertions import assert_allclos... | 1,582 | 69,743 |
genesis-world | tests/integration/test_integration.py | .py | import numpy as np
import pytest
import genesis as gs
from ..utils.assertions import assert_allclose
from ..utils.assets import get_hf_dataset
@pytest.mark.slow("gpu") # gpu ~250s
@pytest.mark.parametrize("mode", [0, 1, 2])
@pytest.mark.parametrize("backend", [gs.cpu, gs.gpu])
def test_pick_and_place(mode, show_vi... | 325 | 10,625 |
genesis-world | tests/ipc/test_api.py | .py | from typing import TYPE_CHECKING, cast
import pytest
try:
import uipc
except ImportError:
pytest.skip("IPC Coupler is not supported because 'uipc' module is not available.", allow_module_level=True)
import genesis as gs
from genesis.engine.couplers.ipc_coupler.data import COUPLING_TYPE
from .utils import (... | 331 | 11,277 |
genesis-world | tests/ipc/utils.py | .py | import numpy as np
import pytest
try:
import uipc
except ImportError:
pytest.skip("IPC Coupler is not supported because 'uipc' module is not available.", allow_module_level=True)
from uipc.backend import SceneVisitor
from uipc.geometry import SimplicialComplexSlot, apply_transform, merge
def collect_ipc_geo... | 70 | 2,465 |
genesis-world | tests/ipc/test_deformable.py | .py | import math
from contextlib import nullcontext
from typing import TYPE_CHECKING, cast, Any
import numpy as np
import pytest
try:
import uipc
except ImportError:
pytest.skip("IPC Coupler is not supported because 'uipc' module is not available.", allow_module_level=True)
import genesis as gs
from genesis.util... | 419 | 15,814 |
genesis-world | tests/ipc/test_rigid.py | .py | import math
from itertools import permutations
from typing import TYPE_CHECKING, cast
import numpy as np
import pytest
try:
import uipc
except ImportError:
pytest.skip("IPC Coupler is not supported because 'uipc' module is not available.", allow_module_level=True)
from uipc import builtin
import genesis as ... | 880 | 30,758 |
genesis-world | tests/rigid/test_api.py | .py | from contextlib import nullcontext
from copy import deepcopy
import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from genesis.engine.states.solvers import RigidSolverState
from genesis.utils.misc import qd_to_numpy, qd_to_torch
from ..utils.assertions import assert_allc... | 1,103 | 48,397 |
genesis-world | tests/rigid/test_heterogeneous.py | .py | import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose
from ..utils.assets import get_hf_dataset
@pytest.mark.required
def test_physics_parity(show_viewer, tol):
# Uses the f... | 388 | 16,504 |
genesis-world | tests/rigid/test_collision_nonconvex.py | .py | import math
import sys
import matplotlib.pyplot as plt
import numpy as np
import pytest
import torch
import trimesh
import genesis as gs
import genesis.utils.geom as gu
from genesis.utils.misc import qd_to_numpy, tensor_to_array
from ..utils.assertions import assert_allclose
from ..utils.assets import get_hf_dataset... | 1,001 | 43,008 |
genesis-world | tests/rigid/test_control.py | .py | import numpy as np
import pytest
import torch
import genesis as gs
from genesis.utils.misc import qd_to_torch, tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
from ..utils.assets import get_hf_dataset
@pytest.mark.required
@pytest.mark.parametrize("backend", [gs.cpu])
def test_position_... | 265 | 10,050 |
genesis-world | tests/rigid/test_dynamics.py | .py | import math
import numpy as np
import pytest
import torch
from quadrants.lang._perf_dispatch import PerformanceDispatcher
import genesis as gs
import genesis.utils.geom as gu
from genesis.engine.solvers.rigid.constraint import solver as constraint_solver
from genesis.engine.solvers.rigid.constraint.solver import Cons... | 801 | 31,340 |
genesis-world | tests/rigid/test_kinematics.py | .py | import sys
from typing import TYPE_CHECKING
import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
if TYPE_CHECKING:
from genesis.engine.entities.rigid_entity.r... | 953 | 37,627 |
genesis-world | tests/rigid/test_asset_loading.py | .py | import math
import os
import xml.etree.ElementTree as ET
import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from genesis.ext import urdfpy
from genesis.utils import urdf as uu
from genesis.utils.misc import get_assets_dir, qd_to_numpy, tensor_to_array
from ..utils.asse... | 1,659 | 72,235 |
genesis-world | tests/rigid/test_islands.py | .py | import xml.etree.ElementTree as ET
from itertools import product
import numpy as np
import pytest
import trimesh
import genesis as gs
from genesis.utils.misc import qd_to_numpy, tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
@pytest.fixture
def multi_free_body_path(tmp_path):
# A ... | 970 | 37,735 |
genesis-world | tests/rigid/test_sparse.py | .py | import pytest
import genesis as gs
import genesis.utils.geom as gu
from ..utils.assertions import assert_allclose
@pytest.mark.slow("gpu") # gpu ~250s
@pytest.mark.required
@pytest.mark.parametrize("backend", [gs.cpu, gs.gpu])
def test_noslip_resting_stability(show_viewer):
TABLE_Z = 0.762
scene = gs.Scen... | 111 | 3,749 |
genesis-world | tests/rigid/test_mujoco_parity.py | .py | import mujoco
import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from ..utils.assertions import assert_allclose, assert_equal
from ..utils.mujoco_parity import (
check_mujoco_data_consistency,
check_mujoco_model_consistency,
init_paired_simulators,
simul... | 350 | 16,176 |
genesis-world | tests/rigid/test_collision.py | .py | import math
import xml.etree.ElementTree as ET
from contextlib import nullcontext
from itertools import product
import numpy as np
import pytest
import torch
import trimesh
from scipy.spatial import ConvexHull
from scipy.spatial.qhull import QhullError
import genesis as gs
import genesis.utils.geom as gu
from genesis... | 1,400 | 54,929 |
genesis-world | tests/rigid/test_narrowphase.py | .py | """
Unit test comparing analytical capsule-capsule contact detection with GJK.
This test creates a modified version of narrowphase.py in a temporary file that forces capsule-capsule and
sphere-capsule collisions to use GJK instead of analytical methods, allowing direct comparison between the two
approaches.
# errno
... | 1,065 | 50,976 |
genesis-world | tests/rigid/test_constraints.py | .py | import mujoco
import numpy as np
import pytest
import torch
import genesis as gs
import genesis.utils.geom as gu
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
from ..utils.mujoco_parity import simulate_and_check_mujoco_consistency
@pytest.mark.parametriz... | 294 | 10,879 |
genesis-world | tests/rigid/test_terrain.py | .py | import os
import igl
import numpy as np
import pytest
import torch
import trimesh
import genesis as gs
import genesis.utils.geom as gu
import genesis.utils.terrain as tu
from genesis.utils.misc import get_assets_dir, tensor_to_array
from ..utils.assertions import assert_allclose
@pytest.mark.parametrize(
"back... | 442 | 15,563 |
genesis-world | tests/rigid/test_friction.py | .py | import numpy as np
import pytest
import torch
import trimesh
from scipy.optimize import brentq
import genesis as gs
import genesis.utils.geom as gu
from genesis.utils.misc import tensor_to_array
from ..utils.assertions import assert_allclose, assert_equal
from ..utils.assets import get_hf_dataset
from ..utils.mujoco_... | 1,004 | 52,179 |
genesis-world | tests/rigid/conftest.py | .py | import os
import xml.etree.ElementTree as ET
import numpy as np
import pytest
import trimesh
from genesis.utils.misc import get_assets_dir
@pytest.fixture
def xml_path(request, tmp_path, model_name):
# An asset-relative path passes through to the asset resolver; a bare name is the fixture generating the model.
... | 942 | 48,974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.