before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
for level in range(1, levels + 1):
step = 2 ** (levels - level)
for y in range(0, width, step):
y_skip = (1 + y // step) % 2
for x in range(step * y_skip, length, step * (1 + y_skip)):
x_skip = (1 + x // step) % 2
xref = step * (1 - x_skip)
... | No issues found. | for level in range(1, levels + 1):
step = 2 ** (levels - level)
for y in range(0, width, step):
y_skip = (1 + y // step) % 2
for x in range(step * y_skip, length, step * (1 + y_skip)):
x_skip = (1 + x // step) % 2
xref = step * (1 - x_skip)
... | @@ -53,12 +53,13 @@ def parse_terrain(morph: Terrain, surface):
subterrain_rows = int(morph.subterrain_size[0] / morph.horizontal_scale)
subterrain_cols = int(morph.subterrain_size[1] / morph.horizontal_scale)
heightfield = np.zeros(
- np.array(morph.n_subterrains) ... | genesis/utils/terrain.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add optional subterrain parameters. | 1,289 | Genesis-Embodied-AI/Genesis | 26,702 | Python | LeonLiu4 | Review this pull request change.
Language: Python
File: genesis/utils/terrain.py
PR Title: [FEATURE] Add optional subterrain parameters.
BEFORE CODE: for level in range(1, levels + 1):
step = 2 ** (levels - level)
for y in range(0, width, step):
y_skip = (1 + y // step) % 2
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
plane = scene.add_entity(
gs.morphs.Plane(),
)
cube = scene.add_entity(
gs.morphs.Box(
size=(0.05, 0.05, 0.05),
pos=(0.65, 0.0, 0.025),
),
surface=gs.surfaces.Plastic(color=(1, 0, 0)),
)
cube_2 = scene.add_entity(
gs.morphs.Box(
... | No issues found. | )
plane = scene.add_entity(
gs.morphs.Plane(),
)
cube = scene.add_entity(
gs.morphs.Box(
size=(0.05, 0.05, 0.05),
pos=(0.65, 0.0, 0.025),
),
surface=gs.surfaces.Plastic(color=(1, 0, 0)),
)
cube_2 = scene.add_entity(
gs.morphs.Box(
... | @@ -2122,6 +2122,55 @@ def test_urdf_mimic(show_viewer, tol):
assert_allclose(gs_qpos[-1], gs_qpos[-2], tol=tol)
+@pytest.mark.required
+@pytest.mark.parametrize("backend", [gs.cpu])
+def test_drone_hover_same_with_and_without_substeps(show_viewer, tol):
+ base_rpm = 15000
+ scene_ref = gs.Scene(
+ ... | tests/test_rigid_physics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Preserve external forces across sub-steps. | 1,290 | Genesis-Embodied-AI/Genesis | 26,702 | Python | LeonLiu4 | Review this pull request change.
Language: Python
File: tests/test_rigid_physics.py
PR Title: [BUG FIX] Preserve external forces across sub-steps.
BEFORE CODE: )
plane = scene.add_entity(
gs.morphs.Plane(),
)
cube = scene.add_entity(
gs.morphs.Box(
size=(0.05, 0.05, 0.05)... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
integrator = gs.integrator.approximate_implicitfast
substeps = 1
armature = 0.0
elif mode == 1:
integrator = gs.integrator.implicitfast
substeps = 4
armature = 0.0
elif mode == 2:
integrator = gs.integrator.Euler
substeps = 1
armature = 2.0... | No issues found. | integrator = gs.integrator.approximate_implicitfast
substeps = 1
armature = 0.0
elif mode == 1:
integrator = gs.integrator.implicitfast
substeps = 4
armature = 0.0
elif mode == 2:
integrator = gs.integrator.Euler
substeps = 1
armature = 2.0... | @@ -279,6 +279,30 @@ def double_pendulum(asset_tmp_path):
return _build_multi_pendulum(n=2)
+@pytest.fixture(scope="session")
+def double_ball_pendulum():
+ mjcf = ET.Element("mujoco", model="double_ball_pendulum")
+
+ default = ET.SubElement(mjcf, "default")
+ ET.SubElement(default, "joint", armature... | tests/test_rigid_physics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Improve external force handling. | 1,292 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: tests/test_rigid_physics.py
PR Title: [BUG FIX] Improve external force handling.
BEFORE CODE: integrator = gs.integrator.approximate_implicitfast
substeps = 1
armature = 0.0
elif mode == 1:
integrator = gs.integrator.implici... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
return os.path.join(get_cache_dir(), "cvx")
def get_ptc_cache_dir():
return os.path.join(get_cache_dir(), "ptc")
def get_tet_cache_dir():
return os.path.join(get_cache_dir(), "tet")
def get_gel_cache_dir():
return os.path.join(get_cache_dir(), "gel")
def get_remesh_cache_dir():
return os.pat... | No issues found. | return os.path.join(get_cache_dir(), "cvx")
def get_ptc_cache_dir():
return os.path.join(get_cache_dir(), "ptc")
def get_tet_cache_dir():
return os.path.join(get_cache_dir(), "tet")
def get_gel_cache_dir():
return os.path.join(get_cache_dir(), "gel")
def get_remesh_cache_dir():
return os.pat... | @@ -45,28 +45,76 @@ def raise_exception_from(msg="Something went wrong.", cause=None):
class redirect_libc_stderr:
+ """
+ Context-manager that temporarily redirects C / C++ std::cerr
+ (i.e. the C `stderr` file descriptor 2) to a given Python
+ file-like object’s fd.
+
+ Works on macOS, Linux (glib... | genesis/utils/misc.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Reduce warning messages. | 1,294 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/utils/misc.py
PR Title: [MISC] Reduce warning messages.
BEFORE CODE: return os.path.join(get_cache_dir(), "cvx")
def get_ptc_cache_dir():
return os.path.join(get_cache_dir(), "ptc")
def get_tet_cache_dir():
return os.path.join(get_cache... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
def __init__(
self,
E=1e6,
nu=0.2,
rho=1000.0,
hydroelastic_modulus=1e7,
friction_mu=0.1,
hessian_invariant=False,
):
super().__init__()
self._E = E
self._nu = nu
self._rho = rho
self._hydroelastic_modulus = hydroel... | No issues found. | def __init__(
self,
E=1e6,
nu=0.2,
rho=1000.0,
hydroelastic_modulus=1e7,
friction_mu=0.1,
hessian_invariant=False,
):
super().__init__()
self._E = E
self._nu = nu
self._rho = rho
self._hydroelastic_modulus = hydroel... | @@ -57,6 +57,13 @@ def __init__(
# will be set when added to solver
self._idx = None
+ def build(self, fem_solver):
+ pass
+
+ @ti.func
+ def pre_compute(self, J, F, i_e, i_b):
+ pass
+
@ti.func
def update_stress(self, mu, lam, J, F, actu, m_dir):
raise NotI... | genesis/engine/materials/FEM/base.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add linear_corotated elastic material for fem | 1,304 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Libero0809 | Review this pull request change.
Language: Python
File: genesis/engine/materials/FEM/base.py
PR Title: [FEATURE] Add linear_corotated elastic material for fem
BEFORE CODE: def __init__(
self,
E=1e6,
nu=0.2,
rho=1000.0,
hydroelastic_modulus=1e7,
friction_mu=0.1,
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
# self.pcg_state[i_v, i_b].prec = ti.Matrix.identity(gs.ti_float, 3)
# Use diagonal for preconditioner
# self.pcg_state[i_v, i_b].prec = ti.Matrix([[1 / self.pcg_state[i_v, i_b].diag3x3[0, 0], 0, 0],
# [0, 1 / self.pcg_state[i_v... | No issues found. | # self.pcg_state[i_v, i_b].prec = ti.Matrix.identity(gs.ti_float, 3)
# Use diagonal for preconditioner
# self.pcg_state[i_v, i_b].prec = ti.Matrix([[1 / self.pcg_state[i_v, i_b].diag3x3[0, 0], 0, 0],
# [0, 1 / self.pcg_state[i_v... | @@ -528,6 +528,32 @@ def _func_compute_ele_energy(self, f: ti.i32):
self.elements_el_energy[i_b, i_e].energy += 0.5 * damping_beta_over_dt * St_x_diff.dot(H_St_x_diff)
+ # add linearized damping energy
+ if self._damping_beta > gs.EPS:
+ damping_beta_over_dt = s... | genesis/engine/solvers/fem_solver.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix BVH build's radix sort. | 1,305 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Libero0809 | Review this pull request change.
Language: Python
File: genesis/engine/solvers/fem_solver.py
PR Title: [BUG FIX] Fix BVH build's radix sort.
BEFORE CODE: # self.pcg_state[i_v, i_b].prec = ti.Matrix.identity(gs.ti_float, 3)
# Use diagonal for preconditioner
# self.pcg_state[i_v,... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
def get_ptc_cache_dir():
return os.path.join(get_cache_dir(), "ptc")
def get_tet_cache_dir():
return os.path.join(get_cache_dir(), "tet")
def get_gel_cache_dir():
return os.path.join(get_cache_dir(), "gel")
def get_remesh_cache_dir():
return os.path.join(get_cache_dir(), "rm")
def clean_cache_fi... | No issues found. | def get_ptc_cache_dir():
return os.path.join(get_cache_dir(), "ptc")
def get_tet_cache_dir():
return os.path.join(get_cache_dir(), "tet")
def get_gel_cache_dir():
return os.path.join(get_cache_dir(), "gel")
def get_remesh_cache_dir():
return os.path.join(get_cache_dir(), "rm")
def clean_cache_fi... | @@ -46,49 +46,43 @@ def raise_exception_from(msg="Something went wrong.", cause=None):
class redirect_libc_stderr:
"""
- Context-manager that temporarily redirects C / C++ std::cerr
- (i.e. the C `stderr` file descriptor 2) to a given Python
- file-like object’s fd.
+ Context-manager that temporaril... | genesis/utils/misc.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Get around MacOS Metal GPU taichi compiler bug. | 1,308 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/utils/misc.py
PR Title: [BUG FIX] Get around MacOS Metal GPU taichi compiler bug.
BEFORE CODE: def get_ptc_cache_dir():
return os.path.join(get_cache_dir(), "ptc")
def get_tet_cache_dir():
return os.path.join(get_cache_dir(), "tet")
def get... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Whether to convexify the entity. When convexify is True, all the meshes in the entity will each be converted
to a set of convex hulls. The mesh with be decomposed into multiple convex components if a single one is not
sufficient to met the desired accuracy (see 'decompose_(robot|object)_error_th... | No issues found. | Whether to convexify the entity. When convexify is True, all the meshes in the entity will each be converted
to a set of convex hulls. The mesh with be decomposed into multiple convex components if a single one is not
sufficient to met the desired accuracy (see 'decompose_(robot|object)_error_th... | @@ -893,6 +893,8 @@ class Terrain(Morph):
The size of each cell in the subterrain in meters. Defaults to 0.25.
vertical_scale : float, optional
The height of each step in the subterrain in meters. Defaults to 0.005.
+ uv_scale : float, optional
+ The scale of the UV mapping for the terr... | genesis/options/morphs.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [Feature] Terrain texture user option | 1,311 | Genesis-Embodied-AI/Genesis | 26,702 | Python | LeonLiu4 | Review this pull request change.
Language: Python
File: genesis/options/morphs.py
PR Title: [Feature] Terrain texture user option
BEFORE CODE: Whether to convexify the entity. When convexify is True, all the meshes in the entity will each be converted
to a set of convex hulls. The mesh with be decom... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
def stop(self):
if self.is_alive():
self._pyrender_viewer.close()
def is_alive(self):
return self._pyrender_viewer is not None and self._pyrender_viewer.is_active
def setup_camera(self):
pos = np.array(self._camera_init_pos)
up = np.array(self._camera_up)
... | No issues found. |
def stop(self):
if self.is_alive():
self._pyrender_viewer.close()
def is_alive(self):
return self._pyrender_viewer is not None and self._pyrender_viewer.is_active
def setup_camera(self):
pos = np.array(self._camera_init_pos)
up = np.array(self._camera_up)
... | @@ -1,6 +1,7 @@
import os
import threading
import importlib
+from typing import TYPE_CHECKING
import numpy as np
import OpenGL.error
@@ -14,6 +15,9 @@
from genesis.utils.tools import Rate
from genesis.utils.misc import redirect_libc_stderr
+if TYPE_CHECKING:
+ from genesis.options.vis import ViewerOptions... | genesis/vis/viewer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Add stub code for mouse interaction | 1,321 | Genesis-Embodied-AI/Genesis | 26,702 | Python | gasnica | Review this pull request change.
Language: Python
File: genesis/vis/viewer.py
PR Title: [MISC] Add stub code for mouse interaction
BEFORE CODE:
def stop(self):
if self.is_alive():
self._pyrender_viewer.close()
def is_alive(self):
return self._pyrender_viewer is not None and sel... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
np.ndarray: Camera intrinsics. [3, 3]
"""
fx = P[0, 0] * width / 2
fy = P[1, 1] * height / 2
cx = (1.0 - P[0, 2]) * width / 2
cy = (1.0 + P[1, 2]) * height / 2
K = np.array([[fx, 0, cx], [0, fy, cy], [0... | No issues found. | np.ndarray: Camera intrinsics. [3, 3]
"""
fx = P[0, 0] * width / 2
fy = P[1, 1] * height / 2
cx = (1.0 - P[0, 2]) * width / 2
cy = (1.0 + P[1, 2]) * height / 2
K = np.array([[fx, 0, cx], [0, fy, cy], [0... | @@ -8,6 +8,7 @@
import genesis as gs
import genesis.utils.geom as gu
from genesis.repr_base import RBC
+from genesis.utils.misc import tensor_to_array
class Camera(RBC):
@@ -91,6 +92,7 @@ def __init__(
self._is_built = False
self._attached_link = None
self._attached_offset_T = None
+ ... | genesis/vis/camera.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Allow mounted cameras to be run in parallel simulations | 1,323 | Genesis-Embodied-AI/Genesis | 26,702 | Python | abhijitmajumdar | Review this pull request change.
Language: Python
File: genesis/vis/camera.py
PR Title: [FEATURE] Allow mounted cameras to be run in parallel simulations
BEFORE CODE: np.ndarray: Camera intrinsics. [3, 3]
"""
fx = P[0, 0] * width / 2
fy = P[1, 1] ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if hibernate:
self._func_hibernate_entity(i_e, i_b)
else:
# update collider sort_buffer
for i_g in range(self.entities_info[i_e].geom_start, self.entities_info[i_e].geom_end):
self.collider.sort_buffer[se... | No issues found. | if hibernate:
self._func_hibernate_entity(i_e, i_b)
else:
# update collider sort_buffer
for i_g in range(self.entities_info[i_e].geom_start, self.entities_info[i_e].geom_end):
self.collider.sort_buffer[se... | @@ -156,6 +156,7 @@ def add_entity(self, idx, material, morph, surface, visualize_contact) -> Entity
return entity
def build(self):
+ super().build()
self.n_envs = self.sim.n_envs
self._B = self.sim._B
self._para_level = self.sim._para_level
@@ -2929,9 +2930,7 @@ def _f... | genesis/engine/solvers/rigid/rigid_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Environment-wise gravity | 1,324 | Genesis-Embodied-AI/Genesis | 26,702 | Python | LeonLiu4 | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/rigid_solver_decomp.py
PR Title: [FEATURE] Environment-wise gravity
BEFORE CODE: if hibernate:
self._func_hibernate_entity(i_e, i_b)
else:
# update collider so... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
b[0] = 0.0
for i in range(1, 4):
i1, i2 = i % 3 + 1, (i + 1) % 3 + 1
vec = self.simplex_support[i1, i_b].v.cross(self.simplex_support[i2, i_b].v)
b[i] = vec.dot(direction)
sum_ = b.sum()
p1 = gs.ti_vec3([0.0, 0.0, 0.0])
... | No issues found. | b[0] = 0.0
for i in range(1, 4):
i1, i2 = i % 3 + 1, (i + 1) % 3 + 1
vec = self.simplex_support[i1, i_b].v.cross(self.simplex_support[i2, i_b].v)
b[i] = vec.dot(direction)
sum_ = b.sum()
p1 = gs.ti_vec3([0.0, 0.0, 0.0])
... | @@ -357,76 +357,7 @@ def mpr_expand_portal(self, v, v1, v2, i_ga, i_gb, i_b):
self.simplex_support[i_s, i_b].v = v
@ti.func
- def mpr_discover_portal(self, i_ga, i_gb, i_b, normal_ws):
- # MPR algorithm was initially design to check whether a pair of convex geometries was colliding. The author... | genesis/engine/solvers/rigid/mpr_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix terrain collision detection. | 1,338 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/mpr_decomp.py
PR Title: [BUG FIX] Fix terrain collision detection.
BEFORE CODE: b[0] = 0.0
for i in range(1, 4):
i1, i2 = i % 3 + 1, (i + 1) % 3 + 1
vec = self.simplex_support... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
@classmethod
def from_any_array(cls, v: np.ndarray) -> 'Vec3':
assert v.shape == (3,), f"Vec3 must be initialized with a 3-element array, got {v.shape}"
return cls.from_xyz(*v)
@classmethod
def zero(cls):
return cls(np.array([0, 0, 0], dtype=np.float32))
@classmethod
d... | No issues found. | @classmethod
def from_any_array(cls, v: np.ndarray) -> 'Vec3':
assert v.shape == (3,), f"Vec3 must be initialized with a 3-element array, got {v.shape}"
return cls.from_xyz(*v)
@classmethod
def zero(cls):
return cls(np.array([0, 0, 0], dtype=np.float32))
@classmethod
d... | @@ -1,6 +1,13 @@
+from dataclasses import dataclass
+from typing import Union
+
import numpy as np
from numpy.typing import NDArray
+# If not needing runtime checks, we can just use annotated types:
+# Vec3 = Annotated[npt.NDArray[np.float32], (3,)]
+# Aabb = Annotated[npt.NDArray[np.float32], (2, 3)]
+
class Ve... | genesis/ext/pyrender/interaction/vec3.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Add raycasting against box-entities in the scene | 1,346 | Genesis-Embodied-AI/Genesis | 26,702 | Python | gasnica | Review this pull request change.
Language: Python
File: genesis/ext/pyrender/interaction/vec3.py
PR Title: [MISC] Add raycasting against box-entities in the scene
BEFORE CODE: @classmethod
def from_any_array(cls, v: np.ndarray) -> 'Vec3':
assert v.shape == (3,), f"Vec3 must be initialized with a 3-e... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
def reset_grad(self):
for solver in self._active_solvers:
solver.reset_grad()
# clear up all queried scene states and free up memory
self._queried_states.clear()
# ------------------------------------------------------------------------------------
# ------------------... | No issues found. |
def reset_grad(self):
for solver in self._active_solvers:
solver.reset_grad()
# clear up all queried scene states and free up memory
self._queried_states.clear()
# ------------------------------------------------------------------------------------
# ------------------... | @@ -22,6 +22,7 @@
from .coupler import Coupler, SAPCoupler
from .entities import HybridEntity
+from .solvers.base_solver import Solver
from .solvers import (
AvatarSolver,
FEMSolver,
@@ -205,12 +206,12 @@ def build(self):
if isinstance(entity, HybridEntity):
entity.build()
... | genesis/engine/simulator.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Improve reset | 1,350 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Kashu7100 | Review this pull request change.
Language: Python
File: genesis/engine/simulator.py
PR Title: [MISC] Improve reset
BEFORE CODE:
def reset_grad(self):
for solver in self._active_solvers:
solver.reset_grad()
# clear up all queried scene states and free up memory
self._queried... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
from dataclasses import dataclass
from typing import Callable
import taichi as ti
import genesis as gs
# we will use struct for DofsState and DofsInfo after Hugh adds array_struct feature to taichi
DofsState = ti.template()
DofsInfo = ti.template()
@ti.data_oriented
class RigidGlobalInfo:
def __init__(self, n_... | No issues found. | from dataclasses import dataclass
from typing import Callable
import taichi as ti
import genesis as gs
# we will use struct for DofsState and DofsInfo after Hugh adds array_struct feature to taichi
DofsState = ti.template()
DofsInfo = ti.template()
@ti.data_oriented
class RigidGlobalInfo:
def __init__(self, n_... | @@ -0,0 +1,17 @@
+from dataclasses import dataclass
+from typing import Callable
+
+import taichi as ti
+
+import genesis as gs
+
+# we will use struct for DofsState and DofsInfo after Hugh adds array_struct feature to taichi
+DofsState = ti.template()
+DofsInfo = ti.template()
+
+
+@ti.data_oriented
+class RigidGlobal... | genesis/engine/solvers/rigid/array_class.py | 0 | Python | 1 | none | 16 | 18 | 18 | true | [Migration] Initial template for migration | 1,361 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/array_class.py
PR Title: [Migration] Initial template for migration
BEFORE CODE: from dataclasses import dataclass
from typing import Callable
import taichi as ti
import genesis as gs
# we will use struct for DofsState and DofsI... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
for j in range(3):
tensor[i_b, i_v - self._vvert_start, j] = vvert_pos[j]
@gs.assert_built
def get_AABB(self):
"""
Get the axis-aligned bounding box (AABB) of the link's collision body (concatenation of all `link.geoms`) in the world frame.
"""
... | No issues found. | for j in range(3):
tensor[i_b, i_v - self._vvert_start, j] = vvert_pos[j]
@gs.assert_built
def get_AABB(self):
"""
Get the axis-aligned bounding box (AABB) of the link's collision body (concatenation of all `link.geoms`) in the world frame.
"""
... | @@ -55,24 +55,24 @@ def __init__(
self._entity_idx_in_solver = entity.idx
self._uid = gs.UID()
- self._idx = idx
- self._parent_idx = parent_idx
- self._root_idx = root_idx
- self._child_idxs = list()
- self._invweight = invweight
-
- self._joint_start = joi... | genesis/engine/entities/rigid_entity/rigid_link.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Add viewer code to handle moving objects | 1,378 | Genesis-Embodied-AI/Genesis | 26,702 | Python | gasnica | Review this pull request change.
Language: Python
File: genesis/engine/entities/rigid_entity/rigid_link.py
PR Title: [MISC] Add viewer code to handle moving objects
BEFORE CODE: for j in range(3):
tensor[i_b, i_v - self._vvert_start, j] = vvert_pos[j]
@gs.assert_built
de... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
):
"""
Adapted from Issac Gym's `convert_heightfield_to_trimesh` function.
Convert a heightfield array to a triangle mesh represented by vertices and triangles.
Optionally, corrects vertical surfaces above the provide slope threshold:
If (y2-y1)/(x2-x1) > slope_threshold -> Move A to A' (set x1... | No issues found. | ):
"""
Adapted from Issac Gym's `convert_heightfield_to_trimesh` function.
Convert a heightfield array to a triangle mesh represented by vertices and triangles.
Optionally, corrects vertical surfaces above the provide slope threshold:
If (y2-y1)/(x2-x1) > slope_threshold -> Move A to A' (set x1... | @@ -155,6 +155,7 @@ def parse_terrain(morph: Terrain, surface):
heightfield,
horizontal_scale=morph.horizontal_scale,
vertical_scale=morph.vertical_scale,
+ surface=surface,
uv_scale=morph.uv_scale if need_uvs else None,
)
@@ -214,7 +215,12 @@ de... | genesis/utils/terrain.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Enabling rendering plane geometry one-sided. | 1,396 | Genesis-Embodied-AI/Genesis | 26,702 | Python | LeonLiu4 | Review this pull request change.
Language: Python
File: genesis/utils/terrain.py
PR Title: [FEATURE] Enabling rendering plane geometry one-sided.
BEFORE CODE: ):
"""
Adapted from Issac Gym's `convert_heightfield_to_trimesh` function.
Convert a heightfield array to a triangle mesh represented by vertices... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
self.particles[target, i_p, i_b].Jp = self.particles[source, i_p, i_b].Jp
self.particles_ng[target, i_p, i_b].active = self.particles_ng[source, i_p, i_b].active
@ti.kernel
def copy_grad(self, source: ti.i32, target: ti.i32):
for i_p, i_b in ti.ndrange(self._n_particles, self._... | No issues found. | self.particles[target, i_p, i_b].Jp = self.particles[source, i_p, i_b].Jp
self.particles_ng[target, i_p, i_b].active = self.particles_ng[source, i_p, i_b].active
@ti.kernel
def copy_grad(self, source: ti.i32, target: ti.i32):
for i_p, i_b in ti.ndrange(self._n_particles, self._... | @@ -104,15 +104,15 @@ def init_particle_fields(self):
# dynamic particle state without gradient
struct_particle_state_ng = ti.types.struct(
- active=ti.u1,
+ active=gs.ti_bool,
)
# static particle info
struct_particle_info = ti.types.struct(
... | genesis/engine/solvers/mpm_solver.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix support of Apple Metal. | 1,404 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/engine/solvers/mpm_solver.py
PR Title: [BUG FIX] Fix support of Apple Metal.
BEFORE CODE: self.particles[target, i_p, i_b].Jp = self.particles[source, i_p, i_b].Jp
self.particles_ng[target, i_p, i_b].active = self.particles_ng[... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
for j in range(3):
tensor[i_b, i_v - self._vvert_start, j] = vvert_pos[j]
@gs.assert_built
def get_AABB(self):
"""
Get the axis-aligned bounding box (AABB) of the link's collision body (concatenation of all `link.geoms`) in the world frame.
... | No issues found. | )
for j in range(3):
tensor[i_b, i_v - self._vvert_start, j] = vvert_pos[j]
@gs.assert_built
def get_AABB(self):
"""
Get the axis-aligned bounding box (AABB) of the link's collision body (concatenation of all `link.geoms`) in the world frame.
... | @@ -14,6 +14,7 @@
if TYPE_CHECKING:
from .rigid_entity import RigidEntity
+ from genesis.engine.solvers.rigid.rigid_solver_decomp import RigidSolver
@ti.data_oriented
@@ -51,7 +52,7 @@ def __init__(
):
self._name: str = name
self._entity: "RigidEntity" = entity
- self._solv... | genesis/engine/entities/rigid_entity/rigid_link.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Stub code for physical object dragging | 1,411 | Genesis-Embodied-AI/Genesis | 26,702 | Python | gasnica | Review this pull request change.
Language: Python
File: genesis/engine/entities/rigid_entity/rigid_link.py
PR Title: [MISC] Stub code for physical object dragging
BEFORE CODE: )
for j in range(3):
tensor[i_b, i_v - self._vvert_start, j] = vvert_pos[j]
@gs.ass... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
I_l = [i_l, i_b] if ti.static(static_rigid_sim_config.batch_links_info) else i_l
l_info = links_info[I_l]
cvel_vel = ti.Vector.zero(gs.ti_float, 3)
cvel_ang = ti.Vector.zero(gs.ti_float, 3)
if l_info.parent_idx != -1:
cvel_vel = links_state[l_... | No issues found. | I_l = [i_l, i_b] if ti.static(static_rigid_sim_config.batch_links_info) else i_l
l_info = links_info[I_l]
cvel_vel = ti.Vector.zero(gs.ti_float, 3)
cvel_ang = ti.Vector.zero(gs.ti_float, 3)
if l_info.parent_idx != -1:
cvel_vel = links_state[l_... | @@ -2110,15 +2110,78 @@ def substep(self):
links_info=self.links_info,
links_state=self.links_state,
joints_info=self.joints_info,
+ joints_state=self.joints_state,
entities_state=self.entities_state,
entities_info=self.entities_info,
+ ... | genesis/engine/solvers/rigid/rigid_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Move forward_kinematics to the end of a step. | 1,423 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/rigid_solver_decomp.py
PR Title: [BUG FIX] Move forward_kinematics to the end of a step.
BEFORE CODE: I_l = [i_l, i_b] if ti.static(static_rigid_sim_config.batch_links_info) else i_l
l_info = links_info[I_l]... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
else:
geoms = avatar_entity.geoms
geoms_T = self.sim.avatar_solver._geoms_render_T
for geom in geoms:
geom_T = geoms_T[geom.idx]
node = self._scene.get_buffer_id(self.rigid_nodes[geom.uid], "model")
... | No issues found. | else:
geoms = avatar_entity.geoms
geoms_T = self.sim.avatar_solver._geoms_render_T
for geom in geoms:
geom_T = geoms_T[geom.idx]
node = self._scene.get_buffer_id(self.rigid_nodes[geom.uid], "model")
... | @@ -35,6 +35,8 @@ def __init__(self, options):
self.rendered_envs_idx = options.rendered_envs_idx
self.env_separate_rigid = options.env_separate_rigid
+ self.buffer = dict()
+
# nodes
self.world_frame_node = None
self.link_frame_nodes = dict()
@@ -831,31 +833,31 @@ ... | genesis/vis/rasterizer_context.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix broken interactive viewer. | 1,426 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/vis/rasterizer_context.py
PR Title: [BUG FIX] Fix broken interactive viewer.
BEFORE CODE: else:
geoms = avatar_entity.geoms
geoms_T = self.sim.avatar_solver._geoms_render_T
for ge... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
cubes = []
for pos in (
(-0.1, 0.2, 0.7),
(0.0, 0.3, 0.8),
(-0.1, -0.2, 0.7),
(0.0, -0.3, 0.8),
(0.3, 0.2, 0.6),
(0.3, -0.2, 0.6),
(0.3, 0.3, 0.7),
(0.3, -0.3, 0.7),
):
cube = scene.add_entity(
gs.morphs.Box(
... | No issues found. | )
cubes = []
for pos in (
(-0.1, 0.2, 0.7),
(0.0, 0.3, 0.8),
(-0.1, -0.2, 0.7),
(0.0, -0.3, 0.8),
(0.3, 0.2, 0.6),
(0.3, -0.2, 0.6),
(0.3, 0.3, 0.7),
(0.3, -0.3, 0.7),
):
cube = scene.add_entity(
gs.morphs.Box(
... | @@ -2696,3 +2696,52 @@ def test_geom_pos_quat(show_viewer, tol):
for vgeom, geom in zip(link.vgeoms, link.geoms):
assert_allclose(geom.get_pos(), vgeom.get_pos(), atol=tol)
assert_allclose(geom.get_quat(), vgeom.get_quat(), atol=tol)
+
+
+@pytest.mark.parametrize("backend", [gs.cpu])
... | tests/test_rigid_physics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add support of 'contype'/'conaffinity' for primitive and mesh entities. | 1,438 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Kashu7100 | Review this pull request change.
Language: Python
File: tests/test_rigid_physics.py
PR Title: [FEATURE] Add support of 'contype'/'conaffinity' for primitive and mesh entities.
BEFORE CODE: )
cubes = []
for pos in (
(-0.1, 0.2, 0.7),
(0.0, 0.3, 0.8),
(-0.1, -0.2, 0.7),
(0.... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
self._kernel_rrt_step1(
q_limit_lower=self._entity.q_limit[0],
q_limit_upper=self._entity.q_limit[1],
envs_idx=envs_idx,
)
if is_plan_with_obj:
self.update_object(ee_link_idx, obj_link_idx, _p... | No issues found. | self._kernel_rrt_step1(
q_limit_lower=self._entity.q_limit[0],
q_limit_upper=self._entity.q_limit[1],
envs_idx=envs_idx,
)
if is_plan_with_obj:
self.update_object(ee_link_idx, obj_link_idx, _p... | @@ -14,6 +14,8 @@ def __init__(self, entity):
self._entity = entity
self._solver = entity._solver
+ self.PENETRATION_EPS = 1e-5 if gs.ti_float == ti.f32 else 0.0
+
for joint in entity.joints:
if joint.type == gs.JOINT_TYPE.FREE:
gs.raise_exception("plann... | genesis/utils/path_planing.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Enable GJK collision detection algorithm by default. | 1,439 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/utils/path_planing.py
PR Title: [MISC] Enable GJK collision detection algorithm by default.
BEFORE CODE: self._kernel_rrt_step1(
q_limit_lower=self._entity.q_limit[0],
q_limit_upper=self._entity.q... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
return cls(np.array([1, 1, 1], dtype=np.float32))
@classmethod
def full(cls, fill_value: float) -> 'Vec3':
return cls(np.full((3,), fill_value, dtype=np.float32))
class Quat:
v: NDArray[np.float32]
def __init__(self, v: NDArray[np.float32]):
assert v.shape == (4,), f"Quat must... | No issues found. | return cls(np.array([1, 1, 1], dtype=np.float32))
@classmethod
def full(cls, fill_value: float) -> 'Vec3':
return cls(np.full((3,), fill_value, dtype=np.float32))
class Quat:
v: NDArray[np.float32]
def __init__(self, v: NDArray[np.float32]):
assert v.shape == (4,), f"Quat must... | @@ -2,12 +2,13 @@
from typing import TYPE_CHECKING, Union
import numpy as np
-from numpy.typing import NDArray
+from numpy.typing import NDArray, ArrayLike
from genesis.utils.misc import tensor_to_array
if TYPE_CHECKING:
from genesis.engine.entities.rigid_entity.rigid_geom import RigidGeom
+ from gene... | genesis/ext/pyrender/interaction/vec3.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Picking boxes and Panda links with a MouseSpring | 1,443 | Genesis-Embodied-AI/Genesis | 26,702 | Python | gasnica | Review this pull request change.
Language: Python
File: genesis/ext/pyrender/interaction/vec3.py
PR Title: [MISC] Picking boxes and Panda links with a MouseSpring
BEFORE CODE: return cls(np.array([1, 1, 1], dtype=np.float32))
@classmethod
def full(cls, fill_value: float) -> 'Vec3':
return c... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
),
sim_options=gs.options.SimOptions(
dt=0.01,
),
rigid_options=gs.options.RigidOptions(
box_box_detection=True,
),
show_viewer=args.vis,
)
########################## entities ##########################
plane = scene.add_entity(
... | No issues found. | ),
sim_options=gs.options.SimOptions(
dt=0.01,
),
rigid_options=gs.options.RigidOptions(
box_box_detection=True,
),
show_viewer=args.vis,
)
########################## entities ##########################
plane = scene.add_entity(
... | @@ -2,79 +2,89 @@
import time
import genesis as gs
-########################## init ##########################
-gs.init(backend=gs.gpu, precision="32")
-########################## create a scene ##########################
-scene = gs.Scene(
- viewer_options=gs.options.ViewerOptions(
- camera_pos=(3, -1, 1... | examples/rigid/franka_cube.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix errors in APIs that are used by rigid examples | 1,471 | Genesis-Embodied-AI/Genesis | 26,702 | Python | SonSang | Review this pull request change.
Language: Python
File: examples/rigid/franka_cube.py
PR Title: [BUG FIX] Fix errors in APIs that are used by rigid examples
BEFORE CODE: ),
sim_options=gs.options.SimOptions(
dt=0.01,
),
rigid_options=gs.options.RigidOptions(
b... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Returns the local index of the joint in the entity.
"""
return self._idx - self._entity.joint_start
@property
def init_qpos(self):
"""
Returns the initial joint position.
"""
return self._init_qpos
@property
def n_qs(self):
"""
Re... | No issues found. | Returns the local index of the joint in the entity.
"""
return self._idx - self._entity.joint_start
@property
def init_qpos(self):
"""
Returns the initial joint position.
"""
return self._init_qpos
@property
def n_qs(self):
"""
Re... | @@ -32,6 +32,7 @@ def __init__(
dofs_motion_vel,
dofs_limit,
dofs_invweight,
+ dofs_frictionloss,
dofs_stiffness,
dofs_damping,
dofs_armature,
@@ -60,6 +61,7 @@ def __init__(
self._dofs_motion_vel = dofs_motion_vel
self._dofs_limit = dofs_li... | genesis/engine/entities/rigid_entity/rigid_joint.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [Feature] Joint friction / frictionloss | 1,479 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/engine/entities/rigid_entity/rigid_joint.py
PR Title: [Feature] Joint friction / frictionloss
BEFORE CODE: Returns the local index of the joint in the entity.
"""
return self._idx - self._entity.joint_start
@property
de... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
n_dofs = entities_info.n_dofs[i_e]
# Step 1: Solve w st. L^T @ w = y
for i_d_ in range(n_dofs):
i_d = entity_dof_end - i_d_ - 1
out[i_d, i_b] = vec[i_d, i_b]
for j_d in range(i_d + 1, entity_dof_end):
... | No issues found. | n_dofs = entities_info.n_dofs[i_e]
# Step 1: Solve w st. L^T @ w = y
for i_d_ in range(n_dofs):
i_d = entity_dof_end - i_d_ - 1
out[i_d, i_b] = vec[i_d, i_b]
for j_d in range(i_d + 1, entity_dof_end):
... | @@ -2194,16 +2194,9 @@ def update_vgeoms(self):
@gs.assert_built
def set_gravity(self, gravity, envs_idx=None):
- if not hasattr(self, "_rigid_global_info"):
- super().set_gravity(gravity, envs_idx)
- return
- g = np.asarray(gravity, dtype=gs.np_float)
- if envs_id... | genesis/engine/solvers/rigid/rigid_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix gravity setters. | 1,498 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Milotrince | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/rigid_solver_decomp.py
PR Title: [BUG FIX] Fix gravity setters.
BEFORE CODE: n_dofs = entities_info.n_dofs[i_e]
# Step 1: Solve w st. L^T @ w = y
for i_d_ in range(n_dofs):
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
gs.init()
scene = gs.Scene(
viewer_options=gs.options.ViewerOptions(
camera_pos=(0.0, -2, 1.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
max_FPS=200,
),
show_viewer=args.vis,
)
scene.add_entity(gs.morphs.Plane())
scene.a... | No issues found. | gs.init()
scene = gs.Scene(
viewer_options=gs.options.ViewerOptions(
camera_pos=(0.0, -2, 1.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
max_FPS=200,
),
show_viewer=args.vis,
)
scene.add_entity(gs.morphs.Plane())
scene.a... | @@ -37,8 +37,8 @@ def main():
pos=(0.025, 0, 0.5),
quat=(0, 0, 0, 1),
size=(0.1, 0.1, 0.1),
- contype=1,
- conaffinity=1,
+ contype=0b001,
+ conaffinity=0b001,
),
surface=gs.surfaces.Default(
color=(1.0, 0.... | examples/collision/contype.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Make collision bitmasks filter local to entity for MJCF morphs. | 1,499 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: examples/collision/contype.py
PR Title: [MISC] Make collision bitmasks filter local to entity for MJCF morphs.
BEFORE CODE: gs.init()
scene = gs.Scene(
viewer_options=gs.options.ViewerOptions(
camera_pos=(0.0, -2, 1.5),
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
self.buffer = torch.empty((N, *shape), dtype=dtype, device=gs.device)
else:
assert buffer.shape == (N, *shape)
self.buffer = buffer
self.N = N
if isinstance(idx_ptr, int):
self._idx_ptr = ctypes.c_int(idx_ptr)
else:
self._idx_pt... | No issues found. | self.buffer = torch.empty((N, *shape), dtype=dtype, device=gs.device)
else:
assert buffer.shape == (N, *shape)
self.buffer = buffer
self.N = N
if isinstance(idx_ptr, int):
self._idx_ptr = ctypes.c_int(idx_ptr)
else:
self._idx_pt... | @@ -0,0 +1,83 @@
+import ctypes
+
+import torch
+
+import genesis as gs
+
+
+class TensorRingBuffer:
+ def __init__(
+ self,
+ N: int,
+ shape: tuple[int, ...],
+ dtype=torch.float32,
+ buffer: torch.Tensor | None = None,
+ idx_ptr: int | ctypes.c_int = 0,
+ ):
+ i... | genesis/utils/ring_buffer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add dedicated sensor manager. | 1,518 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Milotrince | Review this pull request change.
Language: Python
File: genesis/utils/ring_buffer.py
PR Title: [FEATURE] Add dedicated sensor manager.
BEFORE CODE: self.buffer = torch.empty((N, *shape), dtype=dtype, device=gs.device)
else:
assert buffer.shape == (N, *shape)
self.buffer =... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
assert_allclose(np.diff(depth_arrs, axis=0)[[0, 1, 2, 4, 5, 6]], 0.0, tol=tol)
@pytest.mark.required
def test_point_cloud(show_viewer):
CAMERA_DIST = 8.0
OBJ_OFFSET = 10.0
BOX_HALFSIZE = 1.0
SPHERE_RADIUS = 1.0
scene = gs.Scene(
show_viewer=show_viewer,
show_FPS=False,
)
... | No issues found. | assert_allclose(np.diff(depth_arrs, axis=0)[[0, 1, 2, 4, 5, 6]], 0.0, tol=tol)
@pytest.mark.required
def test_point_cloud(show_viewer):
CAMERA_DIST = 8.0
OBJ_OFFSET = 10.0
BOX_HALFSIZE = 1.0
SPHERE_RADIUS = 1.0
scene = gs.Scene(
show_viewer=show_viewer,
show_FPS=False,
)
... | @@ -655,3 +655,20 @@ def test_madrona_batch_rendering(tmp_path, use_rasterizer, render_all_cameras, n
for image_file in sorted(tmp_path.rglob("*.png")):
with open(image_file, "rb") as f:
assert f.read() == png_snapshot
+
+
+@pytest.mark.required
+@pytest.mark.parametrize("backend", [gs.cpu])
... | tests/test_render.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Support 2-channel (LA) textures in Rasterizer. | 1,519 | Genesis-Embodied-AI/Genesis | 26,702 | Python | LeonLiu4 | Review this pull request change.
Language: Python
File: tests/test_render.py
PR Title: [FEATURE] Support 2-channel (LA) textures in Rasterizer.
BEFORE CODE: assert_allclose(np.diff(depth_arrs, axis=0)[[0, 1, 2, 4, 5, 6]], 0.0, tol=tol)
@pytest.mark.required
def test_point_cloud(show_viewer):
CAMERA_DIST =... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
),
)
########################## entities ##########################
plane = scene.add_entity(
gs.morphs.Plane(),
)
franka = scene.add_entity(
gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
visualize_contact=True,
)
########################## camera... | No issues found. | ),
)
########################## entities ##########################
plane = scene.add_entity(
gs.morphs.Plane(),
)
franka = scene.add_entity(
gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
visualize_contact=True,
)
########################## camera... | @@ -15,6 +15,7 @@ def main():
parser.add_argument("-r", "--render_all_cameras", action="store_true", default=False)
parser.add_argument("-o", "--output_dir", type=str, default="img_output/test")
parser.add_argument("-u", "--use_rasterizer", action="store_true", default=False)
+ parser.add_argument("-d... | examples/rigid/single_franka_batch_render.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add debug camera for monitoring. | 1,521 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Kashu7100 | Review this pull request change.
Language: Python
File: examples/rigid/single_franka_batch_render.py
PR Title: [FEATURE] Add debug camera for monitoring.
BEFORE CODE: ),
)
########################## entities ##########################
plane = scene.add_entity(
gs.morphs.Plane(),
)
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
def PIL_to_array(image):
return np.array(image)
def tonemapped(image):
exposure = 0.5
return (np.clip(np.power(image / 255 * np.power(2, exposure), 1 / 2.2), 0, 1) * 255).astype(np.uint8)
def create_texture(image, factor, encoding):
if image is not None:
return gs.textures.ImageTexture(image... | No issues found. | def PIL_to_array(image):
return np.array(image)
def tonemapped(image):
exposure = 0.5
return (np.clip(np.power(image / 255 * np.power(2, exposure), 1 / 2.2), 0, 1) * 255).astype(np.uint8)
def create_texture(image, factor, encoding):
if image is not None:
return gs.textures.ImageTexture(image... | @@ -800,7 +800,7 @@ def create_arrow(
def create_line(start, end, radius=0.002, color=(1.0, 1.0, 1.0, 1.0), sections=12):
vec = end - start
length = np.linalg.norm(vec)
- mesh = create_cylinder(radius, length, sections) # along z-axis
+ mesh = create_cylinder(radius, length, sections, color) # along ... | genesis/utils/mesh.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Correct -Z orientation & vertex color | 1,540 | Genesis-Embodied-AI/Genesis | 26,702 | Python | ceasor-mao | Review this pull request change.
Language: Python
File: genesis/utils/mesh.py
PR Title: [BUG FIX] Correct -Z orientation & vertex color
BEFORE CODE: def PIL_to_array(image):
return np.array(image)
def tonemapped(image):
exposure = 0.5
return (np.clip(np.power(image / 255 * np.power(2, exposure), 1 / ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
If the checkpoint name is not found.
"""
for key in self._tgt_keys:
self._tgt_buffer[key] = list(self._ckpt[ckpt_name]["_tgt_buffer"][key])
def reset_grad(self):
"""
Clear all stored gradient-related buffers.
This resets the target buffer and clears... | No issues found. | If the checkpoint name is not found.
"""
for key in self._tgt_keys:
self._tgt_buffer[key] = list(self._ckpt[ckpt_name]["_tgt_buffer"][key])
def reset_grad(self):
"""
Clear all stored gradient-related buffers.
This resets the target buffer and clears... | @@ -803,8 +803,9 @@ def set_vertex_constraints(
List of environment indices to apply the constraints to. If None, applies to all environments.
"""
if self._solver._use_implicit_solver:
- gs.logger.warning("Ignoring vertex constraint; unsupported with FEM implicit solver.")
... | genesis/engine/entities/fem_entity.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add Fem fixed constraint for implicit solver | 1,562 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Libero0809 | Review this pull request change.
Language: Python
File: genesis/engine/entities/fem_entity.py
PR Title: [FEATURE] Add Fem fixed constraint for implicit solver
BEFORE CODE: If the checkpoint name is not found.
"""
for key in self._tgt_keys:
self._tgt_buffer[key] = list(self._... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if ti.static(static_rigid_sim_config.integrator == gs.integrator.implicitfast):
if (dofs_state.ctrl_mode[i_d, i_b] == gs.CTRL_MODE.POSITION) or (
dofs_state.ctrl_mode[i_d, i_b] == gs.CTRL_MODE.VELOCITY
):
... | No issues found. | if ti.static(static_rigid_sim_config.integrator == gs.integrator.implicitfast):
if (dofs_state.ctrl_mode[i_d, i_b] == gs.CTRL_MODE.POSITION) or (
dofs_state.ctrl_mode[i_d, i_b] == gs.CTRL_MODE.VELOCITY
):
... | @@ -2527,6 +2527,7 @@ def equalities(self):
return gs.List(equality for entity in self._entities for equality in entity.equalities)
+@gs.maybe_pure
@ti.kernel
def kernel_compute_mass_matrix(
# taichi variables
@@ -2560,6 +2561,7 @@ def kernel_compute_mass_matrix(
)
+@gs.maybe_pure
@ti.... | genesis/engine/solvers/rigid/rigid_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add initial experimental support of gstaichi fast cache feature. | 1,631 | Genesis-Embodied-AI/Genesis | 26,702 | Python | hughperkins | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/rigid_solver_decomp.py
PR Title: [FEATURE] Add initial experimental support of gstaichi fast cache feature.
BEFORE CODE: if ti.static(static_rigid_sim_config.integrator == gs.integrator.implicitfast):
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
The name of the motion planning algorithm to use.
Supported planners: 'RRT', 'RRTConnect'. Defaults to 'RRTConnect'.
envs_idx : None | array_like, optional
The indices of the environments to set. If None, all environments will be set. Defaults to None.
return_valid_ma... | No issues found. | The name of the motion planning algorithm to use.
Supported planners: 'RRT', 'RRTConnect'. Defaults to 'RRTConnect'.
envs_idx : None | array_like, optional
The indices of the environments to set. If None, all environments will be set. Defaults to None.
return_valid_ma... | @@ -191,7 +191,7 @@ def _load_primitive(self, morph, surface):
name=f"{link_name_prefix}_baselink",
pos=np.array(morph.pos),
quat=np.array(morph.quat),
- inertial_pos=gu.zero_pos(),
+ inertial_pos=None, # we will compute the COM later bas... | genesis/engine/entities/rigid_entity/rigid_entity.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX, CHANGING] Fix primitive and mesh's COM. Add 'ref' optional argument to 'get_links_pos'. | 1,638 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/engine/entities/rigid_entity/rigid_entity.py
PR Title: [BUG FIX, CHANGING] Fix primitive and mesh's COM. Add 'ref' optional argument to 'get_links_pos'.
BEFORE CODE: The name of the motion planning algorithm to use.
Supported pl... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
camera_pos=(1, 1, 0.5),
camera_lookat=(0.0, 0.0, 0.0),
),
rigid_options=gs.options.RigidOptions(enable_multi_contact=args.enable_multi_contact),
show_viewer=False,
)
plane = scene.add_entity(
gs.morphs.Plane(),
)
cube = scene.add_entity(
gs... | No issues found. | camera_pos=(1, 1, 0.5),
camera_lookat=(0.0, 0.0, 0.0),
),
rigid_options=gs.options.RigidOptions(enable_multi_contact=args.enable_multi_contact),
show_viewer=False,
)
plane = scene.add_entity(
gs.morphs.Plane(),
)
cube = scene.add_entity(
gs... | @@ -0,0 +1,96 @@
+import pathlib
+import pytest
+import subprocess
+import sys
+import os
+
+import argparse
+import genesis as gs
+
+
+def gs_static_child(args: list[str]):
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--enable-multi-contact", action="store_true")
+ parser.add_argument("--expect... | tests/test_fastcache_unified.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Use FIELD_METADATA_CACHE_VALUE for static config | 1,639 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: tests/test_fastcache_unified.py
PR Title: [FEATURE] Use FIELD_METADATA_CACHE_VALUE for static config
BEFORE CODE: camera_pos=(1, 1, 0.5),
camera_lookat=(0.0, 0.0, 0.0),
),
rigid_options=gs.options.RigidOptions(enable_mul... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
return os.path.join(get_cache_dir(), "exr")
def get_usd_cache_dir():
return os.path.join(get_cache_dir(), "usd")
def clean_cache_files():
folder = gs.utils.misc.get_cache_dir()
try:
shutil.rmtree(folder)
except:
pass
os.makedirs(folder)
def assert_gs_tensor(x):
if not i... | No issues found. | return os.path.join(get_cache_dir(), "exr")
def get_usd_cache_dir():
return os.path.join(get_cache_dir(), "usd")
def clean_cache_files():
folder = gs.utils.misc.get_cache_dir()
try:
shutil.rmtree(folder)
except:
pass
os.makedirs(folder)
def assert_gs_tensor(x):
if not i... | @@ -429,7 +429,8 @@ def _launch_kernel(self, t_kernel, compiled_kernel_data, *args):
try:
prog = impl.get_runtime().prog
if compiled_kernel_data is None:
- compiled_kernel_data = prog.compile_kernel(prog.config(), prog.get_device_caps(), t_kernel)
+ compile_result = prog.com... | genesis/utils/misc.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Add test of num envs versus recompilation | 1,655 | Genesis-Embodied-AI/Genesis | 26,702 | Python | hughperkins | Review this pull request change.
Language: Python
File: genesis/utils/misc.py
PR Title: [MISC] Add test of num envs versus recompilation
BEFORE CODE: return os.path.join(get_cache_dir(), "exr")
def get_usd_cache_dir():
return os.path.join(get_cache_dir(), "usd")
def clean_cache_files():
folder = gs.... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
for i_d_ in range(n_dofs):
i_d = entity_dof_end - i_d_ - 1
rigid_global_info.mass_mat_D_inv[i_d, i_b] = 1.0 / rigid_global_info.mass_mat_L[i_d, i_d, i_b]
for j_d_ in range(i_d - entity_dof... | No issues found. | )
for i_d_ in range(n_dofs):
i_d = entity_dof_end - i_d_ - 1
rigid_global_info.mass_mat_D_inv[i_d, i_b] = 1.0 / rigid_global_info.mass_mat_L[i_d, i_d, i_b]
for j_d_ in range(i_d - entity_dof... | @@ -2282,6 +2282,39 @@ def get_mass_mat(self, dofs_idx=None, envs_idx=None, decompose=False, *, unsafe=
def get_geoms_friction(self, geoms_idx=None, *, unsafe=False):
return ti_to_torch(self.geoms_info.friction, geoms_idx, None, unsafe=unsafe)
+ def get_aabb(self, entities_idx=None, envs_idx=None, *,... | genesis/engine/solvers/rigid/rigid_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Batched AABB | 1,658 | Genesis-Embodied-AI/Genesis | 26,702 | Python | LeonLiu4 | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/rigid_solver_decomp.py
PR Title: [FEATURE] Batched AABB
BEFORE CODE: )
for i_d_ in range(n_dofs):
i_d = entity_dof_end - i_d_ - 1
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
for i_d2 in range(n_dofs):
constraint_state.jac[i_con, i_d2, i_b] = gs.ti_float(0.0)
constraint_state.jac[i_con, i_d, i_b] = jac
@ti.func
def func_nt_hessian_incremental(
i_b,
entities_info: array_class.EntitiesInfo,
constraint_st... | No issues found. | for i_d2 in range(n_dofs):
constraint_state.jac[i_con, i_d2, i_b] = gs.ti_float(0.0)
constraint_state.jac[i_con, i_d, i_b] = jac
@ti.func
def func_nt_hessian_incremental(
i_b,
entities_info: array_class.EntitiesInfo,
constraint_st... | @@ -9,6 +9,7 @@
import genesis.utils.geom as gu
import genesis.utils.array_class as array_class
import genesis.engine.solvers.rigid.rigid_solver_decomp as rigid_solver
+import genesis.engine.solvers.rigid.constraint_noslip as constraint_noslip
from genesis.engine.solvers.rigid.contact_island import ContactIsland
... | genesis/engine/solvers/rigid/constraint_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add noslip solver | 1,669 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/constraint_solver_decomp.py
PR Title: [FEATURE] Add noslip solver
BEFORE CODE: for i_d2 in range(n_dofs):
constraint_state.jac[i_con, i_d2, i_b] = gs.ti_float(0.0)
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
@pytest.mark.required
def test_contact_forces(show_viewer, tol):
scene = gs.Scene(
rigid_options=gs.options.RigidOptions(
dt=0.01,
box_box_detection=True,
),
viewer_options=gs.options.ViewerOptions(
camera_pos=(3, -1, 1.5),
camera_lookat=(0.0, ... | No issues found. | @pytest.mark.required
def test_contact_forces(show_viewer, tol):
scene = gs.Scene(
rigid_options=gs.options.RigidOptions(
dt=0.01,
box_box_detection=True,
),
viewer_options=gs.options.ViewerOptions(
camera_pos=(3, -1, 1.5),
camera_lookat=(0.0, ... | @@ -3017,3 +3017,35 @@ def test_batched_aabb(tol):
sphere_aabb_min, sphere_aabb_max = sphere_aabb
assert_allclose(sphere_aabb_min, (-0.55, -0.05, 0.0), atol=tol)
assert_allclose(sphere_aabb_max, (-0.45, 0.05, 0.1), atol=tol)
+
+
+@pytest.mark.required
+@pytest.mark.parametrize("batch_links_info", [False,... | tests/test_rigid_physics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix entity idx to be always int when loading terrain with batch_links_info. | 1,691 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Kashu7100 | Review this pull request change.
Language: Python
File: tests/test_rigid_physics.py
PR Title: [BUG FIX] Fix entity idx to be always int when loading terrain with batch_links_info.
BEFORE CODE: @pytest.mark.required
def test_contact_forces(show_viewer, tol):
scene = gs.Scene(
rigid_options=gs.options.Rig... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
shared_cache : torch.Tensor
The shared cache tensor.
buffered_data : TensorRingBuffer
The buffered data tensor.
cur_jitter_ts : torch.Tensor | None
The current jitter in timesteps (divided by simulation dt) before the sensor data is read.
interpolate :... | No issues found. | shared_cache : torch.Tensor
The shared cache tensor.
buffered_data : TensorRingBuffer
The buffered data tensor.
cur_jitter_ts : torch.Tensor | None
The current jitter in timesteps (divided by simulation dt) before the sensor data is read.
interpolate :... | @@ -1,6 +1,6 @@
-import itertools
from dataclasses import dataclass, field
-from typing import TYPE_CHECKING, Sequence
+from functools import partial
+from typing import TYPE_CHECKING, Sequence, Generic, TypeVar
import gstaichi as ti
import numpy as np
@@ -26,6 +26,20 @@
MaybeTuple3FType = float | Tuple3FType
... | genesis/sensors/base_sensor.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Add tests for adding multiple sensors and envs. | 1,726 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Milotrince | Review this pull request change.
Language: Python
File: genesis/sensors/base_sensor.py
PR Title: [BUG FIX] Add tests for adding multiple sensors and envs.
BEFORE CODE: shared_cache : torch.Tensor
The shared cache tensor.
buffered_data : TensorRingBuffer
The buffered data tens... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
scene.build()
for _ in range(STEPS):
scene.step()
if plotter.run_in_thread:
plotter.sync()
assert call_count == STEPS // 2
assert len(plotter.x_data) == HISTORY_LENGTH
assert np.isclose(plotter.x_data[-1], STEPS * DT, atol=gs.EPS)
assert rgb_array_to_png_bytes(plott... | No issues found. | )
scene.build()
for _ in range(STEPS):
scene.step()
if plotter.run_in_thread:
plotter.sync()
assert call_count == STEPS // 2
assert len(plotter.x_data) == HISTORY_LENGTH
assert np.isclose(plotter.x_data[-1], STEPS * DT, atol=gs.EPS)
assert rgb_array_to_png_bytes(plott... | @@ -143,8 +143,8 @@ def test_file_writers(tmp_path):
rows = list(reader)
assert len(rows) == STEPS + 1 # header + data rows
- assert rows[1][1] == "False" # not in contact initially
- assert rows[-1][1] == "True" # in contact after falling
+ assert rows[1][1] in ("False", "0"... | tests/test_recorders.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] fix single_franka_envs example | 1,743 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: tests/test_recorders.py
PR Title: [BUG FIX] fix single_franka_envs example
BEFORE CODE: )
scene.build()
for _ in range(STEPS):
scene.step()
if plotter.run_in_thread:
plotter.sync()
assert call_count == STEPS // 2
ass... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
visualize_contact=True,
)
scene.build()
cube_weight = scene.rigid_solver._gravity[0][2] * cube.get_mass()
motors_dof = np.arange(7)
fingers_dof = np.arange(7, 9)
qpos = np.array([-1.0124, 1.5559, 1.3662, -1.6878, -1.5799, 1.7757, 1.4602, 0.04, 0.04])
franka.set_qpos(qpos)
scene.... | No issues found. | visualize_contact=True,
)
scene.build()
cube_weight = scene.rigid_solver._gravity[0][2] * cube.get_mass()
motors_dof = np.arange(7)
fingers_dof = np.arange(7, 9)
qpos = np.array([-1.0124, 1.5559, 1.3662, -1.6878, -1.5799, 1.7757, 1.4602, 0.04, 0.04])
franka.set_qpos(qpos)
scene.... | @@ -1999,6 +1999,7 @@ def test_terrain_generation(show_viewer):
)
terrain = scene.add_entity(
morph=gs.morphs.Terrain(
+ pos=(0.0, 0.0, 0.0),
n_subterrains=(2, 2),
subterrain_size=(6.0, 6.0),
horizontal_scale=0.25,
@@ -2021,11 +2022,17 @@ def test_ter... | tests/test_rigid_physics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Randomize uniform terrain along both axes. | 1,747 | Genesis-Embodied-AI/Genesis | 26,702 | Python | jgillick | Review this pull request change.
Language: Python
File: tests/test_rigid_physics.py
PR Title: [BUG FIX] Randomize uniform terrain along both axes.
BEFORE CODE: visualize_contact=True,
)
scene.build()
cube_weight = scene.rigid_solver._gravity[0][2] * cube.get_mass()
motors_dof = np.arange(7)... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if isinstance(value, Sdf.AssetPath):
asset_paths.add(value.resolvedPath)
elif isinstance(value, list):
for v in value:
if isinstance(v, Sdf.AssetPath):
asset_paths.add(v.resolvedPath)
for asset_path in map(Path, ass... | No issues found. | if isinstance(value, Sdf.AssetPath):
asset_paths.add(value.resolvedPath)
elif isinstance(value, list):
for v in value:
if isinstance(v, Sdf.AssetPath):
asset_paths.add(v.resolvedPath)
for asset_path in map(Path, ass... | @@ -38,15 +38,26 @@ def get_input_attribute_value(shader, input_name, input_type=None):
if input_type != "value":
if shader_input.GetPrim().IsValid() and shader_input.HasConnectedSource():
shader_input_connect, shader_input_name = shader_input.GetConnectedSource()[:2]
- return UsdS... | genesis/utils/usda.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Some Bug Fixes for Mesh Related Issues | 1,800 | Genesis-Embodied-AI/Genesis | 26,702 | Python | ACMLCZH | Review this pull request change.
Language: Python
File: genesis/utils/usda.py
PR Title: [MISC] Some Bug Fixes for Mesh Related Issues
BEFORE CODE: if isinstance(value, Sdf.AssetPath):
asset_paths.add(value.resolvedPath)
elif isinstance(value, list):
for v in v... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
rigid_fem=False,
mpm_sph=False,
mpm_pbd=False,
fem_mpm=False,
fem_sph=False,
),
vis_options=gs.options.VisOptions(
segmentation_level=segmentation_level,
),
renderer=renderer,
show_viewer=False,
)
ro... | No issues found. | rigid_fem=False,
mpm_sph=False,
mpm_pbd=False,
fem_mpm=False,
fem_sph=False,
),
vis_options=gs.options.VisOptions(
segmentation_level=segmentation_level,
),
renderer=renderer,
show_viewer=False,
)
ro... | @@ -332,7 +332,7 @@ def test_render_api_advanced(tmp_path, n_envs, show_viewer, png_snapshot, render
)
cam_1 = scene.add_camera(
res=CAM_RES,
- pos=(1.5, -0.5, 1.5),
+ pos=(0.8, -0.5, 0.8),
lookat=(0.0, 0.0, 0.5),
fov=45,
near=0... | tests/test_render.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix camera follow entity. | 1,805 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: tests/test_render.py
PR Title: [BUG FIX] Fix camera follow entity.
BEFORE CODE: rigid_fem=False,
mpm_sph=False,
mpm_pbd=False,
fem_mpm=False,
fem_sph=False,
),
vis_options=gs.options.V... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
franka.control_dofs_position(qpos[:-2], motors_dof)
# hold
for i in range(50):
scene.step()
contact_forces = cube.get_links_net_contact_force()
assert_allclose(contact_forces[0], [0.0, 0.0, -cube_weight], atol=1e-5)
# grasp
for i in range(20):
franka.control_dofs_position(q... | No issues found. | franka.control_dofs_position(qpos[:-2], motors_dof)
# hold
for i in range(50):
scene.step()
contact_forces = cube.get_links_net_contact_force()
assert_allclose(contact_forces[0], [0.0, 0.0, -cube_weight], atol=1e-5)
# grasp
for i in range(20):
franka.control_dofs_position(q... | @@ -2282,6 +2282,15 @@ def _check_entity_positions(relative, tol):
_check_entity_positions(relative=True, tol=2e-3)
+@pytest.mark.required
+def test_mjcf_parsing_with_include():
+ scene = gs.Scene()
+ robot1 = scene.add_entity(gs.morphs.MJCF(file="xml/franka_emika_panda/scene.xml"))
+ robot2 = scene.a... | tests/test_rigid_physics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix loading MJCF file with includes. | 1,838 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: tests/test_rigid_physics.py
PR Title: [BUG FIX] Fix loading MJCF file with includes.
BEFORE CODE: franka.control_dofs_position(qpos[:-2], motors_dof)
# hold
for i in range(50):
scene.step()
contact_forces = cube.get_links_net_contact_f... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
f_max = fov_i / 2.0
f_min = -f_max
n_points_i = math.ceil((f_max - f_min) / res_i) + 1
assert n_points_i is not None
if isinstance(fov_i, Sequence):
f_min, f_max = fov_i
fov_size = f_max - f_min
... | No issues found. | f_max = fov_i / 2.0
f_min = -f_max
n_points_i = math.ceil((f_max - f_min) / res_i) + 1
assert n_points_i is not None
if isinstance(fov_i, Sequence):
f_min, f_max = fov_i
fov_size = f_max - f_min
... | @@ -199,45 +199,30 @@ def compute_ray_dirs(self):
# ============================== Camera Patterns ==============================
-def _compute_focal_lengths(
- width: int, height: int, fov_horizontal: float | None, fov_vertical: float | None
-) -> tuple[float, float]:
- """
- Helper function to compute f... | genesis/sensors/raycaster/patterns.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix DepthCamera sensor. | 1,842 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Milotrince | Review this pull request change.
Language: Python
File: genesis/sensors/raycaster/patterns.py
PR Title: [BUG FIX] Fix DepthCamera sensor.
BEFORE CODE: f_max = fov_i / 2.0
f_min = -f_max
n_points_i = math.ceil((f_max - f_min) / res_i) + 1
assert n_... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
"""
if surface is None:
surface = gs.surfaces.Default()
surface.update_texture()
else:
surface = surface.copy()
mesh = mesh.copy(include_cache=True)
try: # always parse uvs because roughness and normal map also need uvs
uvs = mesh... | No issues found. | """
if surface is None:
surface = gs.surfaces.Default()
surface.update_texture()
else:
surface = surface.copy()
mesh = mesh.copy(include_cache=True)
try: # always parse uvs because roughness and normal map also need uvs
uvs = mesh... | @@ -343,10 +343,21 @@ def from_morph_surface(cls, morph, surface=None):
if morph.is_format(gs.options.morphs.MESH_FORMATS):
meshes = mu.parse_mesh_trimesh(morph.file, morph.group_by_material, morph.scale, surface)
elif morph.is_format(gs.options.morphs.GLTF_FORMATS):
+ ... | genesis/engine/mesh.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Fix gltf Loading for URDF | 1,857 | Genesis-Embodied-AI/Genesis | 26,702 | Python | ACMLCZH | Review this pull request change.
Language: Python
File: genesis/engine/mesh.py
PR Title: [MISC] Fix gltf Loading for URDF
BEFORE CODE: """
if surface is None:
surface = gs.surfaces.Default()
surface.update_texture()
else:
surface = surface.copy()
m... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
box0_input_pos = box0_init_pos
box1_input_pos = box1_init_pos
box0_input_quat = box0_init_quat
box1_input_quat = box1_init_quat
for trial in range(TRIALS):
rand_dx = torch.randn_like(dL_dx)
rand_dx = torch.nn.functional.normalize(rand_dx, dim=-1)
... | No issues found. | box0_input_pos = box0_init_pos
box1_input_pos = box1_init_pos
box0_input_quat = box0_init_quat
box1_input_quat = box1_init_quat
for trial in range(TRIALS):
rand_dx = torch.randn_like(dL_dx)
rand_dx = torch.nn.functional.normalize(rand_dx, dim=-1)
... | @@ -37,12 +37,10 @@ def test_diff_contact(backend):
box_pos_offset = (0.0, 0.0, 0.0) + 0.5 * box_size * vec_one
box0 = scene.add_entity(
- gs.morphs.Box(size=box_size * vec_one, pos=box_pos_offset, fixed=True),
+ gs.morphs.Box(size=box_size * vec_one, pos=box_pos_offset),
)
box1 = sc... | tests/test_grad.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fixed minor bug in differentiable contact detection. | 1,864 | Genesis-Embodied-AI/Genesis | 26,702 | Python | SonSang | Review this pull request change.
Language: Python
File: tests/test_grad.py
PR Title: [BUG FIX] Fixed minor bug in differentiable contact detection.
BEFORE CODE: box0_input_pos = box0_init_pos
box1_input_pos = box1_init_pos
box0_input_quat = box0_init_quat
box1_input_quat = box1_init_... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
self._material.rho,
self._material.stiffness,
self._material.exponent,
self._material.mu,
self._material.gamma,
self._particles,
)
def _reset_grad(self):
pass
def add_grad_from_state(self, state):
"""
Apply... | No issues found. | self._material.rho,
self._material.stiffness,
self._material.exponent,
self._material.mu,
self._material.gamma,
self._particles,
)
def _reset_grad(self):
pass
def add_grad_from_state(self, state):
"""
Apply... | @@ -183,3 +183,11 @@ def get_particles_active(self, envs_idx=None, *, unsafe=False):
if self._scene.n_envs == 0:
actives = actives.squeeze(0)
return actives
+
+ def get_particles_pos(self, envs_idx=None, *, unsafe=False):
+ envs_idx = self._scene._sanitize_envs_idx(envs_idx, uns... | genesis/engine/entities/sph_entity.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Add get_particles_pos to sph | 1,871 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/engine/entities/sph_entity.py
PR Title: [MISC] Add get_particles_pos to sph
BEFORE CODE: self._material.rho,
self._material.stiffness,
self._material.exponent,
self._material.mu,
self._materia... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
return pg.imageToArray(qimage, copy=True, transpose=True)
@register_recording(PyQtLinePlotterOptions)
class PyQtLinePlotter(BasePyQtPlotter):
def build(self):
super().build()
self.line_plot = LinePlotHelper(options=self._options, data=self._data_func())
self.curves: dict[str, lis... | No issues found. | return pg.imageToArray(qimage, copy=True, transpose=True)
@register_recording(PyQtLinePlotterOptions)
class PyQtLinePlotter(BasePyQtPlotter):
def build(self):
super().build()
self.line_plot = LinePlotHelper(options=self._options, data=self._data_func())
self.curves: dict[str, lis... | @@ -444,7 +444,9 @@ def run_in_thread(self) -> bool:
return False
if self._is_built:
assert self.fig is not None
- return isinstance(self.fig.canvas, FigureCanvasAgg)
+ # All Agg-based backends derives from the surfaceless Agg backend, so 'isinstance' cannot be u... | genesis/recorders/plotters.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix sensor recorder Matplotlib plotter on Linux and Windows. | 1,894 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/recorders/plotters.py
PR Title: [BUG FIX] Fix sensor recorder Matplotlib plotter on Linux and Windows.
BEFORE CODE: return pg.imageToArray(qimage, copy=True, transpose=True)
@register_recording(PyQtLinePlotterOptions)
class PyQtLinePlotter(Ba... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Parameters
----------
qpos_goal : array_like
The goal state. [B, Nq] or [1, Nq]
qpos_start : None | array_like, optional
The start state. If None, the current state of the rigid entity will be used.
Defaults to None. [B, Nq] or [1, Nq]
resoluti... | No issues found. | Parameters
----------
qpos_goal : array_like
The goal state. [B, Nq] or [1, Nq]
qpos_start : None | array_like, optional
The start state. If None, the current state of the rigid entity will be used.
Defaults to None. [B, Nq] or [1, Nq]
resoluti... | @@ -2484,6 +2484,26 @@ def get_dofs_damping(self, dofs_idx_local=None, envs_idx=None, *, unsafe=False):
dofs_idx = self._get_idx(dofs_idx_local, self.n_dofs, self._dof_start, unsafe=True)
return self._solver.get_dofs_damping(dofs_idx, envs_idx, unsafe=unsafe)
+ @gs.assert_built
+ def get_dofs_... | genesis/engine/entities/rigid_entity/rigid_entity.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add Rigid ‘get_dofs_frictionloss’ public API method. | 1,904 | Genesis-Embodied-AI/Genesis | 26,702 | Python | ax-anoop | Review this pull request change.
Language: Python
File: genesis/engine/entities/rigid_entity/rigid_entity.py
PR Title: [FEATURE] Add Rigid ‘get_dofs_frictionloss’ public API method.
BEFORE CODE: Parameters
----------
qpos_goal : array_like
The goal state. [B, Nq] or [1, Nq]
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
func_solve(
entities_info=rigid_solver.entities_info,
dofs_state=rigid_solver.dofs_state,
constraint_state=constraint_solver.constraint_state,
rigid_global_info=rigid_solver._rigid_global_info,
static_rigid_sim_config=rigid_solver._static_rig... | No issues found. | )
func_solve(
entities_info=rigid_solver.entities_info,
dofs_state=rigid_solver.dofs_state,
constraint_state=constraint_solver.constraint_state,
rigid_global_info=rigid_solver._rigid_global_info,
static_rigid_sim_config=rigid_solver._static_rig... | @@ -102,6 +102,7 @@ def compute_dL_error(dL_dx, x_type):
box0_input_pos = box0_init_pos + sign * rand_dx[0, 0] * FD_EPS
box1_input_pos = box1_init_pos + sign * rand_dx[1, 0] * FD_EPS
else:
+ # FIXME: The quaternion should be normalized
... | tests/test_grad.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Reduce memory usage due to diff constraint solver. | 1,930 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: tests/test_grad.py
PR Title: [MISC] Reduce memory usage due to diff constraint solver.
BEFORE CODE: )
func_solve(
entities_info=rigid_solver.entities_info,
dofs_state=rigid_solver.dofs_state,
constraint_state... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
class Quat:
v: NDArray[np.float32]
def __init__(self, v: NDArray[np.float32]):
assert v.shape == (4,), f"Quat must be initialized with a 4-element array, got {v.shape}"
assert v.dtype == np.float32, f"Quat must be initialized with a float32 array, got {v.dtype}"
self.v = v
def get_... | No issues found. |
class Quat:
v: NDArray[np.float32]
def __init__(self, v: NDArray[np.float32]):
assert v.shape == (4,), f"Quat must be initialized with a 4-element array, got {v.shape}"
assert v.dtype == np.float32, f"Quat must be initialized with a float32 array, got {v.dtype}"
self.v = v
def get_... | @@ -62,7 +62,7 @@ def __repr__(self) -> str:
return f"Vec3({self.v[0]}, {self.v[1]}, {self.v[2]})"
def as_tensor(self) -> torch.Tensor:
- return torch.tensor(self.v, dtype=gs.tc_float)
+ return torch.tensor(self.v)
@property
def x(self) -> float:
@@ -155,7 +155,7 @@ def __repr_... | genesis/ext/pyrender/interaction/vec3.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix interactive viewer 'Vec3'. | 1,931 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/ext/pyrender/interaction/vec3.py
PR Title: [BUG FIX] Fix interactive viewer 'Vec3'.
BEFORE CODE:
class Quat:
v: NDArray[np.float32]
def __init__(self, v: NDArray[np.float32]):
assert v.shape == (4,), f"Quat must be initialized with a 4... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
):
if (
ti.abs(pos - self.pbd_solver.particles_reordered.pos[i, i_b]).max()
< self.mpm_solver.dx * 0.5
):
if self.pbd_so... | No issues found. | ):
if (
ti.abs(pos - self.pbd_solver.particles_reordered.pos[i, i_b]).max()
< self.mpm_solver.dx * 0.5
):
if self.pbd_so... | @@ -330,7 +330,7 @@ def _func_collide_in_rigid_geom(
# Compute delta momentum and apply to rigid body.
delta_mv = mass * (vel - vel_old)
force = -delta_mv / rigid_global_info.substep_dt[None]
- self.rigid_solver._func_apply_external_force(
+ self.rigid_solver... | genesis/engine/couplers/legacy_coupler.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [CHANGING][BUG FIX] Fix external coupling forces from other solvers not affecting rigid bodies. | 1,941 | Genesis-Embodied-AI/Genesis | 26,702 | Python | SonSang | Review this pull request change.
Language: Python
File: genesis/engine/couplers/legacy_coupler.py
PR Title: [CHANGING][BUG FIX] Fix external coupling forces from other solvers not affecting rigid bodies.
BEFORE CODE: ):
if (
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
franka = scene.add_entity(
gs.morphs.MJCF(
file="xml/franka_emika_panda/panda.xml",
),
)
########################## build ##########################
scene.build()
joints_name = (
"joint1",
"joint2",
"joint3",
"joint4",
"joint5",
... | No issues found. | franka = scene.add_entity(
gs.morphs.MJCF(
file="xml/franka_emika_panda/panda.xml",
),
)
########################## build ##########################
scene.build()
joints_name = (
"joint1",
"joint2",
"joint3",
"joint4",
"joint5",
... | @@ -0,0 +1,129 @@
+# This example compares the position control accuracy between 'control_dofs_position' and
+# 'control_dofs_position_velocity' when tracking a dynamic trajectory.
+# While both are equivalent in static, the former lacks the target velocity term of true PD controller in robotics,
+# making it underper... | examples/tutorials/position_control_comparison.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Implement position-velocity controller. | 1,948 | Genesis-Embodied-AI/Genesis | 26,702 | Python | matthieuvigne | Review this pull request change.
Language: Python
File: examples/tutorials/position_control_comparison.py
PR Title: [FEATURE] Implement position-velocity controller.
BEFORE CODE: franka = scene.add_entity(
gs.morphs.MJCF(
file="xml/franka_emika_panda/panda.xml",
),
)
########... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
bool_sensor_box = scene.add_sensor(
gs.sensors.Contact(
entity_idx=box.idx,
)
)
force_sensor = scene.add_sensor(
gs.sensors.ContactForce(
entity_idx=box.idx,
)
)
force_sensor_noisy = scene.add_sensor(
gs.sensors.ContactForce(
... | No issues found. | )
bool_sensor_box = scene.add_sensor(
gs.sensors.Contact(
entity_idx=box.idx,
)
)
force_sensor = scene.add_sensor(
gs.sensors.ContactForce(
entity_idx=box.idx,
)
)
force_sensor_noisy = scene.add_sensor(
gs.sensors.ContactForce(
... | @@ -3,6 +3,7 @@
import torch
import genesis as gs
+import genesis.utils.geom as gu
from .utils import assert_allclose, assert_array_equal
@@ -42,11 +43,9 @@ def test_imu_sensor(show_viewer, tol, n_envs):
),
)
- imu_biased = scene.add_sensor(
+ imu = scene.add_sensor(
gs.sensors.I... | tests/test_sensors.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix sensor IMU accelerometer signal. | 1,962 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Milotrince | Review this pull request change.
Language: Python
File: tests/test_sensors.py
PR Title: [BUG FIX] Fix sensor IMU accelerometer signal.
BEFORE CODE: )
bool_sensor_box = scene.add_sensor(
gs.sensors.Contact(
entity_idx=box.idx,
)
)
force_sensor = scene.add_sensor(
g... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
EPS = rigid_global_info.EPS[None]
n_dofs = constraint_state.nt_H.shape[0]
rank = n_dofs
updated = False
for i_c in range(constraint_state.n_constraints[i_b]):
if not updated:
flag_update = -1
# add quad
if constraint_state.prev_active[i_c, i_b] == 0 and ... | No issues found. | EPS = rigid_global_info.EPS[None]
n_dofs = constraint_state.nt_H.shape[0]
rank = n_dofs
updated = False
for i_c in range(constraint_state.n_constraints[i_b]):
if not updated:
flag_update = -1
# add quad
if constraint_state.prev_active[i_c, i_b] == 0 and ... | @@ -1067,7 +1067,11 @@ def add_frictionloss_constraints(
n_dofs = dofs_state.ctrl_mode.shape[0]
# TODO: sparse mode
- ti.loop_config(serialize=ti.static(static_rigid_sim_config.para_level < gs.PARA_LEVEL.ALL))
+ # FIXME: The condition `if dofs_info.frictionloss[I_d] > EPS:` is not correctly evaluated ... | genesis/engine/solvers/rigid/constraint_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Enable back GsTaichi dynamic array mode by default except for MacOS. | 1,977 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/constraint_solver_decomp.py
PR Title: [MISC] Enable back GsTaichi dynamic array mode by default except for MacOS.
BEFORE CODE: EPS = rigid_global_info.EPS[None]
n_dofs = constraint_state.nt_H.shape[0]
rank = n_dofs
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
for step in range(801):
ee_pos = scene.rigid_solver.get_links_pos([end_effector_link_idx])[0]
if step == 0:
assert_allclose(ee_pos, [0.8, 0.0, 0.02], tol=tol)
elif step == 600:
assert_allclose(ee_pos, [0.0, 0.0, 0.82], tol=tol)
elif step == 800:
as... | No issues found. | for step in range(801):
ee_pos = scene.rigid_solver.get_links_pos([end_effector_link_idx])[0]
if step == 0:
assert_allclose(ee_pos, [0.8, 0.0, 0.02], tol=tol)
elif step == 600:
assert_allclose(ee_pos, [0.0, 0.0, 0.82], tol=tol)
elif step == 800:
as... | @@ -1756,8 +1756,8 @@ def test_set_dofs_frictionloss_physics(gs_sim, tol):
def test_frictionloss_advanced(show_viewer, tol):
scene = gs.Scene(
viewer_options=gs.options.ViewerOptions(
- camera_pos=(1.0, 0.25, 0.75),
- camera_lookat=(0.0, 0.0, 0.0),
+ camera_pos=(1.4, 0.7,... | tests/test_rigid_physics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Only enable GJK by default if gradient computation is required. | 1,984 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: tests/test_rigid_physics.py
PR Title: [MISC] Only enable GJK by default if gradient computation is required.
BEFORE CODE: for step in range(801):
ee_pos = scene.rigid_solver.get_links_pos([end_effector_link_idx])[0]
if step == 0:
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
"""
try:
try_get_display_size()
return True
except Exception:
return False
# -------------------------------------- TAICHI SPECIALIZATION --------------------------------------
ALLOCATE_TENSOR_WARNING = (
"Tensor had to be re-allocated because of incorrect dtype/device or non-... | No issues found. | """
try:
try_get_display_size()
return True
except Exception:
return False
# -------------------------------------- TAICHI SPECIALIZATION --------------------------------------
ALLOCATE_TENSOR_WARNING = (
"Tensor had to be re-allocated because of incorrect dtype/device or non-... | @@ -1,6 +1,7 @@
import ctypes
import datetime
import functools
+import io
import logging
import math
import numbers
@@ -59,11 +60,13 @@ def __init__(self, fd):
self.stderr_fileno = None
self.original_stderr_fileno = None
- # --------------------------------------------------
- # Enter: d... | genesis/utils/misc.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Leverage GsTaichi zero-copy in data accessors. | 2,011 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/utils/misc.py
PR Title: [FEATURE] Leverage GsTaichi zero-copy in data accessors.
BEFORE CODE: """
try:
try_get_display_size()
return True
except Exception:
return False
# -------------------------------------- TAIC... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
def trans_quat_to_T(trans=None, quat=None, *, out=None):
is_torch = all(isinstance(e, torch.Tensor) for e in (trans, quat) if e is not None)
is_numpy = not is_torch and all(isinstance(e, np.ndarray) for e in (trans, quat) if e is not None)
T = out
B = () if trans is None and quat is None else quat.sh... | No issues found. |
def trans_quat_to_T(trans=None, quat=None, *, out=None):
is_torch = all(isinstance(e, torch.Tensor) for e in (trans, quat) if e is not None)
is_numpy = not is_torch and all(isinstance(e, np.ndarray) for e in (trans, quat) if e is not None)
T = out
B = () if trans is None and quat is None else quat.sh... | @@ -429,7 +429,7 @@ def inv_T(T):
def normalize(x, eps: float = 1e-12):
if isinstance(x, torch.Tensor):
- return x / x.norm(p=2, dim=-1).clamp(min=eps, max=None).unsqueeze(-1)
+ return x / torch.linalg.vector_norm(x, ord=2, dim=-1, keepdim=True).clamp(min=eps, max=None)
elif isinstance(x, np.... | genesis/utils/geom.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add support of boolean masking as index. | 2,087 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/utils/geom.py
PR Title: [FEATURE] Add support of boolean masking as index.
BEFORE CODE:
def trans_quat_to_T(trans=None, quat=None, *, out=None):
is_torch = all(isinstance(e, torch.Tensor) for e in (trans, quat) if e is not None)
is_numpy = no... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
ti.loop_config(serialize=static_rigid_sim_config.para_level < gs.PARA_LEVEL.PARTIAL)
for i_c, i_b in ti.ndrange(collider_state.contact_data.pos.shape[0], collider_state.active_buffer.shape[1]):
if i_c < collider_state.n_contacts[i_b]:
ref_id = collider_state.diff_contact_input.ref_id[i_b, i_... | No issues found. | ti.loop_config(serialize=static_rigid_sim_config.para_level < gs.PARA_LEVEL.PARTIAL)
for i_c, i_b in ti.ndrange(collider_state.contact_data.pos.shape[0], collider_state.active_buffer.shape[1]):
if i_c < collider_state.n_contacts[i_b]:
ref_id = collider_state.diff_contact_input.ref_id[i_b, i_... | @@ -259,7 +259,7 @@ def _compute_collision_pair_idx(self):
continue
collision_pair_idx[i_ga, i_gb] = n_possible_pairs
- n_possible_pairs += 1
+ n_possible_pairs = n_possible_pairs + 1
return n_possible_pairs, collision_pair_idx
@@ -275,7... | genesis/engine/solvers/rigid/collider_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Remove augmented assignment in rigid solver. | 2,135 | Genesis-Embodied-AI/Genesis | 26,702 | Python | hughperkins | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/collider_decomp.py
PR Title: [MISC] Remove augmented assignment in rigid solver.
BEFORE CODE: ti.loop_config(serialize=static_rigid_sim_config.para_level < gs.PARA_LEVEL.PARTIAL)
for i_c, i_b in ti.ndrange(collider_state.co... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
mj_integrator = mujoco.mjtIntegrator.mjINT_EULER
elif gs_integrator == gs.integrator.implicitfast:
mj_integrator = mujoco.mjtIntegrator.mjINT_IMPLICITFAST
else:
raise ValueError(f"Integrator '{gs_integrator}' not supported")
xml_path = os.path.join(get_assets_dir(), xml_path)
mo... | No issues found. | mj_integrator = mujoco.mjtIntegrator.mjINT_EULER
elif gs_integrator == gs.integrator.implicitfast:
mj_integrator = mujoco.mjtIntegrator.mjINT_IMPLICITFAST
else:
raise ValueError(f"Integrator '{gs_integrator}' not supported")
xml_path = os.path.join(get_assets_dir(), xml_path)
mo... | @@ -35,7 +35,7 @@
DEFAULT_BRANCH_NAME = "main"
HUGGINGFACE_ASSETS_REVISION = "701f78c1465f0a98f6540bae6c9daacaa551b7bf"
-HUGGINGFACE_SNAPSHOT_REVISION = "0384a6dfc3994521fa0a56f9a15e7845a69bfbd0"
+HUGGINGFACE_SNAPSHOT_REVISION = "ea6ae70386c2b2fbae1387f93ba0e4de1ed7abf7"
MESH_EXTENSIONS = (".mtl", *MESH_FORMATS,... | tests/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [Feature] Support Fisheye BatchCamera. | 2,138 | Genesis-Embodied-AI/Genesis | 26,702 | Python | ACMLCZH | Review this pull request change.
Language: Python
File: tests/utils.py
PR Title: [Feature] Support Fisheye BatchCamera.
BEFORE CODE: mj_integrator = mujoco.mjtIntegrator.mjINT_EULER
elif gs_integrator == gs.integrator.implicitfast:
mj_integrator = mujoco.mjtIntegrator.mjINT_IMPLICITFAST
else... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
gs.raise_exception("Link has no collision geometries.")
verts = self.get_verts()
return torch.stack((verts.min(dim=-2).values, verts.max(dim=-2).values), dim=-2)
@gs.assert_built
def get_vAABB(self, envs_idx=None):
"""
Get the axis-aligned bounding box (AABB) of the ... | No issues found. | gs.raise_exception("Link has no collision geometries.")
verts = self.get_verts()
return torch.stack((verts.min(dim=-2).values, verts.max(dim=-2).values), dim=-2)
@gs.assert_built
def get_vAABB(self, envs_idx=None):
"""
Get the axis-aligned bounding box (AABB) of the ... | @@ -9,9 +9,9 @@
from genesis.utils import geom as gu
from genesis.utils.urdf import compose_inertial_properties, rotate_inertia
-from genesis.utils.misc import DeprecationError, tensor_to_array
+from genesis.utils.misc import tensor_to_array, ti_to_torch, DeprecationError
-from .rigid_geom import RigidGeom, Rigid... | genesis/engine/entities/rigid_entity/rigid_link.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add method to compute axis-aligned bounding boxes of visual geometries. | 2,185 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/engine/entities/rigid_entity/rigid_link.py
PR Title: [FEATURE] Add method to compute axis-aligned bounding boxes of visual geometries.
BEFORE CODE: gs.raise_exception("Link has no collision geometries.")
verts = self.get_verts()
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import torch
import genesis as gs
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--vis", action="store_true", default=False)
parser.add_argument("-c", "--cpu", action="store_true", default=False)
args = parser.parse_args()
gs.init(backend=gs.cpu if args.cpu else gs.gp... | No issues found. |
import torch
import genesis as gs
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--vis", action="store_true", default=False)
parser.add_argument("-c", "--cpu", action="store_true", default=False)
args = parser.parse_args()
gs.init(backend=gs.cpu if args.cpu else gs.gp... | @@ -0,0 +1,65 @@
+"""
+MPM to Rigid Link Attachment
+
+Demonstrates attaching MPM particles to rigid links using soft constraints.
+"""
+
+import argparse
+import os
+
+import torch
+
+import genesis as gs
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-v", "--vis", action="store_tru... | examples/coupling/rigid_mpm_attachment.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Adds support for attaching MPM particles to rigid links. | 2,205 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: examples/coupling/rigid_mpm_attachment.py
PR Title: [FEATURE] Adds support for attaching MPM particles to rigid links.
BEFORE CODE:
import torch
import genesis as gs
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--vis", ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
self._raytracer.update_scene(force_render)
rgb_arr = self._raytracer.render_camera(self)
if depth or segmentation or normal:
self._rasterizer.update_scene(force_render)
_, depth_arr, seg_idxc_arr, normal_arr = self._rasterizer.render_camera(
... | No issues found. | self._raytracer.update_scene(force_render)
rgb_arr = self._raytracer.render_camera(self)
if depth or segmentation or normal:
self._rasterizer.update_scene(force_render)
_, depth_arr, seg_idxc_arr, normal_arr = self._rasterizer.render_camera(
... | @@ -156,7 +156,7 @@ def build(self):
self._raytracer.add_camera(self)
else:
self._is_batched = False
- if self._visualizer.scene.n_envs > 0 and self._visualizer._context.env_separate_rigid:
+ if self._visualizer.scene.n_envs > 1 and self._visu... | genesis/vis/camera.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Enabling rasterizer camera sensor to work with n_envs > 1. | 2,207 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Narsil | Review this pull request change.
Language: Python
File: genesis/vis/camera.py
PR Title: [FEATURE] Enabling rasterizer camera sensor to work with n_envs > 1.
BEFORE CODE: self._raytracer.update_scene(force_render)
rgb_arr = self._raytracer.render_camera(self)
if depth or ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if tf & TexFlags.NORMAL:
self._bind_texture(material.normalTexture, "material.normal_texture", program)
if tf & TexFlags.OCCLUSION:
self._bind_texture(material.occlusionTexture, "material.occlusion_texture", program)
if tf & TexFlags.EMISSIVE:
... | No issues found. | if tf & TexFlags.NORMAL:
self._bind_texture(material.normalTexture, "material.normal_texture", program)
if tf & TexFlags.OCCLUSION:
self._bind_texture(material.occlusionTexture, "material.occlusion_texture", program)
if tf & TexFlags.EMISSIVE:
... | @@ -354,9 +354,9 @@ def _floor_pass(self, scene, flags, seg_node_map=None, env_idx=-1):
glClearColor(0.0, 0.0, 0.0, 1.0)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
- V, P = self._get_camera_matrices(scene)
+ V, P = self._get_camera_matrices(scene, env_idx)
+ cam_pose = s... | genesis/ext/pyrender/renderer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Support attaching camera sensors with Rasterizer batched rendering. | 2,212 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Narsil | Review this pull request change.
Language: Python
File: genesis/ext/pyrender/renderer.py
PR Title: [FEATURE] Support attaching camera sensors with Rasterizer batched rendering.
BEFORE CODE: if tf & TexFlags.NORMAL:
self._bind_texture(material.normalTexture, "material.normal_texture", pro... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if self._run_in_thread:
self._offscreen_semaphore.release()
def on_draw(self):
"""Redraw the scene into the viewing window."""
if self._renderer is None:
return
with self.render_lock if self._run_in_thread or not self.auto_start else nullcontext():
... | No issues found. |
if self._run_in_thread:
self._offscreen_semaphore.release()
def on_draw(self):
"""Redraw the scene into the viewing window."""
if self._renderer is None:
return
with self.render_lock if self._run_in_thread or not self.auto_start else nullcontext():
... | @@ -49,7 +49,7 @@
from .light import DirectionalLight
from .node import Node
from .renderer import Renderer
-from .shader_program import ShaderProgram, ShaderProgramCache
+from .shader_program import ShaderProgram
from .trackball import Trackball
if TYPE_CHECKING:
@@ -410,7 +410,7 @@ def __init__(
s... | genesis/ext/pyrender/viewer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Re-enable more Ruff format rules. | 2,215 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Narsil | Review this pull request change.
Language: Python
File: genesis/ext/pyrender/viewer.py
PR Title: [MISC] Re-enable more Ruff format rules.
BEFORE CODE:
if self._run_in_thread:
self._offscreen_semaphore.release()
def on_draw(self):
"""Redraw the scene into the viewing window.... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
def save_ckpt(self, ckpt_name):
if ckpt_name not in self._ckpt:
self._ckpt[ckpt_name] = {}
self._ckpt[ckpt_name]["_tgt_buffer"] = self._tgt_buffer.copy()
self._tgt_buffer.clear()
def load_ckpt(self, ckpt_name):
self._tgt_buffer = self._ckpt[ckpt_name]["_tgt_buffer"].... | No issues found. | def save_ckpt(self, ckpt_name):
if ckpt_name not in self._ckpt:
self._ckpt[ckpt_name] = {}
self._ckpt[ckpt_name]["_tgt_buffer"] = self._tgt_buffer.copy()
self._tgt_buffer.clear()
def load_ckpt(self, ckpt_name):
self._tgt_buffer = self._ckpt[ckpt_name]["_tgt_buffer"].... | @@ -1,8 +1,8 @@
+import inspect
from copy import copy
from itertools import chain
-from typing import TYPE_CHECKING, Literal
+from typing import TYPE_CHECKING, Literal, Any
from functools import wraps
-import inspect
import gstaichi as ti
import numpy as np
@@ -164,34 +164,38 @@ def _load_primitive(self, morph, ... | genesis/engine/entities/rigid_entity/rigid_entity.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Store texture path for primitive morphs as metadata. | 2,227 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Rush2k | Review this pull request change.
Language: Python
File: genesis/engine/entities/rigid_entity/rigid_entity.py
PR Title: [MISC] Store texture path for primitive morphs as metadata.
BEFORE CODE: def save_ckpt(self, ckpt_name):
if ckpt_name not in self._ckpt:
self._ckpt[ckpt_name] = {}
s... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
* constraint_state.jac[i_c, i_d1, i_b]
* constraint_state.efc_D[i_c, i_b]
* constraint_state.active[i_c, i_b]
)
else:
for i_d1, i_c in ti.ndrange(n_dofs, constraint_state.n_constraints[i_b]):
... | No issues found. | * constraint_state.jac[i_c, i_d1, i_b]
* constraint_state.efc_D[i_c, i_b]
* constraint_state.active[i_c, i_b]
)
else:
for i_d1, i_c in ti.ndrange(n_dofs, constraint_state.n_constraints[i_b]):
... | @@ -140,6 +140,7 @@ def clear(self, envs_idx=None):
constraint_solver_kernel_clear(
envs_idx,
self.constraint_state,
+ self._solver._rigid_global_info,
self._solver._static_rigid_sim_config,
)
@@ -405,6 +406,7 @@ def constraint_solver_kernel_reset(
... | genesis/engine/solvers/rigid/constraint_solver_decomp.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Clear dynamic weld at scene reset. | 2,233 | Genesis-Embodied-AI/Genesis | 26,702 | Python | YilingQiao | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/constraint_solver_decomp.py
PR Title: [BUG FIX] Clear dynamic weld at scene reset.
BEFORE CODE: * constraint_state.jac[i_c, i_d1, i_b]
* constraint_state.efc_D[i_c, i_b]
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
usd_file = os.path.join(asset_path, usd_file)
gs_usd_meshes = usda_utils.parse_mesh_usd(
usd_file,
group_by_material=True,
scale=1.0,
surface=gs.surfaces.Default(),
)
texture0 = gs_usd_meshes[0].surface.diffuse_texture
texture1 = gs_usd_meshes[1].surface.diffuse_textu... | No issues found. | usd_file = os.path.join(asset_path, usd_file)
gs_usd_meshes = usda_utils.parse_mesh_usd(
usd_file,
group_by_material=True,
scale=1.0,
surface=gs.surfaces.Default(),
)
texture0 = gs_usd_meshes[0].surface.diffuse_texture
texture1 = gs_usd_meshes[1].surface.diffuse_textu... | @@ -1,6 +1,7 @@
import os
import platform
import sys
+from contextlib import nullcontext
import numpy as np
import pytest
@@ -350,55 +351,111 @@ def test_usd_bake(usd_file, show_viewer):
show_viewer=show_viewer,
show_FPS=False,
)
- robot = scene.add_entity(
+ scene.add_entity(
... | tests/test_mesh.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BREAKING][FEATURE] Improve import of y-up vs z-up file meshes. | 2,237 | Genesis-Embodied-AI/Genesis | 26,702 | Python | AnisB | Review this pull request change.
Language: Python
File: tests/test_mesh.py
PR Title: [BREAKING][FEATURE] Improve import of y-up vs z-up file meshes.
BEFORE CODE: usd_file = os.path.join(asset_path, usd_file)
gs_usd_meshes = usda_utils.parse_mesh_usd(
usd_file,
group_by_material=True,
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
try:
positions = trimesh_to_particles_pbs(mesh, p_size, sampler, pos=pos)
except gs.GenesisException:
sampler = "random"
if sampler in ("random", "regular"):
positions = _box_to_particles(
p_size=p_size,
pos=pos,
size=size,
... | No issues found. | try:
positions = trimesh_to_particles_pbs(mesh, p_size, sampler, pos=pos)
except gs.GenesisException:
sampler = "random"
if sampler in ("random", "regular"):
positions = _box_to_particles(
p_size=p_size,
pos=pos,
size=size,
... | @@ -62,7 +62,7 @@ def trimesh_to_particles_simple(mesh, p_size, sampler):
with open(ptc_file_path, "rb") as file:
positions = pkl.load(file)
is_cached_loaded = True
- except (EOFError, ModuleNotFoundError, pkl.UnpicklingError):
+ except (EOFError, ModuleNotFoundE... | genesis/utils/particle.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] More robust handling of corrupted cache. | 2,241 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/utils/particle.py
PR Title: [BUG FIX] More robust handling of corrupted cache.
BEFORE CODE: try:
positions = trimesh_to_particles_pbs(mesh, p_size, sampler, pos=pos)
except gs.GenesisException:
sampler = "random"... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
),
((gu.ti_rotvec_to_quat, gu.ti_quat_to_rotvec), ([3], [4]), ((gs.EPS,), (gs.EPS,))),
):
ti_args = []
for shape_arg in (*shape_args, shape_args[0]):
ti_type = ti.Vector if len(shape_arg) == 1 else ti.Matrix
ti_arg = ti_type.field(*shape_arg, dtype=gs.ti_float... | No issues found. | ),
((gu.ti_rotvec_to_quat, gu.ti_quat_to_rotvec), ([3], [4]), ((gs.EPS,), (gs.EPS,))),
):
ti_args = []
for shape_arg in (*shape_args, shape_args[0]):
ti_type = ti.Vector if len(shape_arg) == 1 else ti.Matrix
ti_arg = ti_type.field(*shape_arg, dtype=gs.ti_float... | @@ -5,6 +5,8 @@
import pytest
import torch
import numpy as np
+from scipy.linalg import polar as scipy_polar
+from scipy.spatial.transform import Rotation as R, Slerp
import genesis as gs
import genesis.utils.geom as gu
@@ -15,7 +17,6 @@
from genesis.utils.urdf import compose_inertial_properties
from .utils ... | tests/test_utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Improve performance and add torch support to 'utils.geom.slerp'. | 2,260 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Kashu7100 | Review this pull request change.
Language: Python
File: tests/test_utils.py
PR Title: [FEATURE] Improve performance and add torch support to 'utils.geom.slerp'.
BEFORE CODE: ),
((gu.ti_rotvec_to_quat, gu.ti_quat_to_rotvec), ([3], [4]), ((gs.EPS,), (gs.EPS,))),
):
ti_args = []
for... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Parameters
----------
min_force : float | tuple[float, float, float], optional
The minimum detectable absolute force per each axis. Values below this will be treated as 0. Default is 0.
max_force : float | tuple[float, float, float], optional
The maximum output absolute force per each a... | No issues found. |
Parameters
----------
min_force : float | tuple[float, float, float], optional
The minimum detectable absolute force per each axis. Values below this will be treated as 0. Default is 0.
max_force : float | tuple[float, float, float], optional
The maximum output absolute force per each a... | @@ -214,6 +214,17 @@ class IMU(RigidSensorOptionsMixin, NoisySensorOptionsMixin, SensorOptions):
The standard deviation of the white noise for each axis of the gyroscope.
gyro_random_walk : tuple[float, float, float]
The standard deviation of the bias drift for each axis of the gyroscope.
+ ma... | genesis/options/sensors/options.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Add Magnetometer measurement to IMU Sensor. | 2,265 | Genesis-Embodied-AI/Genesis | 26,702 | Python | sunkmechie | Review this pull request change.
Language: Python
File: genesis/options/sensors/options.py
PR Title: [FEATURE] Add Magnetometer measurement to IMU Sensor.
BEFORE CODE:
Parameters
----------
min_force : float | tuple[float, float, float], optional
The minimum detectable absolute force per each a... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
scene.step()
assert bool_sensor_floor.read().all(), "ContactSensor for floor should detect contact with the ground"
assert not bool_sensor_box_2.read().any(), "ContactSensor for box_2 should not detect any contact yet."
assert_allclose(force_sensor_noisy.read(), force_sensor_noisy.read(), tol=gs.EP... | No issues found. | scene.step()
assert bool_sensor_floor.read().all(), "ContactSensor for floor should detect contact with the ground"
assert not bool_sensor_box_2.read().any(), "ContactSensor for box_2 should not detect any contact yet."
assert_allclose(force_sensor_noisy.read(), force_sensor_noisy.read(), tol=gs.EP... | @@ -476,6 +476,78 @@ def test_raycaster_hits(show_viewer, n_envs):
assert_allclose(grid_distances, grid_distances_ref, tol=1e-3)
+@pytest.mark.required
+def test_lidar_bvh_parallel_env(show_viewer, tol):
+ """Verify each environment receives a different lidar distance when geometries differ."""
+ scene =... | tests/test_sensors.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix BVH morton code indexing for multi-env raycasting. | 2,269 | Genesis-Embodied-AI/Genesis | 26,702 | Python | d-corsi | Review this pull request change.
Language: Python
File: tests/test_sensors.py
PR Title: [BUG FIX] Fix BVH morton code indexing for multi-env raycasting.
BEFORE CODE: scene.step()
assert bool_sensor_floor.read().all(), "ContactSensor for floor should detect contact with the ground"
assert not bool_s... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
asset_path = get_hf_dataset(pattern=usd_file)
usd_file = os.path.join(asset_path, usd_file)
gs_usd_meshes = usda_utils.parse_mesh_usd(
usd_file,
group_by_material=True,
scale=1.0,
surface=gs.surfaces.Default(),
)
texture0 = gs_usd_meshes[0].surface.diffuse_texture
... | No issues found. | asset_path = get_hf_dataset(pattern=usd_file)
usd_file = os.path.join(asset_path, usd_file)
gs_usd_meshes = usda_utils.parse_mesh_usd(
usd_file,
group_by_material=True,
scale=1.0,
surface=gs.surfaces.Default(),
)
texture0 = gs_usd_meshes[0].surface.diffuse_texture
... | @@ -6,8 +6,9 @@
import trimesh
import genesis as gs
+import genesis.utils.geom as gu
import genesis.utils.gltf as gltf_utils
-import genesis.utils.mesh as mesh_utils
+import genesis.utils.mesh as mu
from .utils import assert_allclose, assert_array_equal, get_hf_dataset
@@ -420,7 +421,7 @@ def test_obj_morphes... | tests/test_mesh.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BREAKING][BUG FIX] Do not officially support importing GLTF morph Mesh as Z-UP. | 2,279 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: tests/test_mesh.py
PR Title: [BREAKING][BUG FIX] Do not officially support importing GLTF morph Mesh as Z-UP.
BEFORE CODE: asset_path = get_hf_dataset(pattern=usd_file)
usd_file = os.path.join(asset_path, usd_file)
gs_usd_meshes = usda_utils.parse_... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import pytest
import genesis as gs
@pytest.mark.required
def test_scene_destroy_cleans_up_simulator():
scene = gs.Scene(show_viewer=False)
scene.add_entity(morph=gs.morphs.Plane())
scene.build()
scene.step()
assert scene._sim is not None
scene.destroy()
assert scene._sim is None
as... | No issues found. | import pytest
import genesis as gs
@pytest.mark.required
def test_scene_destroy_cleans_up_simulator():
scene = gs.Scene(show_viewer=False)
scene.add_entity(morph=gs.morphs.Plane())
scene.build()
scene.step()
assert scene._sim is not None
scene.destroy()
assert scene._sim is None
as... | @@ -0,0 +1,32 @@
+import pytest
+
+import genesis as gs
+
+
+@pytest.mark.required
+def test_scene_destroy_cleans_up_simulator():
+ scene = gs.Scene(show_viewer=False)
+ scene.add_entity(morph=gs.morphs.Plane())
+ scene.build()
+ scene.step()
+
+ assert scene._sim is not None
+
+ scene.destroy()
+
+ ... | tests/test_scene_destroy.py | 0 | Python | 1 | none | 16 | 33 | 33 | true | [BUG FIX] Clean up offscreen renderer when scene is destroyed. | 2,282 | Genesis-Embodied-AI/Genesis | 26,702 | Python | nimrod-gileadi | Review this pull request change.
Language: Python
File: tests/test_scene_destroy.py
PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed.
BEFORE CODE: import pytest
import genesis as gs
@pytest.mark.required
def test_scene_destroy_cleans_up_simulator():
scene = gs.Scene(show_viewer=False)
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
self.particles_reordered[i_p, i_b].drho = drho
@ti.func
def _task_divergence_solver_iteration(self, i, j, ret: ti.template(), i_b):
# Fluid neighbors
b_j = self.particles_reordered[j, i_b].drho
k_j = b_j * self.particles_reordered[j, i_b].dfsph_factor
k_sum = (
... | No issues found. | self.particles_reordered[i_p, i_b].drho = drho
@ti.func
def _task_divergence_solver_iteration(self, i, j, ret: ti.template(), i_b):
# Fluid neighbors
b_j = self.particles_reordered[j, i_b].drho
k_j = b_j * self.particles_reordered[j, i_b].dfsph_factor
k_sum = (
... | @@ -399,7 +399,7 @@ def _kernel_compute_DFSPH_factor(self, f: ti.i32):
ret = ti.Vector.zero(gs.ti_float, 4)
self.sh.for_all_neighbors(
- i_p, self.particles_reordered.pos, self._support_radius, ret, self._task_compute_DFSPH_factor
+ i_p, self.par... | genesis/engine/solvers/sph_solver.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix DFSPH solver and add tests. | 2,302 | Genesis-Embodied-AI/Genesis | 26,702 | Python | erizmr | Review this pull request change.
Language: Python
File: genesis/engine/solvers/sph_solver.py
PR Title: [BUG FIX] Fix DFSPH solver and add tests.
BEFORE CODE: self.particles_reordered[i_p, i_b].drho = drho
@ti.func
def _task_divergence_solver_iteration(self, i, j, ret: ti.template(), i_b):
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
urdf_path.write_text(
f"""<robot name="cannon">
<link name="base">
<visual>
<geometry><mesh filename="{os.path.join(asset_path, mesh_file)}"/></geometry>
</visual>
</link>
</robot>
"""
)
scene = gs.Sc... | No issues found. | urdf_path.write_text(
f"""<robot name="cannon">
<link name="base">
<visual>
<geometry><mesh filename="{os.path.join(asset_path, mesh_file)}"/></geometry>
</visual>
</link>
</robot>
"""
)
scene = gs.Sc... | @@ -1,5 +1,6 @@
import os
import platform
+from contextlib import nullcontext
import numpy as np
import pytest
@@ -482,6 +483,72 @@ def test_obj_morphes_yup(show_viewer):
assert_allclose(mesh.trimesh.center_mass, (-0.012, -0.142, 0.397), tol=0.002)
+@pytest.mark.required
+@pytest.mark.parametrize("sc... | tests/test_mesh.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix 'Mesh.convert_to_zup' by applying scaling out-of-place. | 2,311 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: tests/test_mesh.py
PR Title: [BUG FIX] Fix 'Mesh.convert_to_zup' by applying scaling out-of-place.
BEFORE CODE: urdf_path.write_text(
f"""<robot name="cannon">
<link name="base">
<visual>
<geometry><m... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
metadata=None,
surface=None,
is_mesh_zup=True,
):
"""
Create a genesis.Mesh from a trimesh.Trimesh object.
"""
if surface is None:
surface = gs.surfaces.Default()
surface.update_texture()
else:
surface = surface.copy... | No issues found. | metadata=None,
surface=None,
is_mesh_zup=True,
):
"""
Create a genesis.Mesh from a trimesh.Trimesh object.
"""
if surface is None:
surface = gs.surfaces.Default()
surface.update_texture()
else:
surface = surface.copy... | @@ -1,13 +1,13 @@
import os
import pickle as pkl
+from typing import Any
import fast_simplification
import numpy as np
import trimesh
import genesis as gs
import genesis.utils.mesh as mu
-import genesis.utils.geom as gu
import genesis.utils.gltf as gltf_utils
import genesis.utils.particle as pu
from genes... | genesis/engine/mesh.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Revert out-of-place mesh scaling and implement a new fix. | 2,316 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: genesis/engine/mesh.py
PR Title: [BUG FIX] Revert out-of-place mesh scaling and implement a new fix.
BEFORE CODE: metadata=None,
surface=None,
is_mesh_zup=True,
):
"""
Create a genesis.Mesh from a trimesh.Trimesh obj... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
sphere = scene.add_entity(
morph=gs.morphs.Sphere(
pos=(0.0, 0.0, SPHERE_RADIUS),
radius=SPHERE_RADIUS,
),
material=gs.materials.FEM.Elastic(
friction_mu=1.0,
model="linear_corotated",
),
)
asset_path = get_hf_dataset(pattern="m... | No issues found. | sphere = scene.add_entity(
morph=gs.morphs.Sphere(
pos=(0.0, 0.0, SPHERE_RADIUS),
radius=SPHERE_RADIUS,
),
material=gs.materials.FEM.Elastic(
friction_mu=1.0,
model="linear_corotated",
),
)
asset_path = get_hf_dataset(pattern="m... | @@ -13,7 +13,6 @@
@pytest.mark.required
-@pytest.mark.skipif(platform.machine() == "aarch64", reason="Module 'tetgen' is crashing on Linux ARM.")
def test_interior_tetrahedralized_vertex(cube_verts_and_faces, box_obj_path, show_viewer):
"""
Test tetrahedralization of a FEM entity with a small maxvolume ... | tests/test_fem.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Add support of tetgen on Linux ARM. | 2,317 | Genesis-Embodied-AI/Genesis | 26,702 | Python | duburcqa | Review this pull request change.
Language: Python
File: tests/test_fem.py
PR Title: [MISC] Add support of tetgen on Linux ARM.
BEFORE CODE: sphere = scene.add_entity(
morph=gs.morphs.Sphere(
pos=(0.0, 0.0, SPHERE_RADIUS),
radius=SPHERE_RADIUS,
),
material=gs.mater... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
"""j -> i"""
cur_dist = (self.particles_reordered[i, i_b].pos - self.particles_reordered[j, i_b].pos).norm(gs.EPS)
rest_dist = (
self.particles_info_reordered[i, i_b].pos_rest - self.particles_info_reordered[j, i_b].pos_rest
).norm(gs.EPS)
target_dist = self._particl... | No issues found. | """j -> i"""
cur_dist = (self.particles_reordered[i, i_b].pos - self.particles_reordered[j, i_b].pos).norm(gs.EPS)
rest_dist = (
self.particles_info_reordered[i, i_b].pos_rest - self.particles_info_reordered[j, i_b].pos_rest
).norm(gs.EPS)
target_dist = self._particl... | @@ -102,6 +102,12 @@ def init_vvert_fields(self):
shape=(max(self._n_vverts, 1), self._B), layout=ti.Layout.SOA
)
+ # UV coordinates for visual vertices (static, same across all batch envs)
+ self.vverts_uvs = ti.field(dtype=gs.ti_vec2, shape=(max(self._n_vverts, 1),))
+
+ #... | genesis/engine/solvers/pbd_solver.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. | 2,323 | Genesis-Embodied-AI/Genesis | 26,702 | Python | alelievr | Review this pull request change.
Language: Python
File: genesis/engine/solvers/pbd_solver.py
PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
BEFORE CODE: """j -> i"""
cur_dist = (self.particles_reordered[i, i_b].pos - self.particles_reordered[j, i_b].pos)... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
links_state=links_state,
) # NOTE: we still compute jacobian for all dofs as we haven't found a clean way to implement this
# copy to multi-link jacobian (only for the effective n_dofs instead of self.n_dofs)
for i_dof in range(n_dofs... | No issues found. | links_state=links_state,
) # NOTE: we still compute jacobian for all dofs as we haven't found a clean way to implement this
# copy to multi-link jacobian (only for the effective n_dofs instead of self.n_dofs)
for i_dof in range(n_dofs... | @@ -20,6 +20,7 @@ def kernel_rigid_entity_inverse_kinematics(
links_idx: qd.types.ndarray(),
poss: qd.types.ndarray(),
quats: qd.types.ndarray(),
+ local_points: qd.types.ndarray(),
n_links: qd.i32,
dofs_idx: qd.types.ndarray(),
n_dofs: qd.i32,
@@ -94,7 +95,11 @@ def kernel_rigid_entity... | genesis/engine/solvers/rigid/abd/inverse_kinematics.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [FEATURE] #2332 Implement Local Offset in Inverse Kinematics | 2,333 | Genesis-Embodied-AI/Genesis | 26,702 | Python | alexis779 | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/abd/inverse_kinematics.py
PR Title: [FEATURE] #2332 Implement Local Offset in Inverse Kinematics
BEFORE CODE: links_state=links_state,
) # NOTE: we still compute jacobian for all dofs as... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
# In MJCF: box at box_pos with size box_size (half-extent), free joint
box = UsdGeom.Cube.Define(stage, "/worldbody/box")
box.AddTranslateOp().Set(Gf.Vec3d(box_pos[0], box_pos[1], box_pos[2]))
# MJCF size is half-extent, USD size is full edge length
# So we need to multiply by 2
box.GetSizeAttr(... | No issues found. | # In MJCF: box at box_pos with size box_size (half-extent), free joint
box = UsdGeom.Cube.Define(stage, "/worldbody/box")
box.AddTranslateOp().Set(Gf.Vec3d(box_pos[0], box_pos[1], box_pos[2]))
# MJCF size is half-extent, USD size is full edge length
# So we need to multiply by 2
box.GetSizeAttr(... | @@ -833,3 +833,70 @@ def test_usd_bake(usd_file, tmp_path):
else:
assert is_any_baked
break
+
+
+@pytest.mark.required
+@pytest.mark.parametrize("scale", [1.0, 2.0])
+@pytest.mark.skipif(not HAS_USD_SUPPORT, reason="USD support not available")
+def test_massapi_invalid_defaults_mjcf_v... | tests/test_usd.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Fix handling of unspecified spatial inertia properties in USD. | 2,401 | Genesis-Embodied-AI/Genesis | 26,702 | Python | alanray-tech | Review this pull request change.
Language: Python
File: tests/test_usd.py
PR Title: [BUG FIX] Fix handling of unspecified spatial inertia properties in USD.
BEFORE CODE: # In MJCF: box at box_pos with size box_size (half-extent), free joint
box = UsdGeom.Cube.Define(stage, "/worldbody/box")
box.AddTrans... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
"""
Constraint solver submodule for rigid body simulation.
Contains constraint solving, island detection, and backward pass.
"""
from .solver import ConstraintSolver
from .solver_island import ConstraintSolverIsland
# first declare func_solve_body:
from . import solver
# now register decomposed with func_solve_body... | No issues found. | """
Constraint solver submodule for rigid body simulation.
Contains constraint solving, island detection, and backward pass.
"""
from .solver import ConstraintSolver
from .solver_island import ConstraintSolverIsland
# first declare func_solve_body:
from . import solver
# now register decomposed with func_solve_body... | @@ -6,3 +6,9 @@
from .solver import ConstraintSolver
from .solver_island import ConstraintSolverIsland
+
+# first declare func_solve_body:
+from . import solver
+
+# now register decomposed with func_solve_body:
+from . import solver_breakdown | genesis/engine/solvers/rigid/constraint/__init__.py | 0 | Python | 1 | none | 16 | 15 | 15 | true | [MISC] Decompose solver and use parallel Hessian and Cholesky to significantly speedup contact-rich and dynamic simulations. | 2,406 | Genesis-Embodied-AI/Genesis | 26,702 | Python | hughperkins | Review this pull request change.
Language: Python
File: genesis/engine/solvers/rigid/constraint/__init__.py
PR Title: [MISC] Decompose solver and use parallel Hessian and Cholesky to significantly speedup contact-rich and dynamic simulations.
BEFORE CODE: """
Constraint solver submodule for rigid body simulation.
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
self.entities_analytical[entity_idx].set_qpos((*pos, *quat))
self.entities_analytical[entity_idx].zero_all_dofs_velocity()
def update_pos_quat_gjk(self, entity_idx: int, pos, euler) -> None:
quat = gs.utils.geom.xyz_to_quat(xyz=np.array(euler, dtype=gs.np_float), degrees=True)
self.... | No issues found. | self.entities_analytical[entity_idx].set_qpos((*pos, *quat))
self.entities_analytical[entity_idx].zero_all_dofs_velocity()
def update_pos_quat_gjk(self, entity_idx: int, pos, euler) -> None:
quat = gs.utils.geom.xyz_to_quat(xyz=np.array(euler, dtype=gs.np_float), degrees=True)
self.... | @@ -501,15 +501,15 @@ def test_sphere_capsule_vs_gjk(backend, monkeypatch, tmp_path: Path, show_viewer
3. Run ALL GJK scenarios (patched kernel with its own empty cache)
"""
test_cases = [
- # (sphere_pos, capsule_pos, capsule_euler, should_collide, description, skip_gpu)
- ((0, 0, 0.4), (0... | tests/test_rigid_physics_analytical_vs_gjk.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [BUG FIX] Tune GJK to avoid false negative collision detection. | 2,419 | Genesis-Embodied-AI/Genesis | 26,702 | Python | SonSang | Review this pull request change.
Language: Python
File: tests/test_rigid_physics_analytical_vs_gjk.py
PR Title: [BUG FIX] Tune GJK to avoid false negative collision detection.
BEFORE CODE: self.entities_analytical[entity_idx].set_qpos((*pos, *quat))
self.entities_analytical[entity_idx].zero_all_dofs... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if joint.type == gs.JOINT_TYPE.FIXED:
continue
if joint.type == gs.JOINT_TYPE.REVOLUTE:
revolute_joints.append(joint)
joint_qpos_indices.append(joint.qs_idx_local[0])
joint_dof_indices.append(joint.dofs_idx_local[0])
el... | No issues found. | if joint.type == gs.JOINT_TYPE.FIXED:
continue
if joint.type == gs.JOINT_TYPE.REVOLUTE:
revolute_joints.append(joint)
joint_qpos_indices.append(joint.qs_idx_local[0])
joint_dof_indices.append(joint.dofs_idx_local[0])
el... | @@ -311,53 +311,6 @@ def read_ipc_geometry_metadata(geo):
# ============================================================
-@nb.jit(nopython=True, cache=True)
-def compute_external_force_12d(contact_forces, contact_torques, abd_transforms):
- """
- Compute 12D external force from contact forces and torques.
-
... | genesis/engine/couplers/ipc_coupler/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | [MISC] Remove partially broken IPC contact proxy option. | 2,463 | Genesis-Embodied-AI/Genesis | 26,702 | Python | Roushelfy | Review this pull request change.
Language: Python
File: genesis/engine/couplers/ipc_coupler/utils.py
PR Title: [MISC] Remove partially broken IPC contact proxy option.
BEFORE CODE: if joint.type == gs.JOINT_TYPE.FIXED:
continue
if joint.type == gs.JOINT_TYPE.REVOLUTE:
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
public static void init(Settings settings) {
mavenSettings = settings;
for (Proxy proxy : mavenSettings.getProxies()) {
// Poor way to push proxy settings onto Connection instances
if (proxy != null && proxy.getProtocol().equalsIgnoreCase("http")) {
System.setProperty("http.proxyHost", pro... | No one seems to be calling this method. Remove it? | */
public static void init(Settings settings) {
settings
.getProxies()
.stream()
.filter(proxy -> proxy.isActive())
.collect(Collectors.toList())
.forEach(proxy -> setProxyProperties(proxy));
}
/**
* Set proxy system properties based on Maven proxy configuration.... | @@ -0,0 +1,88 @@
+/*
+ * Copyright 2018 Google LLC.
+ *
+ * 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 ... | jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java | 26 | Java | 0.286 | question | 50 | 51 | 51 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java
PR Title: Add proxy authentication
BEFORE CODE: public static void init(Settings settings) {
mavenSettings = settings;
for (Proxy proxy : mavenSettings.getProxies()) {
... | No one seems to be calling this method. Remove it? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
*
* 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
* distribu... | This field seems unnecessary. `init()` overrides it. | *
* 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
* distribu... | @@ -0,0 +1,88 @@
+/*
+ * Copyright 2018 Google LLC.
+ *
+ * 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 ... | jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java | 26 | Java | 0.357 | suggestion | 52 | 51 | 51 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java
PR Title: Add proxy authentication
BEFORE CODE: *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the Li... | This field seems unnecessary. `init()` overrides it. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
*/
package com.google.cloud.tools.jib.maven;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Settings;
/** Initializes and retrieves proxy settings from either Maven settings or system properties * */
pub... | If the user has given the system properties on the command line, I think that should have a priority over Maven settings. So, I think we need to set these only when the properties were not defined. | */
package com.google.cloud.tools.jib.maven;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Settings;
/** Propagates proxy configuration from Maven settings to system properties * */
public class ProxyProvi... | @@ -0,0 +1,88 @@
+/*
+ * Copyright 2018 Google LLC.
+ *
+ * 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 ... | jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java | 26 | Java | 0.429 | suggestion | 197 | 51 | 51 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java
PR Title: Add proxy authentication
BEFORE CODE: */
package com.google.cloud.tools.jib.maven;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collecto... | If the user has given the system properties on the command line, I think that should have a priority over Maven settings. So, I think we need to set these only when the properties were not defined. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
public static Function<URL, Connection> getInsecureConnectionFactory()
throws GeneralSecurityException {
// Do not use {@link NetHttpTransport}. See {@link getConnectionFactory} for details.
HttpTransport transport = new ApacheHttpTransport.Builder().doNotValidateCertificate().build();
addProxyCrede... | Question: I believe these properties (`http.proxyUser`, etc) have been working, so that makes me think we don't really need to do this (`setCredentials` and all the stuff in this method). Why do we need this all of a sudden? | public static Function<URL, Connection> getInsecureConnectionFactory()
throws GeneralSecurityException {
// Do not use {@link NetHttpTransport}. See {@link getConnectionFactory} for details.
HttpTransport transport = new ApacheHttpTransport.Builder().doNotValidateCertificate().build();
addProxyCrede... | @@ -75,9 +79,36 @@
throws GeneralSecurityException {
// Do not use {@link NetHttpTransport}. See {@link getConnectionFactory} for details.
HttpTransport transport = new ApacheHttpTransport.Builder().doNotValidateCertificate().build();
+ addProxyCredentials(transport);
return url -> new Connecti... | jib-core/src/main/java/com/google/cloud/tools/jib/http/Connection.java | 26 | Java | 0.643 | security | 224 | 51 | 51 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-core/src/main/java/com/google/cloud/tools/jib/http/Connection.java
PR Title: Add proxy authentication
BEFORE CODE: public static Function<URL, Connection> getInsecureConnectionFactory()
throws GeneralSecurityException {
// Do not use {@link NetHt... | Question: I believe these properties (`http.proxyUser`, etc) have been working, so that makes me think we don't really need to do this (`setCredentials` and all the stuff in this method). Why do we need this all of a sudden? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
*
* @throws GeneralSecurityException if unable to turn off TLS peer verification
* @return {@link Connection} factory, a function that generates a {@link Connection} to a URL
*/
public static Function<URL, Connection> getInsecureConnectionFactory()
throws GeneralSecurityException {
// Do not use... | If both `http.proxyUser` and `https.proxyUser` are given, should we do this them all? That is, should we remove `else`? | *
* @throws GeneralSecurityException if unable to turn off TLS peer verification
* @return {@link Connection} factory, a function that generates a {@link Connection} to a URL
*/
public static Function<URL, Connection> getInsecureConnectionFactory()
throws GeneralSecurityException {
// Do not use... | @@ -75,9 +79,36 @@
throws GeneralSecurityException {
// Do not use {@link NetHttpTransport}. See {@link getConnectionFactory} for details.
HttpTransport transport = new ApacheHttpTransport.Builder().doNotValidateCertificate().build();
+ addProxyCredentials(transport);
return url -> new Connecti... | jib-core/src/main/java/com/google/cloud/tools/jib/http/Connection.java | 26 | Java | 0.571 | question | 119 | 51 | 51 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-core/src/main/java/com/google/cloud/tools/jib/http/Connection.java
PR Title: Add proxy authentication
BEFORE CODE: *
* @throws GeneralSecurityException if unable to turn off TLS peer verification
* @return {@link Connection} factory, a function that... | If both `http.proxyUser` and `https.proxyUser` are given, should we do this them all? That is, should we remove `else`? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
*/
package com.google.cloud.tools.jib.maven;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Settings;
/** Initializes and retrieves proxy settings from either Maven settings or system properties * */
public class ProxyProvider {
... | Mixing streams and classic collection iteration seems odd. Either use `Stream::forEach` as the terminal operation, or just iterate over `settings.getProxies()`? | */
package com.google.cloud.tools.jib.maven;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Settings;
/** Propagates proxy configuration from Maven settings to system properties * */
public class ProxyProvi... | @@ -0,0 +1,76 @@
+/*
+ * Copyright 2018 Google LLC.
+ *
+ * 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 ... | jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java | 26 | Java | 0.571 | question | 161 | 51 | 51 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | briandealwis | mmmheeren | Review this pull request change.
Language: Java
File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java
PR Title: Add proxy authentication
BEFORE CODE: */
package com.google.cloud.tools.jib.maven;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.maven.... | Mixing streams and classic collection iteration seems odd. Either use `Stream::forEach` as the terminal operation, or just iterate over `settings.getProxies()`? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
*/
private static void propagateProxyProperties(Proxy proxy) {
if (proxy.getProtocol().equalsIgnoreCase("http")) {
propagateProxyProperty("http.proxyHost", proxy.getHost());
propagateProxyProperty("http.proxyPort", String.valueOf(proxy.getPort()));
propagateProxyProperty("http.proxyUser", pro... | This will only work for a single proxy. Although this is admittedly better than our current level of support :-) But I suspect the approach we'll really need here is to populate a ProxySelector — since the proxies can be per-host — and configure our `Connection` / `HttpTransport` instance to use that selector.
| * com.google.cloud.tools.jib.http.Connection}, while connecting to container image registries.
*
* @param proxy Maven proxy
*/
private static void setProxyProperties(Proxy proxy) {
String protocol = proxy.getProtocol();
if (protocol != null && !proxyPropertiesSet(protocol)) {
setProxyPropert... | @@ -0,0 +1,76 @@
+/*
+ * Copyright 2018 Google LLC.
+ *
+ * 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 ... | jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java | 26 | Java | 0.643 | suggestion | 315 | 30 | 38 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | briandealwis | mmmheeren | Review this pull request change.
Language: Java
File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java
PR Title: Add proxy authentication
BEFORE CODE: */
private static void propagateProxyProperties(Proxy proxy) {
if (proxy.getProtocol().equalsIgnoreCase("http")) {
p... | This will only work for a single proxy. Although this is admittedly better than our current level of support :-) But I suspect the approach we'll really need here is to populate a ProxySelector — since the proxies can be per-host — and configure our `Connection` / `HttpTransport` instance to use that selector.
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
* @throws GeneralSecurityException if unable to turn off TLS peer verification
* @return {@link Connection} factory, a function that generates a {@link Connection} to a URL
*/
public static Function<URL, Connection> getInsecureConnectionFactory()
throws GeneralSecurityException {
// Do not use {@li... | Per https://github.com/GoogleContainerTools/jib/pull/1337#issuecomment-447107670, I think the logic should be
```java
if (httpProxy && httpCreds) {
httpClient.getCredentialsProvider().setCredentials(
new AuthScope(http.proxyHost, http.proxyPort),
new UsernamePasswordCredentials(http... | * @throws GeneralSecurityException if unable to turn off TLS peer verification
* @return {@link Connection} factory, a function that generates a {@link Connection} to a URL
*/
public static Function<URL, Connection> getInsecureConnectionFactory()
throws GeneralSecurityException {
// Do not use {@li... | @@ -75,9 +79,45 @@
throws GeneralSecurityException {
// Do not use {@link NetHttpTransport}. See {@link getConnectionFactory} for details.
HttpTransport transport = new ApacheHttpTransport.Builder().doNotValidateCertificate().build();
+ addProxyCredentials(transport);
return url -> new Connecti... | jib-core/src/main/java/com/google/cloud/tools/jib/http/Connection.java | 26 | Java | 0.857 | security | 756 | 51 | 51 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-core/src/main/java/com/google/cloud/tools/jib/http/Connection.java
PR Title: Add proxy authentication
BEFORE CODE: * @throws GeneralSecurityException if unable to turn off TLS peer verification
* @return {@link Connection} factory, a function that gene... | Per https://github.com/GoogleContainerTools/jib/pull/1337#issuecomment-447107670, I think the logic should be
```java
if (httpProxy && httpCreds) {
httpClient.getCredentialsProvider().setCredentials(
new AuthScope(http.proxyHost, http.proxyPort),
new UsernamePasswordCredentials(http... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
*
* @param proxy Maven proxy
*/
private static void propagateProxyProperties(Proxy proxy) {
if (proxy.getProtocol().equalsIgnoreCase("http")) {
propagateProxyProperty("http.proxyHost", proxy.getHost());
propagateProxyProperty("http.proxyPort", String.valueOf(proxy.getPort()));
propagate... | Use `@Nullable` for `value`: `...(String name, @Nullable String value) {` | * Set proxy system properties based on Maven proxy configuration. These system properties will be
* picked up by {@link java.net.ProxySelector} used in {@link
* com.google.cloud.tools.jib.http.Connection}, while connecting to container image registries.
*
* @param proxy Maven proxy
*/
private static... | @@ -0,0 +1,76 @@
+/*
+ * Copyright 2018 Google LLC.
+ *
+ * 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 ... | jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java | 26 | Java | 0.571 | suggestion | 73 | 32 | 40 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java
PR Title: Add proxy authentication
BEFORE CODE: *
* @param proxy Maven proxy
*/
private static void propagateProxyProperties(Proxy proxy) {
if (proxy.getProtocol().... | Use `@Nullable` for `value`: `...(String name, @Nullable String value) {` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
* @param proxy Maven proxy
*/
private static void propagateProxyProperties(Proxy proxy) {
if (proxy.getProtocol().equalsIgnoreCase("http")) {
propagateProxyProperty("http.proxyHost", proxy.getHost());
propagateProxyProperty("http.proxyPort", String.valueOf(proxy.getPort()));
propagateProxy... | I think the proxy updating should happen all or not. For example, someone can define `https.proxyHost` from the command line but leave `https.proxyPort` undefined, in which case the default port will be chosen. It is also possible to leave `https.proxyUser` if the proxy doesn't require auth. So, I think the logic shoul... | * picked up by {@link java.net.ProxySelector} used in {@link
* com.google.cloud.tools.jib.http.Connection}, while connecting to container image registries.
*
* @param proxy Maven proxy
*/
private static void setProxyProperties(Proxy proxy) {
String protocol = proxy.getProtocol();
if (protocol !... | @@ -0,0 +1,76 @@
+/*
+ * Copyright 2018 Google LLC.
+ *
+ * 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 ... | jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java | 26 | Java | 1 | security | 943 | 31 | 39 | false | Add proxy authentication | 1,337 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mmmheeren | Review this pull request change.
Language: Java
File: jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/ProxyProvider.java
PR Title: Add proxy authentication
BEFORE CODE: * @param proxy Maven proxy
*/
private static void propagateProxyProperties(Proxy proxy) {
if (proxy.getProtocol().equal... | I think the proxy updating should happen all or not. For example, someone can define `https.proxyHost` from the command line but leave `https.proxyPort` undefined, in which case the default port will be chosen. It is also possible to leave `https.proxyUser` if the proxy doesn't require auth. So, I think the logic shoul... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/**
* Jar Type.
*
* <ul>
* <li>{@code REGULAR} a regular jar.
* <li>{@code SPRINGBOOT} a springboot fat jar. *
* </ul>
*/
public enum JarType {
REGULAR,
SPRINGBOOT;
}
/**
* Determines whether the jar is a spring-boot or regular jar, given a path to the jar.
*
* @param ... | May need to add more logic to verify that the jar is in fact a regular jar, otherwise throw an exception saying that non-springboot fat jars are not supported. | /**
* Jar Type.
*
* <ul>
* <li>{@code STANDARD} a regular jar.
* <li>{@code SPRING_BOOT} a spring boot fat jar.
* </ul>
*/
public enum JarType {
STANDARD,
SPRING_BOOT;
}
/**
* Determines whether the jar is a spring boot or regular jar, given a path to the jar.
*
* @par... | @@ -0,0 +1,52 @@
+/*
+ * Copyright 2020 Google LLC.
+ *
+ * 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 ... | jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarProcessor.java | 26 | Java | 0.5 | suggestion | 161 | 29 | 29 | false | Implement JarProcessor to determine jar type. | 2,797 | GoogleContainerTools/jib | 11,032 | Java | mpeddada1 | mpeddada1 | Review this pull request change.
Language: Java
File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarProcessor.java
PR Title: Implement JarProcessor to determine jar type.
BEFORE CODE: /**
* Jar Type.
*
* <ul>
* <li>{@code REGULAR} a regular jar.
* <li>{@code SPRINGBOOT} a springbo... | May need to add more logic to verify that the jar is in fact a regular jar, otherwise throw an exception saying that non-springboot fat jars are not supported. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
* 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... | ```suggestion
* <li>{@code SPRING_BOOT} a springboot fat jar.
``` | * 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... | @@ -0,0 +1,52 @@
+/*
+ * Copyright 2020 Google LLC.
+ *
+ * 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 ... | jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarProcessor.java | 26 | Java | 0.571 | suggestion | 72 | 49 | 49 | false | Implement JarProcessor to determine jar type. | 2,797 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mpeddada1 | Review this pull request change.
Language: Java
File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarProcessor.java
PR Title: Implement JarProcessor to determine jar type.
BEFORE CODE: * use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://w... | ```suggestion
* <li>{@code SPRING_BOOT} a springboot fat jar.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import java.util.jar.JarFile;
public class JarProcessor {
/**
* Jar Type.
*
* <ul>
* <li>{@code REGULAR} a regular jar.
* <li>{@code SPRINGBOOT} a springboot fat jar. *
* </ul>
*/
public enum JarType {
REGULAR,
SPRINGBOOT;
}
/**
* Determines whether the jar is a spring-boo... | nit: it doesn't matter at all here, but generally I try to avoid dealing with path as a string.
```suggestion
JarFile jarFile = new JarFile(jarPath.toFile());
``` | import java.util.jar.JarFile;
public class JarProcessor {
/**
* Jar Type.
*
* <ul>
* <li>{@code STANDARD} a regular jar.
* <li>{@code SPRING_BOOT} a spring boot fat jar.
* </ul>
*/
public enum JarType {
STANDARD,
SPRING_BOOT;
}
/**
* Determines whether the jar is a spring ... | @@ -0,0 +1,52 @@
+/*
+ * Copyright 2020 Google LLC.
+ *
+ * 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 ... | jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarProcessor.java | 26 | Java | 0.786 | suggestion | 169 | 33 | 33 | false | Implement JarProcessor to determine jar type. | 2,797 | GoogleContainerTools/jib | 11,032 | Java | chanseokoh | mpeddada1 | Review this pull request change.
Language: Java
File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/JarProcessor.java
PR Title: Implement JarProcessor to determine jar type.
BEFORE CODE: import java.util.jar.JarFile;
public class JarProcessor {
/**
* Jar Type.
*
* <ul>
* <li>{@code REGU... | nit: it doesn't matter at all here, but generally I try to avoid dealing with path as a string.
```suggestion
JarFile jarFile = new JarFile(jarPath.toFile());
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.