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
""" scene, liquid = sph_scene sph_solver = scene.sph_solver n_particles = sph_solver.n_particles # Get initial positions for comparison initial_pos = liquid.get_particles_pos().clone() # Run simulation for a few steps num_steps = 5 max_velocities = [] for step in range(num_ste...
Remove these comments, they do not bring any value. It is already clear from the assert itself.
A stable simulation should: 1. Not produce NaN or Inf values in particle positions/velocities 2. Have bounded maximum velocities (not exploding) 3. Particles should remain within the simulation domain This test runs a few simulation steps and verifies stability. """ scene, liquid = sph_sce...
@@ -0,0 +1,302 @@ +# Tests for SPH simulation - initial density and pressure validation +# +# Background: +# SPH is sensitive to the initial particle distribution, as it directly determines the initial density and pressure fields. +# To ensure numerical stability, particles must be initialized using a regular sampler t...
tests/test_sph.py
26
Python
0.286
suggestion
95
51
51
false
[BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues.
2,280
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
erizmr
Review this pull request change. Language: Python File: tests/test_sph.py PR Title: [BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues. BEFORE CODE: """ scene, liquid = sph_scene sph_solver = scene.sph_solver n_particles = sph_solver.n_particles # Get initial position...
Remove these comments, they do not bring any value. It is already clear from the assert itself.
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.
vel = liquid.get_particles_vel() # Check for NaN/Inf in positions assert not pos.isnan().any(), f"NaN values detected in positions at step {step}" assert not pos.isinf().any(), f"Inf values detected in positions at step {step}" # Check for NaN/Inf in velocities assert n...
Remove `.item()` it is useless here.
max_velocities = [] for step in range(num_steps): scene.step() pos = liquid.get_particles_pos() vel = liquid.get_particles_vel() assert not pos.isnan().any(), f"NaN values detected in positions at step {step}" assert not pos.isinf().any(), f"Inf values detected in positio...
@@ -0,0 +1,302 @@ +# Tests for SPH simulation - initial density and pressure validation +# +# Background: +# SPH is sensitive to the initial particle distribution, as it directly determines the initial density and pressure fields. +# To ensure numerical stability, particles must be initialized using a regular sampler t...
tests/test_sph.py
26
Python
0.286
suggestion
36
51
51
false
[BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues.
2,280
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
erizmr
Review this pull request change. Language: Python File: tests/test_sph.py PR Title: [BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues. BEFORE CODE: vel = liquid.get_particles_vel() # Check for NaN/Inf in positions assert not pos.isnan().any(), f"NaN values detect...
Remove `.item()` it is useless here.
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_particles = sph_solver.n_particles # Get initial positions for comparison initial_pos = liquid.get_particles_pos().clone() # Run simulation for a few steps num_steps = 5 max_velocities = [] for step in range(num_steps): scene.step() # Get current state pos = liq...
You can remove `.item()` here I think.
2. Have bounded maximum velocities (not exploding) 3. Particles should remain within the simulation domain This test runs a few simulation steps and verifies stability. """ scene, liquid = sph_scene sph_solver = scene.sph_solver n_particles = sph_solver.n_particles # Get initial positi...
@@ -0,0 +1,302 @@ +# Tests for SPH simulation - initial density and pressure validation +# +# Background: +# SPH is sensitive to the initial particle distribution, as it directly determines the initial density and pressure fields. +# To ensure numerical stability, particles must be initialized using a regular sampler t...
tests/test_sph.py
26
Python
0.286
suggestion
38
51
51
false
[BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues.
2,280
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
erizmr
Review this pull request change. Language: Python File: tests/test_sph.py PR Title: [BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues. BEFORE CODE: n_particles = sph_solver.n_particles # Get initial positions for comparison initial_pos = liquid.get_particles_pos().clone() ...
You can remove `.item()` here I think.
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.
regardless of particle size, as the SPH kernel is scaled accordingly. """ scene = gs.Scene( sim_options=gs.options.SimOptions( dt=4e-3, substeps=10, ), sph_options=gs.options.SPHOptions( lower_bound=(-0.5, -0.5, 0.0), upper_bound=(0.5, ...
This could be unified with your `sph_scene` fixture? Maybe add some function `create_sph_scene` and you call with some default arguments in fixture, or you can call manually without non-default argument in needed?
regardless of particle size, as the SPH kernel is scaled accordingly. """ scene, _ = create_sph_scene(show_viewer, particle_size=particle_size) sph_solver = scene.sph_solver n_particles = sph_solver.n_particles rho0 = sph_solver.particles_info[0].rho # Get density values densities, pre...
@@ -0,0 +1,302 @@ +# Tests for SPH simulation - initial density and pressure validation +# +# Background: +# SPH is sensitive to the initial particle distribution, as it directly determines the initial density and pressure fields. +# To ensure numerical stability, particles must be initialized using a regular sampler t...
tests/test_sph.py
26
Python
0.643
question
213
51
31
false
[BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues.
2,280
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
erizmr
Review this pull request change. Language: Python File: tests/test_sph.py PR Title: [BUG FIX] Fix wrong sampler for SPH solver causing numerical stability issues. BEFORE CODE: regardless of particle size, as the SPH kernel is scaled accordingly. """ scene = gs.Scene( sim_options=gs.options.SimOp...
This could be unified with your `sph_scene` fixture? Maybe add some function `create_sph_scene` and you call with some default arguments in fixture, or you can call manually without non-default argument in needed?
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._shared_metadata.renderer.build() self._shared_metadata.sensors.append(self) # Add lights from options to the shared metadata for light_config in self._options.lights: if self._shared_metadata.lights is not None: # Convert light config to rasterizer...
why is it TODO? Isn't it the line above already removing camera?
options: RasterizerCameraOptions, idx: int, data_cls: Type[CameraData], manager: "gs.SensorManager", ): super().__init__(options, idx, data_cls, manager) self._options: RasterizerCameraOptions self._camera_node = None self._camera_target = None ...
@@ -427,6 +427,23 @@ def build(self): w, h = self._options.res self._shared_metadata.image_cache[self._idx] = torch.zeros((_B, h, w, 3), dtype=torch.uint8, device=gs.device) + def destroy(self): + if not self._shared_metadata.sensors: + return + self._shared_metadata.sens...
genesis/engine/sensors/camera.py
26
Python
0.214
question
64
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
nimrod-gileadi
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: self._shared_metadata.renderer.build() self._shared_metadata.sensors.append(self) # Add lights from options to ...
why is it TODO? Isn't it the line above already removing camera?
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.
fov=self._options.fov, aperture=self._options.aperture, focus_dist=self._options.focus_dist, GUI=False, spp=self._options.spp, denoise=self._options.denoise, near=0.05, far=100.0, env_idx=None if n_envs == 0 else...
what could be the other cleanups? Any known issue?
elif self._link is not None: # Link exists but not built yet - use configured pose as-is (treat as world coordinates for now) # This will be corrected when move_to_attach is called pass self._camera_obj = visualizer.add_camera( res=self._options.res, ...
@@ -631,6 +648,12 @@ def build(self): w, h = self._options.res self._shared_metadata.image_cache[self._idx] = torch.zeros((_B, h, w, 3), dtype=torch.uint8, device=gs.device) + def destroy(self): + if not self._shared_metadata.sensors: + return + self._shared_metadata.sens...
genesis/engine/sensors/camera.py
26
Python
0.286
question
50
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
nimrod-gileadi
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: fov=self._options.fov, aperture=self._options.aperture, focus_dist=self._options.focus_dist, ...
what could be the other cleanups? Any known issue?
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 sensor in sensors: update_ground_truth_only &= sensor._options.update_ground_truth_only sensor._cache_idx = cache_size_per_dtype[dtype] cache_size_per_dtype[dtype] += sensor._cache_size max_buffer_len = max(max_buffer_len, sensor._delay_ts ...
Should the destroy() method be added to BaseSensor as an default no-op method to avoid the hasattr check?
for sensor in sensors: update_ground_truth_only &= sensor._options.update_ground_truth_only sensor._cache_idx = cache_size_per_dtype[dtype] cache_size_per_dtype[dtype] += sensor._cache_size max_buffer_len = max(max_buffer_len, sensor._delay_ts ...
@@ -74,6 +74,13 @@ def build(self): sensor.build() sensor._is_built = True + def destroy(self): + for _sensor_cls, sensors in self._sensors_by_type.items(): + for sensor in sensors: + if hasattr(sensor, "destroy"):
genesis/engine/sensors/sensor_manager.py
26
Python
0.429
question
105
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
nimrod-gileadi
Review this pull request change. Language: Python File: genesis/engine/sensors/sensor_manager.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: for sensor in sensors: update_ground_truth_only &= sensor._options.update_ground_truth_only ...
Should the destroy() method be added to BaseSensor as an default no-op method to avoid the hasattr check?
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.
entity_idx=sphere.idx, link_idx_local=0, offset_T=trans_to_T(np.array([0.0, 0.0, 3.0])), ) ) scene.build(n_envs=n_envs) scene.step() for camera in (camera_1, camera_2): data = camera.read() if n_envs > 0: for i in range(n_envs): ...
I think it should "crash" actually. In a sense that only a scene that was build should be destroyed. Here it should raise an exception. Of course, no rendering backend should be started before build.
**camera_common_options, entity_idx=sphere.idx, link_idx_local=0, offset_T=trans_to_T(np.array([0.0, 0.0, 3.0])), ) ) scene.build(n_envs=n_envs) scene.step() for camera in (camera_1, camera_2): data = camera.read() if n_envs > 0: ...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.571
bug
199
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: entity_idx=sphere.idx, link_idx_local=0, offset_T=trans_to_T(np.array([0.0, 0.0, 3.0])), ) ) ...
I think it should "crash" actually. In a sense that only a scene that was build should be destroyed. Here it should raise an exception. Of course, no rendering backend should be started before build.
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 rgb_array_to_png_bytes(data.rgb) == png_snapshot @pytest.mark.required def test_destroy_unbuilt_scene_with_camera(): """Test that destroy on an unbuilt scene with cameras doesn't crash.""" scene = gs.Scene(show_viewer=False) scene.add_entity(morph=gs.morphs.Plane()) scene.add_sensor...
Same. I think it should crash.
else: assert rgb_array_to_png_bytes(data.rgb) == png_snapshot @pytest.mark.required def test_destroy_unbuilt_scene_with_camera(): """Test that destroy on an unbuilt scene with cameras doesn't crash.""" scene = gs.Scene(show_viewer=False) scene.add_entity(morph=gs.morphs.Plane()) sc...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.143
bug
30
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: assert rgb_array_to_png_bytes(data.rgb) == png_snapshot @pytest.mark.required def test_destroy_unbuilt_scene_with_camera(): """T...
Same. I think it should crash.
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.
"""Test that calling destroy twice on a scene with cameras doesn't crash.""" scene = gs.Scene(show_viewer=False) scene.add_entity(morph=gs.morphs.Plane()) camera = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) scene.build() camera.read() scene.destroy() scene.destr...
I don't think this test is relevant but I may be wrong. What are you trying to enforce here? It looks like implementation details.
@pytest.mark.required def test_destroy_idempotent_with_camera(): """Test that calling destroy twice on a scene with cameras doesn't crash.""" scene = gs.Scene(show_viewer=False) camera = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) scene.build() camera.read() scene.destro...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.357
bug
130
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: """Test that calling destroy twice on a scene with cameras doesn't crash.""" scene = gs.Scene(show_viewer=False) scene.add_entity(morp...
I don't think this test is relevant but I may be wrong. What are you trying to enforce here? It looks like implementation details.
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.read() scene.destroy() scene.destroy() # Should not crash @pytest.mark.required def test_cameras_share_metadata(): scene = gs.Scene(show_viewer=False) scene.add_entity(morph=gs.morphs.Plane()) cam1 = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) cam2 = scene....
No local imports except absolutely necessary.
scene.build() camera.read() scene.destroy() # Scene.__del__ calls destroy(), which means it's expected that destroy() will # be called twice. A crash in destroy() would result in some logspam. scene.destroy() @pytest.mark.required def test_rasterizer_destroy(): scene = gs.Scene(show_viewe...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.071
suggestion
45
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: camera.read() scene.destroy() scene.destroy() # Should not crash @pytest.mark.required def test_cameras_share_metadata(): scen...
No local imports except absolutely necessary.
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() cam1.read() cam2.read() assert cam1._shared_metadata is cam2._shared_metadata assert len(cam1._shared_metadata.sensors) == 2 @pytest.mark.required def test_camera_destroy_cleans_shared_metadata(): import gc import weakref scene = gs.Scene(show_viewer=False) scene.a...
I would rather keep it short to avoid distraction and make it easier to understand what this test is doing at first glance: ```python offscreen_renderer_ref = weakref.ref(camera._shared_metadata.renderer._renderer) ```
cam2 = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(32, 32))) scene.build() cam1.read() cam2.read() offscreen_renderer_ref = weakref.ref(cam1._shared_metadata.renderer._renderer) scene.destroy() assert offscreen_renderer_ref() is None @pytest.mark.required @pytest.mark.param...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.857
suggestion
218
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: scene.build() cam1.read() cam2.read() assert cam1._shared_metadata is cam2._shared_metadata assert len(cam1._shared_metadata...
I would rather keep it short to avoid distraction and make it easier to understand what this test is doing at first glance: ```python offscreen_renderer_ref = weakref.ref(camera._shared_metadata.renderer._renderer) ```
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_camera_destroy_cleans_shared_metadata(): import gc import weakref scene = gs.Scene(show_viewer=False) scene.add_entity(morph=gs.morphs.Plane()) camera = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) scene.build() camera.read() share...
Following my previous recommendation, this del is no longer necessary.
assert offscreen_renderer_ref() is None @pytest.mark.required @pytest.mark.parametrize("backend", [gs.cuda]) @pytest.mark.skipif(not ENABLE_MADRONA, reason="BatchRenderer is not supported because 'gs_madrona' is not available.") def test_batch_renderer_destroy(): scene = gs.Scene(show_viewer=False) # FIXM...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.214
suggestion
70
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: @pytest.mark.required def test_camera_destroy_cleans_shared_metadata(): import gc import weakref scene = gs.Scene(show_viewer=False) ...
Following my previous recommendation, this del is no longer necessary.
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 test_camera_destroy_cleans_shared_metadata(): import gc import weakref scene = gs.Scene(show_viewer=False) scene.add_entity(morph=gs.morphs.Plane()) camera = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) scene.build() camera.read() shared_metadata = camera._s...
In my view it is a requirement to release memory right away without waiting for garbage collection. If someone creates another scene right away, it may cause OpenGL related race condition or similar.
@pytest.mark.required @pytest.mark.parametrize("backend", [gs.cuda]) @pytest.mark.skipif(not ENABLE_MADRONA, reason="BatchRenderer is not supported because 'gs_madrona' is not available.") def test_batch_renderer_destroy(): scene = gs.Scene(show_viewer=False) # FIXME: This test fails without any entities in t...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.571
bug
199
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: def test_camera_destroy_cleans_shared_metadata(): import gc import weakref scene = gs.Scene(show_viewer=False) scene.add_entity(m...
In my view it is a requirement to release memory right away without waiting for garbage collection. If someone creates another scene right away, it may cause OpenGL related race condition or similar.
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 = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) scene.build() camera.read() shared_metadata = camera._shared_metadata renderer = shared_metadata.renderer offscreen_renderer = renderer._renderer offscreen_renderer_ref = weakref.ref(offscreen_renderer) scene....
I would rather add a single destroy test that will combine this one and the previous one.
# FIXME: This test fails without any entities in the scene. scene.add_entity(morph=gs.morphs.Plane()) cam1 = scene.add_sensor(gs.sensors.BatchRendererCameraOptions(res=(64, 64), use_rasterizer=True)) cam2 = scene.add_sensor(gs.sensors.BatchRendererCameraOptions(res=(64, 64), use_rasterizer=True)) s...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.214
suggestion
89
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: camera = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) scene.build() camera.read() shared_metadata = camera...
I would rather add a single destroy test that will combine this one and the previous one.
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() cam1.read() cam2.read() shared_metadata = cam1._shared_metadata offscreen_renderer = shared_metadata.renderer._renderer offscreen_renderer_ref = weakref.ref(offscreen_renderer) scene.destroy() assert shared_metadata.renderer is None assert shared_metadata.sensors is...
I don't think adding this is relevant.
) cam1 = scene.add_sensor(gs.sensors.RaytracerCameraOptions(res=(64, 64))) cam2 = scene.add_sensor(gs.sensors.RaytracerCameraOptions(res=(64, 64))) scene.build() cam1.read() cam2.read() shared_metadata = cam1._shared_metadata assert cam1._shared_metadata is cam2._shared_metadata a...
@@ -317,6 +317,162 @@ def test_batch_renderer(n_envs, png_snapshot): assert rgb_array_to_png_bytes(data.rgb) == png_snapshot +@pytest.mark.required +def test_destroy_unbuilt_scene_with_camera(): + """Test that destroy on an unbuilt scene with cameras doesn't crash.""" + scene = gs.Scene(show_view...
tests/test_sensor_camera.py
26
Python
0.071
suggestion
38
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: scene.build() cam1.read() cam2.read() shared_metadata = cam1._shared_metadata offscreen_renderer = shared_metadata.renderer....
I don't think adding this is relevant.
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._shared_metadata.context.add_light(light_dict) camera_wrapper = self._get_camera_wrapper() self._shared_metadata.renderer.add_camera(camera_wrapper) self._update_camera_pose() _B = max(self._manager._sim.n_envs, 1) w, h = self._options.res self._sha...
What does this means? I don't think it sound be possible to manually destroy a camera. This should rather be `__del__` and the sensor manager forcibly calling `del camera`. Otherwise the user may assume destroying camera is allowed and part of the public API. You may also add some `_destroy` prefix to make it "private"...
# ========================== Sensor Lifecycle ========================== def build(self): """Initialize the rasterizer and register this camera.""" super().build() scene = self._manager._sim.scene if self._shared_metadata.sensors is None: self._shared_metadata.sen...
@@ -427,6 +427,23 @@ def build(self): w, h = self._options.res self._shared_metadata.image_cache[self._idx] = torch.zeros((_B, h, w, 3), dtype=torch.uint8, device=gs.device) + def destroy(self): + if not self._shared_metadata.sensors: + return + self._shared_metadata.sens...
genesis/engine/sensors/camera.py
26
Python
0.643
question
335
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: self._shared_metadata.context.add_light(light_dict) camera_wrapper = self._get_camera_wrapper() self._shared...
What does this means? I don't think it sound be possible to manually destroy a camera. This should rather be `__del__` and the sensor manager forcibly calling `del camera`. Otherwise the user may assume destroying camera is allowed and part of the public API. You may also add some `_destroy` prefix to make it "private"...
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.
model=self._options.model, fov=self._options.fov, aperture=self._options.aperture, focus_dist=self._options.focus_dist, GUI=False, spp=self._options.spp, denoise=self._options.denoise, near=0.05, far=100.0, ...
I don't think it should work this way. Either all sensors are destroyed or not. They should never be destroyed one by one. Destroy should be a classmethod acting only on shared data basically.
up = transform_by_quat(up, link_quat) elif self._link is not None: # Link exists but not built yet - use configured pose as-is (treat as world coordinates for now) # This will be corrected when move_to_attach is called pass self._camera_obj = visualizer.a...
@@ -631,6 +648,12 @@ def build(self): w, h = self._options.res self._shared_metadata.image_cache[self._idx] = torch.zeros((_B, h, w, 3), dtype=torch.uint8, device=gs.device) + def destroy(self): + if not self._shared_metadata.sensors: + return + self._shared_metadata.sens...
genesis/engine/sensors/camera.py
26
Python
0.429
suggestion
192
51
51
false
[BUG FIX] Clean up offscreen renderer when scene is destroyed.
2,282
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
nimrod-gileadi
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Clean up offscreen renderer when scene is destroyed. BEFORE CODE: model=self._options.model, fov=self._options.fov, aperture=self._options.aperture, focus_dist...
I don't think it should work this way. Either all sensors are destroyed or not. They should never be destroyed one by one. Destroy should be a classmethod acting only on shared data basically.
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.
# Mean density should be in similar range (50-100% of rho0) assert 0.5 < normalized_mean < 1.0, ( f"Normalized mean density {normalized_mean:.3f} is outside expected range [0.5, 1.0] " f"for particle_size={particle_size}" ) # Standard deviation should be bounded assert normalized_s...
Add a todo to remember that this test should be removed and replace by something that truly validates the physics behind it.
# Mean density should be in similar range (50-100% of rho0) assert 0.5 < normalized_mean < 1.0, ( f"Normalized mean density {normalized_mean:.3f} is outside expected range [0.5, 1.0] " f"for particle_size={particle_size}" ) # Standard deviation should be bounded assert normalized_s...
@@ -275,3 +284,29 @@ def test_sph_density_consistency_different_particle_sizes(show_viewer, particle_ assert np.allclose(pressures, 0.0, atol=1e-6), ( f"Initial pressure is not zero for particle_size={particle_size}. Mean: {pressures.mean():.6f}" ) + + +# =============================================...
tests/test_sph.py
26
Python
0.429
suggestion
124
43
44
false
[BUG FIX] Fix DFSPH solver and add tests.
2,302
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
erizmr
Review this pull request change. Language: Python File: tests/test_sph.py PR Title: [BUG FIX] Fix DFSPH solver and add tests. BEFORE CODE: # Mean density should be in similar range (50-100% of rho0) assert 0.5 < normalized_mean < 1.0, ( f"Normalized mean density {normalized_mean:.3f} is outside exp...
Add a todo to remember that this test should be removed and replace by something that truly validates the physics behind 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.
@pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) @pytest.fixture def g1_fall(solver, n_envs, gjk): """G1 humanoid robot falling from above a plane.""" # This is sufficient, as long as we use sync duration_warmup = 20.0 duration_record =...
this dt is different from STEP_DT (0.01), so the realtime_factor is wrong
@pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) @pytest.fixture def g1_fall(solver, n_envs, gjk): """G1 humanoid robot falling from above a plane.""" import gstaichi as ti # This is sufficient, as long as we use sync duration_warmup = ...
@@ -725,6 +724,80 @@ def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) +@pytest.fixture +def g1_fall(solver, n_envs, gjk): + """G1 humanoid robot falling from above a plane.""" + + # This is sufficient, as long as we use sync + duration_warmup = 20.0 + dura...
tests/test_rigid_benchmarks.py
26
Python
0.214
bug
73
51
51
false
[MISC] Add benchmark for Unitree G1.
2,310
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add benchmark for Unitree G1. BEFORE CODE: @pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) @pytest.fixture def g1_fall(solver, n_envs, gjk): ...
this dt is different from STEP_DT (0.01), so the realtime_factor is wrong
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 {"compile_time": compile_time, "runtime_fps": runtime_fps, "realtime_factor": realtime_factor} @pytest.fixture def box_pyramid_3(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=3) @pytest.fixture def box_pyramid_4(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, g...
solver and gjk are received but unused
return {"compile_time": compile_time, "runtime_fps": runtime_fps, "realtime_factor": realtime_factor} @pytest.fixture def box_pyramid_3(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=3) @pytest.fixture def box_pyramid_4(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, g...
@@ -725,6 +724,80 @@ def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) +@pytest.fixture +def g1_fall(solver, n_envs, gjk):
tests/test_rigid_benchmarks.py
26
Python
0.143
suggestion
38
51
51
false
[MISC] Add benchmark for Unitree G1.
2,310
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add benchmark for Unitree G1. BEFORE CODE: return {"compile_time": compile_time, "runtime_fps": runtime_fps, "realtime_factor": realtime_factor} @pytest.fixture def box_pyramid_3(solver, n_envs, gjk): ...
solver and gjk are received but unused
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.fixture def box_pyramid_5(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=5) @pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) @pytest.fixture def g1_fall(solver, n_envs, gjk): """G1 humanoid robot falling from abo...
we have get_hf_dataset function, check other tests
@pytest.fixture def box_pyramid_5(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=5) @pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) @pytest.fixture def g1_fall(solver, n_envs, gjk): """G1 humanoid robot falling from abo...
@@ -725,6 +724,80 @@ def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) +@pytest.fixture +def g1_fall(solver, n_envs, gjk): + """G1 humanoid robot falling from above a plane.""" + + # This is sufficient, as long as we use sync + duration_warmup = 20.0 + dura...
tests/test_rigid_benchmarks.py
26
Python
0.214
suggestion
50
51
51
false
[MISC] Add benchmark for Unitree G1.
2,310
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add benchmark for Unitree G1. BEFORE CODE: @pytest.fixture def box_pyramid_5(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=5) @pytest.fixture def box_pyramid_6(solver, n_envs, gjk)...
we have get_hf_dataset function, check other tests
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 _box_pyramid(solver, n_envs, gjk, n_cubes=5) @pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) @pytest.fixture def g1_fall(solver, n_envs, gjk): """G1 humanoid robot falling from above a plane.""" # This is sufficient, as long as we u...
WTF dt 0.005 + iterations=10, completely garbage options.
return _box_pyramid(solver, n_envs, gjk, n_cubes=5) @pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) @pytest.fixture def g1_fall(solver, n_envs, gjk): """G1 humanoid robot falling from above a plane.""" import gstaichi as ti # This is s...
@@ -725,6 +724,80 @@ def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) +@pytest.fixture +def g1_fall(solver, n_envs, gjk): + """G1 humanoid robot falling from above a plane.""" + + # This is sufficient, as long as we use sync + duration_warmup = 20.0 + dura...
tests/test_rigid_benchmarks.py
26
Python
0.214
suggestion
57
51
51
false
[MISC] Add benchmark for Unitree G1.
2,310
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add benchmark for Unitree G1. BEFORE CODE: return _box_pyramid(solver, n_envs, gjk, n_cubes=5) @pytest.fixture def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6)...
WTF dt 0.005 + iterations=10, completely garbage options.
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(n_envs=n_envs) compile_time = time.time() - time_start # Set initial position with robot elevated above ground init_qpos = torch.zeros((robot.n_qs,), dtype=gs.tc_float, device=gs.device) init_qpos[2] = 1.0 # z position init_qpos[3] = 1.0 # quaternion w component if n_envs > 0:...
Do not use `gs.ti`. This is not supported. Just import ti at the beginning of this "test" function.
scene.build(n_envs=n_envs) compile_time = time.time() - time_start # Set initial position with robot elevated above ground init_qpos = torch.zeros((robot.n_qs,), dtype=gs.tc_float, device=gs.device) init_qpos[2] = 1.0 # z position init_qpos[3] = 1.0 # quaternion w component robot.set_qpos...
@@ -725,6 +724,80 @@ def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) +@pytest.fixture +def g1_fall(solver, n_envs, gjk): + """G1 humanoid robot falling from above a plane.""" + + # This is sufficient, as long as we use sync + duration_warmup = 20.0 + dura...
tests/test_rigid_benchmarks.py
26
Python
0.429
suggestion
99
51
51
false
[MISC] Add benchmark for Unitree G1.
2,310
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add benchmark for Unitree G1. BEFORE CODE: scene.build(n_envs=n_envs) compile_time = time.time() - time_start # Set initial position with robot elevated above ground init_qpos = torch.zeros((robo...
Do not use `gs.ti`. This is not supported. Just import ti at the beginning of this "test" function.
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.
), show_viewer=False, show_FPS=False, ) scene.add_entity( gs.morphs.Plane(), ) robot = scene.add_entity( gs.morphs.MJCF( **get_file_morph_options( file=f"{asset_path}/unitree_g1/g1_29dof_rev_1_0.xml", pos=(0, 0, 1.0), ...
Avoid initializing all envs in the same state, this is not representative of what happens in reality. Either apply random force, different initial velocities, or different initial positions.
), show_viewer=False, show_FPS=False, ) scene.add_entity( gs.morphs.Plane(), ) robot = scene.add_entity( gs.morphs.MJCF( **get_file_morph_options( file=f"{asset_path}/unitree_g1/g1_29dof_rev_1_0.xml", pos=(0, 0, 1.0), ...
@@ -725,6 +724,80 @@ def box_pyramid_6(solver, n_envs, gjk): return _box_pyramid(solver, n_envs, gjk, n_cubes=6) +@pytest.fixture +def g1_fall(solver, n_envs, gjk): + """G1 humanoid robot falling from above a plane.""" + + # This is sufficient, as long as we use sync + duration_warmup = 20.0 + dura...
tests/test_rigid_benchmarks.py
26
Python
0.429
suggestion
190
51
51
false
[MISC] Add benchmark for Unitree G1.
2,310
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add benchmark for Unitree G1. BEFORE CODE: ), show_viewer=False, show_FPS=False, ) scene.add_entity( gs.morphs.Plane(), ) robot = scene.add_entity( gs.morp...
Avoid initializing all envs in the same state, this is not representative of what happens in reality. Either apply random force, different initial velocities, or different initial positions.
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 hashlib import os import time from pathlib import Path from typing import Any import numpy as np import pytest import torch import wandb import genesis as gs import gstaichi as ti from .utils import ( get_hardware_fingerprint, get_hf_dataset, get_platform_fingerprint, get_git_commit_timestamp,...
Please move taichi import install the fixture. It must not be imported in global scope.
import hashlib import os import time from pathlib import Path from typing import Any import numpy as np import pytest import torch import wandb import genesis as gs from .utils import ( get_hardware_fingerprint, get_hf_dataset, get_platform_fingerprint, get_git_commit_timestamp, get_git_commit_in...
@@ -12,9 +10,11 @@ import wandb import genesis as gs +import gstaichi as ti
tests/test_rigid_benchmarks.py
13
Python
0.286
suggestion
87
38
38
false
[MISC] Add benchmark for Unitree G1.
2,310
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add benchmark for Unitree G1. BEFORE CODE: import hashlib import os import time from pathlib import Path from typing import Any import numpy as np import pytest import torch import wandb import genesis as gs im...
Please move taichi import install the fixture. It must not be imported in global scope.
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 the mesh is convex. """ return self._mesh.is_convex @property def metadata(self): """ Metadata of the mesh. """ return self._metadata @property def verts(self): """ Vertices of the mesh. """ return self._me...
After removing the verts setter, https://github.com/Genesis-Embodied-AI/Genesis/blob/cd84ab234de030ab48f2f30f579f59cc158438d2/genesis/vis/rasterizer_context.py#L562 this line seems to throw the error.
""" return self._mesh.is_convex @property def metadata(self): """ Metadata of the mesh. """ return self._metadata @property def verts(self): """ Vertices of the mesh. """ if self._scale is not None: return self...
@@ -447,16 +446,10 @@ def verts(self): """ Vertices of the mesh. """ + if self._scale is not None: + return self._mesh.vertices * self._scale return self._mesh.vertices - @verts.setter - def verts(self, verts): - """ - Set the vertices of the m...
genesis/engine/mesh.py
26
Python
0.571
suggestion
200
51
51
false
[BUG FIX] Fix 'Mesh.convert_to_zup' by applying scaling out-of-place.
2,311
Genesis-Embodied-AI/Genesis
26,702
Python
ACMLCZH
duburcqa
Review this pull request change. Language: Python File: genesis/engine/mesh.py PR Title: [BUG FIX] Fix 'Mesh.convert_to_zup' by applying scaling out-of-place. BEFORE CODE: Whether the mesh is convex. """ return self._mesh.is_convex @property def metadata(self): """ M...
After removing the verts setter, https://github.com/Genesis-Embodied-AI/Genesis/blob/cd84ab234de030ab48f2f30f579f59cc158438d2/genesis/vis/rasterizer_context.py#L562 this line seems to throw the error.
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.
# Overwrite surface color by original color specified in URDF file only if necessary if geom_is_col: geom_surface = gs.surfaces.Collision() elif ( not geom_is_col and getattr(geom_prop, "material") is not None ...
we assume non-glb mesh will never have `file_meshes_are_zup=False`? Maybe it's okay
# Overwrite surface color by original color specified in URDF file only if necessary if geom_is_col: geom_surface = gs.surfaces.Collision() elif ( not geom_is_col and getattr(geom_prop, "material") is not None ...
@@ -128,26 +130,20 @@ def parse_urdf(morph, surface): else: geom_surface = surface - mesh_path = urdfpy.utils.get_filename(os.path.dirname(path), geometry.filename) + mesh_path = urdfpy.utils.get_filename(parent_dir, geometry.filename) ...
genesis/utils/urdf.py
26
Python
0.357
suggestion
83
51
51
false
[BUG FIX] Revert out-of-place mesh scaling and implement a new fix.
2,316
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
duburcqa
Review this pull request change. Language: Python File: genesis/utils/urdf.py PR Title: [BUG FIX] Revert out-of-place mesh scaling and implement a new fix. BEFORE CODE: # Overwrite surface color by original color specified in URDF file only if necessary if geom_is_col: ...
we assume non-glb mesh will never have `file_meshes_are_zup=False`? Maybe it's okay
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 cfg.get("quality", True): r = cfg.get("minratio", 1.1) di = cfg.get("mindihedral", 10) flags.append(f"q{r}/{di}") a = cfg.get("maxvolume", -1.0) if a > 0: flags.append(f"a{a}") o = cfg.get("order", 1) if o != 1: flags.append(f"o{o}") if cfg.get("nob...
Note: This can be done more efficiently by directly passing faces via: ```pv points = mesh.vertices faces = mesh._connectivity_array.reshape(-1, 3).astype(np.int32, copy=False) tet = tetgen.TetGen(points, faces) ```
if cfg.get("quality", True): r = cfg.get("minratio", 1.1) di = cfg.get("mindihedral", 10) flags.append(f"q{r}/{di}") a = cfg.get("maxvolume", -1.0) if a > 0: flags.append(f"a{a}") o = cfg.get("order", 1) if o != 1: flags.append(f"o{o}") if cfg.get("nobi...
@@ -992,9 +991,6 @@ def make_tetgen_switches(cfg): def tetrahedralize_mesh(mesh, tet_cfg): - if platform.machine() == "aarch64": - gs.raise_exception("This method is not support on Linux ARM because 'tetgen' module is crashing.") - # Importing pyvista and tetgen are very slow to import and not used ...
genesis/utils/mesh.py
26
Python
0.929
performance
220
51
51
false
[MISC] Add support of tetgen on Linux ARM.
2,317
Genesis-Embodied-AI/Genesis
26,702
Python
akaszynski
duburcqa
Review this pull request change. Language: Python File: genesis/utils/mesh.py PR Title: [MISC] Add support of tetgen on Linux ARM. BEFORE CODE: if cfg.get("quality", True): r = cfg.get("minratio", 1.1) di = cfg.get("mindihedral", 10) flags.append(f"q{r}/{di}") a = cfg.get("maxvolum...
Note: This can be done more efficiently by directly passing faces via: ```pv points = mesh.vertices faces = mesh._connectivity_array.reshape(-1, 3).astype(np.int32, copy=False) tet = tetgen.TetGen(points, faces) ```
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.
Raises ------ Exception If the morph type is unsupported. """ from genesis.engine.materials.FEM.cloth import Cloth as ClothMaterial is_cloth = isinstance(self.material, ClothMaterial) self._uvs = None if is_cloth: # Cloth: load s...
I would recommend: ```python self._uvs = np.array(mesh.visual.uv, dtype=gs.np_float, copy=True) ``` or just: ```python self._uvs = mesh.visual.uv.astype(gs.np_float, copy=True) ``` More efficient as it avoids allocating memory twice.
Raises ------ Exception If the morph type is unsupported. """ from genesis.engine.materials.FEM.cloth import Cloth as ClothMaterial is_cloth = isinstance(self.material, ClothMaterial) self._uvs = None if is_cloth: # Cloth: load s...
@@ -400,6 +401,13 @@ def sample(self): faces = mesh.faces # For cloth, we store faces as "elements" (treating them as surface elements) self.instantiate(verts, faces) + + # Load UVs from mesh (1:1 mapping for cloth) + try: + ...
genesis/engine/entities/fem_entity.py
26
Python
1
performance
245
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: Raises ------ Exception If the morph type is unsupported. """ fr...
I would recommend: ```python self._uvs = np.array(mesh.visual.uv, dtype=gs.np_float, copy=True) ``` or just: ```python self._uvs = mesh.visual.uv.astype(gs.np_float, copy=True) ``` More efficient as it avoids allocating memory twice.
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.
------ Exception If the morph type is unsupported. """ from genesis.engine.materials.FEM.cloth import Cloth as ClothMaterial is_cloth = isinstance(self.material, ClothMaterial) self._uvs = None if is_cloth: # Cloth: load surface mesh dire...
Could you add a comment to explain which attribute may not exist exactly, in which scenario it would be the case (and why this scenario must be supported if not obvious), and why just ignoring UV is the right approach if not obvious.
------ Exception If the morph type is unsupported. """ from genesis.engine.materials.FEM.cloth import Cloth as ClothMaterial is_cloth = isinstance(self.material, ClothMaterial) self._uvs = None if is_cloth: # Cloth: load surface mesh dire...
@@ -400,6 +401,13 @@ def sample(self): faces = mesh.faces # For cloth, we store faces as "elements" (treating them as surface elements) self.instantiate(verts, faces) + + # Load UVs from mesh (1:1 mapping for cloth) + try: + ...
genesis/engine/entities/fem_entity.py
26
Python
0.5
suggestion
233
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: ------ Exception If the morph type is unsupported. """ from genesis.engin...
Could you add a comment to explain which attribute may not exist exactly, in which scenario it would be the case (and why this scenario must be supported if not obvious), and why just ignoring UV is the right approach if not obvious.
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._uvs = None else: gs.raise_exception(f"Cloth material only supports Mesh morph. Got: {self.morph}.") else: # Regular FEM: tetrahedralize mesh if isinstance(self.morph, gs.options.morphs.Sphere): verts, elems = eu.sphere...
Why can you assign uvs directly while verts, elems must go through further processing?
if isinstance(mesh.visual, trimesh.visual.texture.TextureVisuals) and mesh.visual.uv is not None: self._uvs = mesh.visual.uv.astype(gs.np_float, copy=False) else: gs.raise_exception(f"Cloth material only supports Mesh morph. Got: {self.morph}.") el...
@@ -419,11 +427,12 @@ def sample(self): elif isinstance(self.morph, gs.options.morphs.Cylinder): verts, elems = eu.cylinder_to_elements() elif isinstance(self.morph, gs.options.morphs.Mesh): - verts, elems = eu.mesh_to_elements( + verts, elems, se...
genesis/engine/entities/fem_entity.py
26
Python
0.214
question
86
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: self._uvs = None else: gs.raise_exception(f"Cloth material only suppo...
Why can you assign uvs directly while verts, elems must go through further processing?
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._uvs = None else: gs.raise_exception(f"Cloth material only supports Mesh morph. Got: {self.morph}.") else: # Regular FEM: tetrahedralize mesh if isinstance(self.morph, gs.options.morphs.Sphere): verts, elems = eu.sphere...
Just return UVS systematically and update all places where this function is being called. Use `, _ = [...]` to assign to new unused return value.
if isinstance(mesh.visual, trimesh.visual.texture.TextureVisuals) and mesh.visual.uv is not None: self._uvs = mesh.visual.uv.astype(gs.np_float, copy=False) else: gs.raise_exception(f"Cloth material only supports Mesh morph. Got: {self.morph}.") el...
@@ -419,11 +427,12 @@ def sample(self): elif isinstance(self.morph, gs.options.morphs.Cylinder): verts, elems = eu.cylinder_to_elements() elif isinstance(self.morph, gs.options.morphs.Mesh): - verts, elems = eu.mesh_to_elements( + verts, elems, se...
genesis/engine/entities/fem_entity.py
26
Python
0.571
suggestion
145
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: self._uvs = None else: gs.raise_exception(f"Cloth material only suppo...
Just return UVS systematically and update all places where this function is being called. Use `, _ = [...]` to assign to new unused return 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.
v_start=self._v_start, el_start=self._el_start, s_start=self._s_start, verts=verts_numpy, elems=elems_np, tri2v=self._surface_tri_np, tri2el=self._surface_el_np, ) # Add UVs to solver if ...
Just extend `_add_to_solver` with the content of `_add_uvs_to_solver`.
mat_idx=self._material.idx, mat_mu=self._material.mu, mat_lam=self._material.lam, mat_rho=self._material.rho, mat_friction_mu=self._material.friction_mu, n_surfaces=self._n_surfaces, v_start=self._v_start, ...
@@ -477,8 +486,23 @@ def _add_to_solver(self, in_backward=False): tri2el=self._surface_el_np, ) + # Add UVs to solver if available + self._add_uvs_to_solver() + self.active = True + def _add_uvs_to_solver(self): + """ + Copy UV coordinates to the...
genesis/engine/entities/fem_entity.py
26
Python
0.357
suggestion
71
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: v_start=self._v_start, el_start=self._el_start, s_start=self._s_start...
Just extend `_add_to_solver` with the content of `_add_uvs_to_solver`.
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.
mat_rho=self._material.rho, mat_friction_mu=self._material.friction_mu, n_surfaces=self._n_surfaces, v_start=self._v_start, el_start=self._el_start, s_start=self._s_start, verts=verts_numpy, e...
This should already be enforced by `instantiate`
elems_np = self.elems.astype(gs.np_int, copy=False) self._solver._kernel_add_elements( f=self._sim.cur_substep_local, mat_idx=self._material.idx, mat_mu=self._material.mu, mat_lam=self._material.lam, mat_rho=self._ma...
@@ -477,8 +486,23 @@ def _add_to_solver(self, in_backward=False): tri2el=self._surface_el_np, ) + # Add UVs to solver if available + self._add_uvs_to_solver() + self.active = True + def _add_uvs_to_solver(self): + """ + Copy UV coordinates to the...
genesis/engine/entities/fem_entity.py
26
Python
0.286
suggestion
49
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: mat_rho=self._material.rho, mat_friction_mu=self._material.friction_mu, ...
This should already be enforced by `instantiate`
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_surfaces=self._n_surfaces, v_start=self._v_start, el_start=self._el_start, s_start=self._s_start, verts=verts_numpy, elems=elems_np, tri2v=self._surface_tri_np, tri2el=self._surface_el_np, ...
This is extremely inefficient (one kernel call per assignment). You should modify `_kernel_add_elements` to take into account `uv`. Just pass an 0-length vector if unspecified and check this condition inside the kernel to avoid out of bound access.
f=self._sim.cur_substep_local, mat_idx=self._material.idx, mat_mu=self._material.mu, mat_lam=self._material.lam, mat_rho=self._material.rho, mat_friction_mu=self._material.friction_mu, n_surfaces=self._n_surf...
@@ -477,8 +486,23 @@ def _add_to_solver(self, in_backward=False): tri2el=self._surface_el_np, ) + # Add UVs to solver if available + self._add_uvs_to_solver() + self.active = True + def _add_uvs_to_solver(self): + """ + Copy UV coordinates to the...
genesis/engine/entities/fem_entity.py
26
Python
0.643
performance
249
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: n_surfaces=self._n_surfaces, v_start=self._v_start, el_start=self._el...
This is extremely inefficient (one kernel call per assignment). You should modify `_kernel_add_elements` to take into account `uv`. Just pass an 0-length vector if unspecified and check this condition inside the kernel to avoid out of bound access.
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 gstaichi as ti import numpy as np import trimesh import genesis as gs import genesis.utils.geom as gu import genesis.utils.mesh as mu from genesis.engine.entities.particle_entity import ParticleEntity class PBDBaseEntity(ParticleEntity): """ Base class for PBD entity. """ def _add_to_solver(s...
I have more or less the same remarks than for FEM.
import gstaichi as ti import numpy as np import trimesh import genesis as gs import genesis.utils.geom as gu import genesis.utils.mesh as mu from genesis.engine.entities.particle_entity import ParticleEntity class PBDBaseEntity(ParticleEntity): """ Base class for PBD entity. """ def _add_to_solver(s...
genesis/engine/entities/pbd_entity.py
1
Python
0.214
suggestion
50
26
26
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/pbd_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: import gstaichi as ti import numpy as np import trimesh import genesis as gs import genesis.utils.geom as gu import ...
I have more or less the same remarks than for FEM.
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.
0, self._ckpt[ckpt_name]["pos"], self._ckpt[ckpt_name]["vel"], self._ckpt[ckpt_name]["active"], ) for entity in self._entities: entity.load_ckpt(ckpt_name=ckpt_name) # ------------------------------------------...
Just enforce return uvs systematically now. This is private API. No backward compatibility concerns.
) for entity in self._entities: entity.load_ckpt(ckpt_name=ckpt_name) # ------------------------------------------------------------------------------------ # --------------------------------------- io ----------------------------------------- # --------------------...
@@ -1092,11 +1099,14 @@ def get_state(self, f): state = None return state - def get_state_render(self, f): + def get_state_render(self, f, include_uvs=False):
genesis/engine/solvers/fem_solver.py
26
Python
0.357
suggestion
100
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/solvers/fem_solver.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: 0, self._ckpt[ckpt_name]["pos"], self._ckpt[ckpt_name]["vel"], ...
Just enforce return uvs systematically now. This is private API. No backward compatibility concerns.
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_hashkey(*args): hasher = hashlib.sha256() for arg in (*args, gs.__version__.encode()): if isinstance(arg, Path): file_stats = arg.stat() arg = (str(arg).encode(), file_stats.st_size, file_stats.st_mtime) if isinstance(arg, str): arg = arg.encode() ...
Why skipping texture would make sense in the first place. This is weird. I would suggest to just load texture systematically, and if it fails, fallback to loading without texture, with a `gs.logger.warning` stating that texture will be skipped because they failed to load.
def get_hashkey(*args): hasher = hashlib.sha256() for arg in (*args, gs.__version__.encode()): if isinstance(arg, Path): file_stats = arg.stat() arg = (str(arg).encode(), file_stats.st_size, file_stats.st_mtime) if isinstance(arg, str): arg = arg.encode() ...
@@ -180,9 +180,9 @@ def get_hashkey(*args): return hasher.hexdigest() -def load_mesh(file): +def load_mesh(file, skip_texture=True): if isinstance(file, (str, Path)): - return trimesh.load(file, force="mesh", skip_texture=True) + return trimesh.load(file, force="mesh", skip_texture=skip_text...
genesis/utils/mesh.py
26
Python
0.643
bug
272
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/utils/mesh.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: def get_hashkey(*args): hasher = hashlib.sha256() for arg in (*args, gs.__version__.encode()): if isinstance(arg, Pat...
Why skipping texture would make sense in the first place. This is weird. I would suggest to just load texture systematically, and if it fails, fallback to loading without texture, with a `gs.logger.warning` stating that texture will be skipped because they failed to load.
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 morph type is unsupported. """ from genesis.engine.materials.FEM.cloth import Cloth as ClothMaterial is_cloth = isinstance(self.material, ClothMaterial) self._uvs = None if is_cloth: # Cloth: load surface mesh directly (no tetrahedralization) ...
* Everything must fit into 120 chars limit, including comments * We prefer explicit check instead of try-except in this context ```python # Load UVs from mesh (1:1 mapping for cloth). # UVs are not always available in 3D file, in case they are missing we set the entity UVs to None when UVs are None, # the solver will ...
If the morph type is unsupported. """ from genesis.engine.materials.FEM.cloth import Cloth as ClothMaterial is_cloth = isinstance(self.material, ClothMaterial) self._uvs = None if is_cloth: # Cloth: load surface mesh directly (no tetrahedralization) ...
@@ -400,6 +401,15 @@ def sample(self): faces = mesh.faces # For cloth, we store faces as "elements" (treating them as surface elements) self.instantiate(verts, faces) + + # Load UVs from mesh (1:1 mapping for cloth) + try: + ...
genesis/engine/entities/fem_entity.py
26
Python
1
suggestion
601
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: If the morph type is unsupported. """ from genesis.engine.materials.FEM.cloth import Clot...
* Everything must fit into 120 chars limit, including comments * We prefer explicit check instead of try-except in this context ```python # Load UVs from mesh (1:1 mapping for cloth). # UVs are not always available in 3D file, in case they are missing we set the entity UVs to None when UVs are None, # the solver will ...
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.
# We can't generate UVs for newly created internal vertices as it doesn't make sense but they're # not used for rendering so it's fine. verts, elems, self._uvs = eu.mesh_to_elements( file=self._morph.file, pos=self._morph.pos, ...
Why are you not just setting `self._uvs = np.zeros((0, 2), dtype=gs.np_float)` instead of `None` in the first place? Then you could pass `self._uvs` directly instead of going through `uvs_np`. Because you want the property `.uvs` to return None if not specified? If so, I'm ok, I don't have a strong opinion.
# not used for rendering so it's fine. verts, elems, self._uvs = eu.mesh_to_elements( file=self._morph.file, pos=self._morph.pos, scale=self._morph.scale, tet_cfg=self.tet_cfg, ) e...
@@ -443,6 +457,7 @@ def _add_to_solver(self, in_backward=False): # Convert to appropriate numpy array types verts_numpy = tensor_to_array(self.init_positions, dtype=gs.np_float) + uvs_np = self._uvs if self._uvs is not None else np.zeros((0, 2), dtype=gs.np_float)
genesis/engine/entities/fem_entity.py
26
Python
0.786
question
310
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/fem_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: # We can't generate UVs for newly created internal vertices as it doesn't make sense but they're ...
Why are you not just setting `self._uvs = np.zeros((0, 2), dtype=gs.np_float)` instead of `None` in the first place? Then you could pass `self._uvs` directly instead of going through `uvs_np`. Because you want the property `.uvs` to return None if not specified? If so, I'm ok, I don't have a strong opinion.
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 genesis.utils.geom as gu import genesis.utils.mesh as mu from genesis.engine.entities.particle_entity import ParticleEntity class PBDBaseEntity(ParticleEntity): """ Base class for PBD entity. """ def _add_to_solver(self): super()._add_to_solver() self._add_uvs_and_faces_to_solv...
Single line if it fits: `self._kernel_add_uvs_and_faces_to_solver(uvs=uvs, faces=self._vfaces)`
import genesis.utils.geom as gu import genesis.utils.mesh as mu from genesis.engine.entities.particle_entity import ParticleEntity class PBDBaseEntity(ParticleEntity): """ Base class for PBD entity. """ def _add_to_solver(self): super()._add_to_solver() # Get UVs from vmesh (may be N...
@@ -13,6 +13,46 @@ class PBDBaseEntity(ParticleEntity): Base class for PBD entity. """ + def _add_to_solver(self): + super()._add_to_solver() + self._add_uvs_and_faces_to_solver() + + def _add_uvs_and_faces_to_solver(self): + """Add UV coordinates and face indices to the solver's ...
genesis/engine/entities/pbd_entity.py
26
Python
0.357
suggestion
95
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/pbd_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: import genesis.utils.geom as gu import genesis.utils.mesh as mu from genesis.engine.entities.particle_entity import P...
Single line if it fits: `self._kernel_add_uvs_and_faces_to_solver(uvs=uvs, faces=self._vfaces)`
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_add_uvs_and_faces_to_solver( uvs=uvs, faces=self._vfaces, ) @ti.kernel def _kernel_add_uvs_and_faces_to_solver( self, uvs: ti.types.ndarray(element_dim=1), faces: ti.types.ndarray(element_dim=1), ): # Copy UVs to solver's...
Remove cast, it should not be necessary. You should rather cast the input argument before calling this kernel.
@ti.kernel def _kernel_add_uvs_and_faces_to_solver( self, uvs: ti.types.ndarray(element_dim=1), faces: ti.types.ndarray(element_dim=1), ): # Copy UVs to solver's global UV buffer (skip if no UVs provided) n_uvs = uvs.shape[0] for i_vv_ in range(n_uvs): ...
@@ -13,6 +13,46 @@ class PBDBaseEntity(ParticleEntity): Base class for PBD entity. """ + def _add_to_solver(self): + super()._add_to_solver() + self._add_uvs_and_faces_to_solver() + + def _add_uvs_and_faces_to_solver(self): + """Add UV coordinates and face indices to the solver's ...
genesis/engine/entities/pbd_entity.py
26
Python
0.571
suggestion
110
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/engine/entities/pbd_entity.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: self._kernel_add_uvs_and_faces_to_solver( uvs=uvs, faces=self._vfaces, ) ...
Remove cast, it should not be necessary. You should rather cast the input argument before calling this kernel.
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.logger.info("Ignoring corrupted cache.") if not is_cached_loaded: with gs.logger.timer(f"Tetrahedralization with configuration {tet_cfg} and generating `.tet` file:"): verts, elems = mu.tetrahedralize_mesh(mesh, tet_cfg) os.makedirs(os.path.dirname(tet_file_path), ex...
`uvs = np.pad(original_uvs, ((0, len(verts) - n_original), (0, 0)))`
gs.logger.info("Ignoring corrupted cache.") if not is_cached_loaded: with gs.logger.timer(f"Tetrahedralization with configuration {tet_cfg} and generating `.tet` file:"): verts, elems = mu.tetrahedralize_mesh(mesh, tet_cfg) os.makedirs(os.path.dirname(tet_file_path), ex...
@@ -54,12 +55,27 @@ def mesh_to_elements(file, pos=(0, 0, 0), scale=1.0, tet_cfg=dict()): verts, elems = mu.tetrahedralize_mesh(mesh, tet_cfg) os.makedirs(os.path.dirname(tet_file_path), exist_ok=True) - with open(tet_file_path, "wb") as file: - pkl.dump((verts, ele...
genesis/utils/element.py
26
Python
0.357
suggestion
68
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: genesis/utils/element.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: gs.logger.info("Ignoring corrupted cache.") if not is_cached_loaded: with gs.logger.timer(f"Tetrahedraliz...
`uvs = np.pad(original_uvs, ((0, len(verts) - n_original), (0, 0)))`
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.
substeps=6, ), pbd_options=gs.options.PBDOptions( particle_size=1e-2, ), fem_options=gs.options.FEMOptions( use_implicit_solver=True, # Implicit solver allows for larger timestep without failure on GPU backend n_pcg_iterations=40, # Reduc...
Use `get_hf_dataset`, eg: ```python asset_path = get_hf_dataset(pattern="heavy_three_joint_link.xml") robot_1 = scene.add_entity( gs.morphs.MJCF( file=f"{asset_path}/heavy_three_joint_link.xml", pos=(-0.2, -0.26, 0.0), scale=0.3, ), ) ```
substeps=6, ), pbd_options=gs.options.PBDOptions( particle_size=1e-2, ), fem_options=gs.options.FEMOptions( use_implicit_solver=True, # Implicit solver allows for larger timestep without failure on GPU backend n_pcg_iterations=40, # Reduc...
@@ -1543,3 +1543,90 @@ def test_add_camera_vs_interactive_viewer_consistency(add_box, renderer_type, sh f"interactive viewer brightness ({viewer_brightness:.2f}), " f"but ratio is {brightness_ratio:.2f}" ) + + +@pytest.mark.parametrize("renderer_type", [RENDERER_TYPE.RASTERIZER, RENDERER_TYPE.RAY...
tests/test_render.py
26
Python
0.857
suggestion
302
51
51
false
[FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities.
2,323
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alelievr
Review this pull request change. Language: Python File: tests/test_render.py PR Title: [FEATURE] Track mesh UVs in FEM/PBD solvers for rendering of deformable entities. BEFORE CODE: substeps=6, ), pbd_options=gs.options.PBDOptions( particle_size=1e-2, ), fem_o...
Use `get_hf_dataset`, eg: ```python asset_path = get_hf_dataset(pattern="heavy_three_joint_link.xml") robot_1 = scene.add_entity( gs.morphs.MJCF( file=f"{asset_path}/heavy_three_joint_link.xml", pos=(-0.2, -0.26, 0.0), scale=0.3, ), ) ```
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.rigid_solver._func_forward_kinematics_entity( i_e=robot.idx, envs_idx=torch.tensor((1,), dtype=gs.tc_int, device=gs.device) ) assert_allclose(index_finger_distal.get_pos(envs_idx=(1,)), index_finger_pos, tol=TOL) assert_allclose(middle_finger_distal.get_pos(envs_idx=(1,)), middle_finger_po...
can we add a variant for (n_envs > 1)
envs_idx=(1,), pos_tol=TOL, rot_tol=TOL, return_error=True, ) assert qpos.shape == (1, robot.n_qs) assert err.shape == (1, 3, 6) assert err.abs().max() < TOL if show_viewer: robot.set_qpos(qpos, envs_idx=(1,)) scene.visualizer.update() links_pos, ...
@@ -1575,6 +1575,127 @@ def test_multilink_inverse_kinematics(show_viewer): assert_allclose(wrist.get_pos(envs_idx=(1,)), wrist_pos, tol=TOL) +@pytest.mark.required +@pytest.mark.parametrize("backend", [gs.cpu, gs.gpu]) +def test_inverse_kinematics_local_point(show_viewer): + """Test IK with local_point par...
tests/test_rigid_physics.py
26
Python
0.071
suggestion
37
51
51
false
[FEATURE] #2332 Implement Local Offset in Inverse Kinematics
2,333
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
alexis779
Review this pull request change. Language: Python File: tests/test_rigid_physics.py PR Title: [FEATURE] #2332 Implement Local Offset in Inverse Kinematics BEFORE CODE: scene.rigid_solver._func_forward_kinematics_entity( i_e=robot.idx, envs_idx=torch.tensor((1,), dtype=gs.tc_int, device=gs.device) ) ...
can we add a variant for (n_envs > 1)
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("Target link not provided.") poss = list(poss) if poss is not None else [] if not poss: poss = [None for _ in range(n_links)] pos_mask = [False, False, False] elif len(poss) != n_links: gs.raise_exception("Accepting only `poss` ...
`local_points[i] = torch.as_tensor(lp, dtype=gs.tc_float, device=gs.device)` `contiguous()` is useless here, you are stacking afterward anyway.
gs.raise_exception("Target link not provided.") poss = list(poss) if poss is not None else [] if not poss: poss = [None for _ in range(n_links)] pos_mask = [False, False, False] elif len(poss) != n_links: gs.raise_exception("Accepting only `poss` ...
@@ -1611,6 +1623,18 @@ def inverse_kinematics_multilink( elif len(quats) != n_links: gs.raise_exception("Accepting only `quats` with length equal to `links` or empty list.") + # Process local_points - default to origin [0, 0, 0] for each link + local_points = list(local_points) if ...
genesis/engine/entities/rigid_entity/rigid_entity.py
26
Python
0.714
suggestion
144
51
51
false
[FEATURE] #2332 Implement Local Offset in Inverse Kinematics
2,333
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alexis779
Review this pull request change. Language: Python File: genesis/engine/entities/rigid_entity/rigid_entity.py PR Title: [FEATURE] #2332 Implement Local Offset in Inverse Kinematics BEFORE CODE: gs.raise_exception("Target link not provided.") poss = list(poss) if poss is not None else [] ...
`local_points[i] = torch.as_tensor(lp, dtype=gs.tc_float, device=gs.device)` `contiguous()` is useless here, you are stacking afterward anyway.
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_error=True, ) assert qpos.shape == (1, robot.n_qs) assert err.shape == (1, 3, 6) assert err.abs().max() < TOL if show_viewer: robot.set_qpos(qpos, envs_idx=(1,)) scene.visualizer.update() links_pos, links_quat = robot.forward_kinematics(qpos, envs_idx=(1,)) as...
Remove this. I don’t think we need to test this on both backends systematically. Then we merge.
return_error=True, ) assert qpos.shape == (1, robot.n_qs) assert err.shape == (1, 3, 6) assert err.abs().max() < TOL if show_viewer: robot.set_qpos(qpos, envs_idx=(1,)) scene.visualizer.update() links_pos, links_quat = robot.forward_kinematics(qpos, envs_idx=(1,)) as...
@@ -1593,6 +1593,150 @@ def test_multilink_inverse_kinematics(show_viewer): assert_allclose(wrist.get_pos(envs_idx=(1,)), wrist_pos, tol=TOL) +@pytest.mark.required +@pytest.mark.parametrize("n_envs", [0, 2]) +@pytest.mark.parametrize("backend", [gs.cpu, gs.gpu])
tests/test_rigid_physics.py
26
Python
0.286
refactor
95
51
51
false
[FEATURE] #2332 Implement Local Offset in Inverse Kinematics
2,333
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alexis779
Review this pull request change. Language: Python File: tests/test_rigid_physics.py PR Title: [FEATURE] #2332 Implement Local Offset in Inverse Kinematics BEFORE CODE: return_error=True, ) assert qpos.shape == (1, robot.n_qs) assert err.shape == (1, 3, 6) assert err.abs().max() < TOL if ...
Remove this. I don’t think we need to test this on both backends systematically. Then we merge.
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.
@dataclass class RasterizerCameraSharedMetadata(RigidSensorMetadataMixin, SharedSensorMetadata): """Shared metadata for all Rasterizer cameras.""" # Rasterizer instance renderer: Optional["Rasterizer"] = None # RasterizerContext instance context: Optional["RasterizerContext"] = None # List of l...
This change is useless. Revert it.
@dataclass class RasterizerCameraSharedMetadata(RigidSensorMetadataMixin, SharedSensorMetadata): """Shared metadata for all Rasterizer cameras.""" # Rasterizer instance renderer: Optional["Rasterizer"] = None # RasterizerContext instance context: Optional["RasterizerContext"] = None # List of ...
@@ -160,10 +160,10 @@ def destroy(self): if self.renderer is not None: self.renderer.destroy() - self.renderer = None if self.context is not None: self.context.destroy() - self.context = None + self.renderer = None + self.context = None
genesis/engine/sensors/camera.py
26
Python
0.143
suggestion
34
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: @dataclass class RasterizerCameraSharedMetadata(RigidSensorMetadataMixin, SharedSensorMetadata): ...
This change is useless. Revert 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.
# ========================== Sensor Lifecycle ========================== def build(self): """Initialize the rasterizer and register this camera.""" super().build() scene = self._manager._sim.scene if self._shared_metadata.sensors is None: self._shared_metadata.sens...
We should support multiple OpenGL context in parallel. Here you are hiding a bug while complexifying the implementation.
# ========================== Sensor Lifecycle ========================== def build(self): """Initialize the rasterizer and register this camera.""" super().build() scene = self._manager._sim.scene if self._shared_metadata.sensors is None: self._shared_metadata.sen...
@@ -431,29 +432,47 @@ def build(self): self._shared_metadata.lights = gs.List() self._shared_metadata.image_cache = {} - # Create standalone rasterizer - self._shared_metadata.context = self._create_standalone_context(scene) - - self._shared_metadata.renderer...
genesis/engine/sensors/camera.py
26
Python
0.571
bug
120
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: # ========================== Sensor Lifecycle ========================== def build(self):...
We should support multiple OpenGL context in parallel. Here you are hiding a bug while complexifying the implementation.
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.
morph = gs.morphs.Sphere(pos=pos, radius=radius) scene.add_mesh_light( morph=morph, color=(*color, 1.0), intensity=intensity, revert_dir=revert_dir, double_sided=double_sided, cutoff=cutoff, ) def _render_current_state...
Why are you forcing a copy. This is wrong.
def _render_current_state(self): """Perform the actual render for the current state.""" if self._link is not None: self._camera_obj.move_to_attach() rgb_arr, _, _, _ = self._camera_obj.render( rgb=True, depth=False, segmentation=False, ...
@@ -699,7 +727,7 @@ def _render_current_state(self): antialiasing=False, force_render=True, ) - rgb_tensor = torch.from_numpy(rgb_arr).to(dtype=torch.uint8, device=gs.device) + rgb_tensor = torch.from_numpy(rgb_arr.copy()).to(dtype=torch.uint8, device=gs.device)
genesis/engine/sensors/camera.py
26
Python
0.071
bug
42
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: morph = gs.morphs.Sphere(pos=pos, radius=radius) scene.add_mesh_light( ...
Why are you forcing a copy. This is wrong.
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 shared_metadata.renderer is None @pytest.mark.required @pytest.mark.parametrize("backend", [gs.cuda]) @pytest.mark.skipif(not ENABLE_RAYTRACER, reason="RayTracer is not supported because 'LuisaRenderPy' is not available.") def test_raytracer_attached_without_offset_T(): """Test that RaytracerCameraSens...
I would rather update `test_raytracer` to add `pos=(0.0, 0.0, 2.0),` to `camera_1` instead of adding a new test? Because every single test we add is very costly (it requires building an entire scene), so it can be avoided, it is much better.
assert shared_metadata.renderer is None @pytest.mark.required @pytest.mark.parametrize("backend", [gs.cuda]) @pytest.mark.skipif(not ENABLE_RAYTRACER, reason="RayTracer is not supported because 'LuisaRenderPy' is not available.") def test_raytracer_attached_without_offset_T(): """Test that RaytracerCameraSens...
@@ -418,6 +418,31 @@ def test_raytracer_destroy(): assert shared_metadata.renderer is None +@pytest.mark.required +@pytest.mark.parametrize("backend", [gs.cuda]) +@pytest.mark.skipif(not ENABLE_RAYTRACER, reason="RayTracer is not supported because 'LuisaRenderPy' is not available.") +def test_raytracer_attache...
tests/test_sensor_camera.py
26
Python
0.643
suggestion
241
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: assert shared_metadata.renderer is None @pytest.mark.required @pytest.mark.parametrize("backend",...
I would rather update `test_raytracer` to add `pos=(0.0, 0.0, 2.0),` to `camera_1` instead of adding a new test? Because every single test we add is very costly (it requires building an entire scene), so it can be avoided, it is much better.
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.
pyrender_viewer = scene.visualizer.viewer._pyrender_viewer assert pyrender_viewer.is_active viewer_rgb, *_ = pyrender_viewer.render_offscreen( pyrender_viewer._camera_node, pyrender_viewer._renderer, rgb=True, depth=False, seg=False, normal=False ) # Render from add_camera add_cam_rgb, ...
Why are you doing this? You need to have very strong motivations to add some xfail. Here you are basically saying that your fix does not work on windows.
@pytest.mark.parametrize("renderer_type", [RENDERER_TYPE.RASTERIZER, RENDERER_TYPE.RAYTRACER]) def test_deformable_uv_textures(renderer_type, renderer, backend, show_viewer, png_snapshot): CAM_RES = (256, 256) # Increase tolerance for deformable rendering png_snapshot.extension._std_err_threshold = 15.0 ...
@@ -1543,3 +1543,31 @@ def test_add_camera_vs_interactive_viewer_consistency(add_box, renderer_type, sh f"interactive viewer brightness ({viewer_brightness:.2f}), " f"but ratio is {brightness_ratio:.2f}" ) + + +@pytest.mark.required +@pytest.mark.parametrize("renderer_type", [RENDERER_TYPE.RASTER...
tests/test_render.py
26
Python
0.357
bug
153
49
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: tests/test_render.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: pyrender_viewer = scene.visualizer.viewer._pyrender_viewer assert pyrender_viewer.is_active viewer...
Why are you doing this? You need to have very strong motivations to add some xfail. Here you are basically saying that your fix does not work on windows.
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.
# Compare brightness (mean pixel value) viewer_brightness = viewer_rgb.mean() add_cam_brightness = add_cam_rgb.mean() brightness_ratio = add_cam_brightness / viewer_brightness assert 0.99 <= brightness_ratio <= 1.01, ( f"add_camera brightness ({add_cam_brightness:.2f}) should match " ...
`viewer_options=gs.options.ViewerOptions(run_in_thread=False),`
dt=0.04, substeps=6, ), pbd_options=gs.options.PBDOptions( particle_size=1e-2, ), fem_options=gs.options.FEMOptions( use_implicit_solver=True, # Implicit solver allows for larger timestep without failure on GPU backend n_pcg_it...
@@ -1543,3 +1543,31 @@ def test_add_camera_vs_interactive_viewer_consistency(add_box, renderer_type, sh f"interactive viewer brightness ({viewer_brightness:.2f}), " f"but ratio is {brightness_ratio:.2f}" ) + + +@pytest.mark.required +@pytest.mark.parametrize("renderer_type", [RENDERER_TYPE.RASTER...
tests/test_render.py
26
Python
0.5
suggestion
63
39
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: tests/test_render.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: # Compare brightness (mean pixel value) viewer_brightness = viewer_rgb.mean() add_cam_brightness =...
`viewer_options=gs.options.ViewerOptions(run_in_thread=False),`
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() cam1.read() cam2.read() shared_metadata = cam1._shared_metadata assert cam1._shared_metadata is cam2._shared_metadata assert len(shared_metadata.sensors) == 2 assert shared_metadata.renderer is not None scene.destroy() assert shared_metadata.sensors is None asse...
Could you check consistency with other camera explicitly? That would be much better.
scene.build() cam1.read() cam2.read() shared_metadata = cam1._shared_metadata assert cam1._shared_metadata is cam2._shared_metadata assert len(shared_metadata.sensors) == 2 assert shared_metadata.renderer is not None scene.destroy() assert shared_metadata.sensors is None asse...
@@ -418,6 +418,31 @@ def test_raytracer_destroy(): assert shared_metadata.renderer is None +@pytest.mark.required +@pytest.mark.parametrize("backend", [gs.cuda]) +@pytest.mark.skipif(not ENABLE_RAYTRACER, reason="RayTracer is not supported because 'LuisaRenderPy' is not available.") +def test_raytracer_attache...
tests/test_sensor_camera.py
26
Python
0.286
question
84
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: tests/test_sensor_camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: scene.build() cam1.read() cam2.read() shared_metadata = cam1._shared_metadata ass...
Could you check consistency with other camera explicitly? That would be much better.
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 enum import itertools import os import re import sys import time import numpy as np import pyglet import pytest import torch import OpenGL.error import genesis as gs import genesis.utils.geom as gu from genesis.utils import set_random_seed from genesis.utils.image_exporter import FrameImageExporter, as_graysca...
Add a comment to explain that adding at least one entity is necessary to make sure the rendered image is not entirely blank, otherwise it is not possible to make sure something was actually rendered.
# Render and verify rgb_arr, *_ = camera.render(rgb=True) rgb_arr = tensor_to_array(rgb_arr) # Snapshot test for visual regression assert rgb_array_to_png_bytes(rgb_arr) == png_snapshot @pytest.mark.required @pytest.mark.parametrize("renderer_type", [RENDERER_TYPE.RASTERIZER]) @pytest.mark.skipi...
@@ -1543,3 +1543,31 @@ def test_add_camera_vs_interactive_viewer_consistency(add_box, renderer_type, sh f"interactive viewer brightness ({viewer_brightness:.2f}), " f"but ratio is {brightness_ratio:.2f}" ) + + +@pytest.mark.required +@pytest.mark.parametrize("renderer_type", [RENDERER_TYPE.RASTER...
tests/test_render.py
26
Python
0.357
suggestion
199
1,574
35
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: tests/test_render.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: import enum import itertools import os import re import sys import time import numpy as np import pyglet impo...
Add a comment to explain that adding at least one entity is necessary to make sure the rendered image is not entirely blank, otherwise it is not possible to make sure something was actually rendered.
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.
elif self._link is not None: # Link exists but not built yet - use configured pose as-is (treat as world coordinates for now) # This will be corrected when move_to_attach is called pass transform = pos_lookat_up_to_T(pos, lookat, up) camera_wrapper = self._ge...
The `if` condition is useless since `self._register_camera_with_renderer()` is already an no-op if already registered.
# This will be corrected when move_to_attach is called pass transform = pos_lookat_up_to_T(pos, lookat, up) self._camera_wrapper.transform = tensor_to_array(transform) self._shared_metadata.renderer.update_camera(self._camera_wrapper) def _apply_camera_transform(sel...
@@ -540,6 +559,10 @@ def _apply_camera_transform(self, camera_T: torch.Tensor): def _render_current_state(self): """Perform the actual render for the current state.""" + # Deferred registration for when using visualizer's rasterizer (visualizer now built) + if not self._camera_registered:
genesis/engine/sensors/camera.py
26
Python
0.571
suggestion
118
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: elif self._link is not None: # Link exists but not built yet - use configured ...
The `if` condition is useless since `self._register_camera_with_renderer()` is already an no-op if already registered.
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._shared_metadata.renderer = Rasterizer(viewer=None, context=self._shared_metadata.context) self._shared_metadata.renderer.build() self._shared_metadata.sensors.append(self) # Register camera now if standalone (offscreen), or defer to first render if using visualize...
While you are here, what is the point of `_get_camera_wrapper` ? This function seems useless. It was already the case because, but it is even worse now. Could you remove `_get_camera_wrapper` entirely and replace it direct access to `self._camera_wrapper` ? just add `self._register_camera_with_renderer()` on top of all...
self._shared_metadata.sensors.append(self) # Register camera now if standalone (offscreen), or defer to first render if using visualizer's rasterizer # (visualizer isn't built yet at sensor.build() time) if self._shared_metadata.renderer.offscreen: self._ensure_camera_regist...
@@ -431,29 +432,47 @@ def build(self): self._shared_metadata.lights = gs.List() self._shared_metadata.image_cache = {} - # Create standalone rasterizer - self._shared_metadata.context = self._create_standalone_context(scene) - - self._shared_metadata.renderer...
genesis/engine/sensors/camera.py
26
Python
0.643
suggestion
360
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: self._shared_metadata.renderer = Rasterizer(viewer=None, context=self._shared_meta...
While you are here, what is the point of `_get_camera_wrapper` ? This function seems useless. It was already the case because, but it is even worse now. Could you remove `_get_camera_wrapper` entirely and replace it direct access to `self._camera_wrapper` ? just add `self._register_camera_with_renderer()` on top of all...
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._camera_obj = visualizer.add_camera( res=self._options.res, pos=pos, lookat=lookat, up=up, model=self._options.model, fov=self._options.fov, aperture=self._options.aperture, focus_dist=self._options.focus_dist, ...
Just use `gu.trans_to_T`. It was introduced for this very use case.
spp=self._options.spp, denoise=self._options.denoise, near=0.05, far=100.0, env_idx=None if n_envs == 0 else 0, debug=False, ) # Attach the visualizer camera to the link if this sensor is attached if self._link is not None:...
@@ -652,7 +675,12 @@ def build(self): # Attach the visualizer camera to the link if this sensor is attached if self._link is not None: - offset_T = torch.tensor(self._options.offset_T, dtype=gs.tc_float, device=gs.device) + if self._options.offset_T is not None: + ...
genesis/engine/sensors/camera.py
26
Python
0.429
suggestion
67
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: self._camera_obj = visualizer.add_camera( res=self._options.res, p...
Just use `gu.trans_to_T`. It was introduced for this very use case.
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.
# This avoids OpenGL context conflicts since visualizer's rasterizer routes through viewer.render_offscreen() visualizer = getattr(scene, "visualizer", None) viewer = getattr(visualizer, "_viewer", None) if visualizer else None if viewer is not None: # Us...
Rename this function `_ensure_camera_registered` or anything that may indicate that it is safe to call this function repeatedly. Moreover, what is the point of adding `_with_renderer`? If you think it is useful you can keep it but I'm not sure it is adding much value here.
# If a viewer is active, reuse its windowed OpenGL context for both offscreen and onscreen # rendering, rather than creating a separate headless context which is fragile. if scene.viewer is not None: self._shared_metadata.context = scene.visualizer.context ...
@@ -431,29 +432,47 @@ def build(self): self._shared_metadata.lights = gs.List() self._shared_metadata.image_cache = {} - # Create standalone rasterizer - self._shared_metadata.context = self._create_standalone_context(scene) - - self._shared_metadata.renderer...
genesis/engine/sensors/camera.py
26
Python
0.643
suggestion
274
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: # This avoids OpenGL context conflicts since visualizer's rasterizer routes through vi...
Rename this function `_ensure_camera_registered` or anything that may indicate that it is safe to call this function repeatedly. Moreover, what is the point of adding `_with_renderer`? If you think it is useful you can keep it but I'm not sure it is adding much value here.
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.
# ========================== Rasterizer Camera Sensor ========================== @register_sensor(RasterizerCameraOptions, RasterizerCameraSharedMetadata, CameraData) class RasterizerCameraSensor(BaseCameraSensor): """ Rasterizer camera sensor using OpenGL-based rendering. This sensor renders RGB images...
Please use `is_` (or `has_`) prefix for boolean flags.
# ========================== Rasterizer Camera Sensor ========================== @register_sensor(RasterizerCameraOptions, RasterizerCameraSharedMetadata, CameraData) class RasterizerCameraSensor(BaseCameraSensor): """ Rasterizer camera sensor using OpenGL-based rendering. This sensor renders RGB image...
@@ -417,6 +417,7 @@ def __init__( self._camera_node = None self._camera_target = None self._camera_wrapper = None + self._camera_registered = False
genesis/engine/sensors/camera.py
26
Python
0.429
suggestion
54
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: # ========================== Rasterizer Camera Sensor ========================== @register_sens...
Please use `is_` (or `has_`) prefix for boolean flags.
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.
data_cls: Type[CameraData], manager: "gs.SensorManager", ): super().__init__(options, idx, data_cls, manager) self._options: RasterizerCameraOptions self._camera_node = None self._camera_target = None self._camera_wrapper = None self._camera_registered...
`scene.visualizer` is guaranteed to exist. No point to use `getattr` here.
idx: int, data_cls: Type[CameraData], manager: "gs.SensorManager", ): super().__init__(options, idx, data_cls, manager) self._options: RasterizerCameraOptions self._camera_node = None self._camera_target = None self._camera_wrapper = None self....
@@ -431,29 +432,47 @@ def build(self): self._shared_metadata.lights = gs.List() self._shared_metadata.image_cache = {} - # Create standalone rasterizer - self._shared_metadata.context = self._create_standalone_context(scene) - - self._shared_metadata.renderer...
genesis/engine/sensors/camera.py
26
Python
0.429
suggestion
74
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: data_cls: Type[CameraData], manager: "gs.SensorManager", ): super().__...
`scene.visualizer` is guaranteed to exist. No point to use `getattr` here.
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.
manager: "gs.SensorManager", ): super().__init__(options, idx, data_cls, manager) self._options: RasterizerCameraOptions self._camera_node = None self._camera_target = None self._camera_wrapper = None self._camera_registered = False # ====================...
`visualizer._viewer` is guaranteed to exist. No point to use `getattr` here. Moreover, no need to access it via visualizer, you could get it directly from the scene, which is the expected public API: ```python viewer = scene.viewer ```
data_cls: Type[CameraData], manager: "gs.SensorManager", ): super().__init__(options, idx, data_cls, manager) self._options: RasterizerCameraOptions self._camera_node = None self._camera_target = None self._camera_wrapper = None self._is_camera_registe...
@@ -431,29 +432,47 @@ def build(self): self._shared_metadata.lights = gs.List() self._shared_metadata.image_cache = {} - # Create standalone rasterizer - self._shared_metadata.context = self._create_standalone_context(scene) - - self._shared_metadata.renderer...
genesis/engine/sensors/camera.py
26
Python
0.857
suggestion
235
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: manager: "gs.SensorManager", ): super().__init__(options, idx, data_cls, manag...
`visualizer._viewer` is guaranteed to exist. No point to use `getattr` here. Moreover, no need to access it via visualizer, you could get it directly from the scene, which is the expected public API: ```python viewer = scene.viewer ```
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._camera_target = None self._camera_wrapper = None self._camera_registered = False # ========================== Sensor Lifecycle ========================== def build(self): """Initialize the rasterizer and register this camera.""" super().build() scene = se...
I don't think it is relevant to define proxies for `scene.viewer` and `scene.visualizer`, just use them directly wherever to need to access them.
self._camera_node = None self._camera_target = None self._camera_wrapper = None self._is_camera_registered = False # ========================== Sensor Lifecycle ========================== def build(self): """Initialize the rasterizer and register this camera.""" ...
@@ -431,29 +432,47 @@ def build(self): self._shared_metadata.lights = gs.List() self._shared_metadata.image_cache = {} - # Create standalone rasterizer - self._shared_metadata.context = self._create_standalone_context(scene) - - self._shared_metadata.renderer...
genesis/engine/sensors/camera.py
26
Python
0.571
suggestion
145
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: self._camera_target = None self._camera_wrapper = None self._camera_regist...
I don't think it is relevant to define proxies for `scene.viewer` and `scene.visualizer`, just use them directly wherever to need to access them.
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._options: RasterizerCameraOptions self._camera_node = None self._camera_target = None self._camera_wrapper = None self._camera_registered = False # ========================== Sensor Lifecycle ========================== def build(self): """Initialize the ras...
The point is more about the fact that the same windowed OpenGL context will be reused, which is capable of handling both offscreen and onscreen rendering, whereas managing two contexts, with one being headless and the other windowed, is proven to be very painful and fragile.
super().__init__(options, idx, data_cls, manager) self._options: RasterizerCameraOptions self._camera_node = None self._camera_target = None self._camera_wrapper = None self._is_camera_registered = False # ========================== Sensor Lifecycle =================...
@@ -431,29 +432,47 @@ def build(self): self._shared_metadata.lights = gs.List() self._shared_metadata.image_cache = {} - # Create standalone rasterizer - self._shared_metadata.context = self._create_standalone_context(scene) - - self._shared_metadata.renderer...
genesis/engine/sensors/camera.py
26
Python
0.5
suggestion
275
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: self._options: RasterizerCameraOptions self._camera_node = None self._came...
The point is more about the fact that the same windowed OpenGL context will be reused, which is capable of handling both offscreen and onscreen rendering, whereas managing two contexts, with one being headless and the other windowed, is proven to be very painful and fragile.
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.
transform = pos_lookat_up_to_T(pos, lookat, up) self._camera_wrapper.transform = tensor_to_array(transform) self._shared_metadata.renderer.update_camera(self._camera_wrapper) def _apply_camera_transform(self, camera_T: torch.Tensor): """Update rasterizer camera wrapper from a world...
The CI is currently failing with the error: ```python > rgb_tensor = torch.from_numpy(rgb_arr).to(dtype=torch.uint8, device=gs.device) E ValueError: At least one stride in the given numpy array is negative, and tensors with negative strides are not currently supported. (You can probably work around this by ...
transform = pos_lookat_up_to_T(pos, lookat, up) self._camera_wrapper.transform = tensor_to_array(transform) self._shared_metadata.renderer.update_camera(self._camera_wrapper) def _apply_camera_transform(self, camera_T: torch.Tensor): """Update rasterizer camera wrapper from a world...
@@ -522,35 +539,30 @@ def _update_camera_pose(self): pass transform = pos_lookat_up_to_T(pos, lookat, up) - camera_wrapper = self._get_camera_wrapper() - camera_wrapper.transform = tensor_to_array(transform) - self._shared_metadata.renderer.update_camera(camera_wrapper) - - ...
genesis/engine/sensors/camera.py
26
Python
1
bug
551
51
51
false
[BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer.
2,351
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
YilingQiao
Review this pull request change. Language: Python File: genesis/engine/sensors/camera.py PR Title: [BUG FIX] Fix OpenGL context clash when combining Rasterizer-based camera sensors and interactive viewer. BEFORE CODE: transform = pos_lookat_up_to_T(pos, lookat, up) self._camera_wrapper.transform = ...
The CI is currently failing with the error: ```python > rgb_tensor = torch.from_numpy(rgb_arr).to(dtype=torch.uint8, device=gs.device) E ValueError: At least one stride in the given numpy array is negative, and tensors with negative strides are not currently supported. (You can probably work around this by ...
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.JOINT_TYPE.REVOLUTE: (("angular",),), gs.JOINT_TYPE.PRISMATIC: (("linear",),), gs.JOINT_TYPE.SPHERICAL: ( ("rotX",), ("rotY",), ("rotZ",), ), gs.JOINT_TYPE.FIXED: (), gs.JOINT_TYPE.FREE: ( ("transX",), ("transY",), ("transZ",), ("rotX",)...
Just do: ```python joint_pos = usd_pos_to_numpy(joint_pos_attr.Get()) if joint_pos_attr.HasValue() else gu.zero_pos() ```
DRIVE_NAMES = { gs.JOINT_TYPE.REVOLUTE: (("angular",),), gs.JOINT_TYPE.PRISMATIC: (("linear",),), gs.JOINT_TYPE.SPHERICAL: ( ("rotX",), ("rotY",), ("rotZ",), ), gs.JOINT_TYPE.FIXED: (), gs.JOINT_TYPE.FREE: ( ("transX",), ("transY",), ("transZ",), ...
@@ -40,7 +44,10 @@ def _parse_joint_axis_pos( context: UsdContext, joint: UsdPhysics.Joint, child_link: Usd.Prim, is_body1: bool ) -> Tuple[str, np.ndarray, np.ndarray]: - joint_pos = usd_pos_to_numpy((joint.GetLocalPos1Attr() if is_body1 else joint.GetLocalPos0Attr()).Get()) + joint_pos_attr = joint.GetLo...
genesis/utils/usd/usd_rigid_entity.py
26
Python
0.714
suggestion
121
51
51
false
[BUG FIX] Fix handling of unspecified spatial inertia properties in USD.
2,401
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alanray-tech
Review this pull request change. Language: Python File: genesis/utils/usd/usd_rigid_entity.py PR Title: [BUG FIX] Fix handling of unspecified spatial inertia properties in USD. BEFORE CODE: gs.JOINT_TYPE.REVOLUTE: (("angular",),), gs.JOINT_TYPE.PRISMATIC: (("linear",),), gs.JOINT_TYPE.SPHERICAL: ( ...
Just do: ```python joint_pos = usd_pos_to_numpy(joint_pos_attr.Get()) if joint_pos_attr.HasValue() else gu.zero_pos() ```
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.
l_info["invweight"] = np.full((2,), fill_value=-1.0) # parse link fixed state link_fixed = False if link.HasAPI(UsdPhysics.RigidBodyAPI): rigid_body_api = UsdPhysics.RigidBodyAPI(link) if rigid_body_api.GetKinematicEnabledAttr().Get(): link_fixed = True elif rigid_bo...
Just implement `usd_inertia_to_numpy(inertia_attr.Get())` that calls `np.diag` internally.
# parse link fixed state link_fixed = False if link.HasAPI(UsdPhysics.RigidBodyAPI): rigid_body_api = UsdPhysics.RigidBodyAPI(link) if rigid_body_api.GetKinematicEnabledAttr().Get(): link_fixed = True elif rigid_body_api.GetRigidBodyEnabledAttr().Get() is False: ...
@@ -90,10 +97,21 @@ def _parse_link( # parse link mass properties if link.HasAPI(UsdPhysics.MassAPI): mass_api = UsdPhysics.MassAPI(link) - l_info["inertial_pos"] = usd_pos_to_numpy(mass_api.GetCenterOfMassAttr().Get()) - l_info["inertial_quat"] = usd_quat_to_numpy(mass_api.GetPrincipal...
genesis/utils/usd/usd_rigid_entity.py
26
Python
0.357
suggestion
90
51
51
false
[BUG FIX] Fix handling of unspecified spatial inertia properties in USD.
2,401
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alanray-tech
Review this pull request change. Language: Python File: genesis/utils/usd/usd_rigid_entity.py PR Title: [BUG FIX] Fix handling of unspecified spatial inertia properties in USD. BEFORE CODE: l_info["invweight"] = np.full((2,), fill_value=-1.0) # parse link fixed state link_fixed = False if link.HasA...
Just implement `usd_inertia_to_numpy(inertia_attr.Get())` that calls `np.diag` internally.
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 rigid_body_api.GetKinematicEnabledAttr().Get(): link_fixed = True elif rigid_body_api.GetRigidBodyEnabledAttr().Get() is False: link_fixed = True elif link.HasAPI(UsdPhysics.CollisionAPI): link_fixed = True if morph.fixed: link_fixed = any(parent_idx =...
`l_info["inertial_i"] = usd_inertia_to_numpy(inertia_attr.Get())`
link_fixed = True elif rigid_body_api.GetRigidBodyEnabledAttr().Get() is False: link_fixed = True elif link.HasAPI(UsdPhysics.CollisionAPI): link_fixed = True if morph.fixed: link_fixed = any(parent_idx == -1 for _, parent_idx, _ in joints) # parse link mass...
@@ -90,10 +97,21 @@ def _parse_link( # parse link mass properties if link.HasAPI(UsdPhysics.MassAPI): mass_api = UsdPhysics.MassAPI(link) - l_info["inertial_pos"] = usd_pos_to_numpy(mass_api.GetCenterOfMassAttr().Get()) - l_info["inertial_quat"] = usd_quat_to_numpy(mass_api.GetPrincipal...
genesis/utils/usd/usd_rigid_entity.py
26
Python
0.357
suggestion
65
51
51
false
[BUG FIX] Fix handling of unspecified spatial inertia properties in USD.
2,401
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alanray-tech
Review this pull request change. Language: Python File: genesis/utils/usd/usd_rigid_entity.py PR Title: [BUG FIX] Fix handling of unspecified spatial inertia properties in USD. BEFORE CODE: if rigid_body_api.GetKinematicEnabledAttr().Get(): link_fixed = True elif rigid_body_api.GetRigidB...
`l_info["inertial_i"] = usd_inertia_to_numpy(inertia_attr.Get())`
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 usd_diagonal_inertia_to_numpy(usd_pos: Gf.Vec3f) -> np.ndarray | None: """ Convert USD diagonal inertia to numpy array, handling default and invalid values. The USD Physics MassAPI defines diagonalInertia with default value (0, 0, 0), which is valid but means the inertia should be ignored/computed...
I would rather check `all(math.isfinite(e) for e in inertia)`. Because we do not want to hind random negative values.
def usd_inertia_to_numpy(inertia: Gf.Vec3f) -> np.ndarray | None: """ Convert USD diagonal inertia to numpy diagonal matrix, handling default and invalid values. The USD Physics MassAPI defines diagonalInertia with default value (0, 0, 0), which is valid but means the inertia should be ignored/compute...
@@ -25,18 +26,151 @@ } -def usd_pos_to_numpy(usd_pos: Gf.Vec3f) -> np.ndarray: +def usd_pos_to_numpy(usd_pos: Gf.Vec3f | None) -> np.ndarray: + """ + Convert USD position to numpy array, handling None values. + + Parameters + ---------- + usd_pos : Gf.Vec3f | None + USD position attribute val...
genesis/utils/usd/usd_utils.py
26
Python
0.571
suggestion
117
51
51
false
[BUG FIX] Fix handling of unspecified spatial inertia properties in USD.
2,401
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alanray-tech
Review this pull request change. Language: Python File: genesis/utils/usd/usd_utils.py PR Title: [BUG FIX] Fix handling of unspecified spatial inertia properties in USD. BEFORE CODE: def usd_diagonal_inertia_to_numpy(usd_pos: Gf.Vec3f) -> np.ndarray | None: """ Convert USD diagonal inertia to numpy array, ...
I would rather check `all(math.isfinite(e) for e in inertia)`. Because we do not want to hind random negative values.
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 usd_mass <= 0: return None # Check for invalid values (inf or nan) if np.isinf(usd_mass) or np.isnan(usd_mass): return None return float(usd_mass) def usd_attr_array_to_numpy(attr: Usd.Attribute, dtype: np.dtype, return_none: bool = False) -> np.ndarray | None: if attr.HasValue(...
Do not do this. It hides user-specified invalid values.
if not all(math.isfinite(e) for e in inertia): return None return inertia def usd_mass_to_float(usd_mass: float) -> float | None: """ Convert USD mass to float, handling default and invalid values. The USD Physics MassAPI defines mass with default value 0, which is valid but means the...
@@ -25,18 +26,151 @@ } -def usd_pos_to_numpy(usd_pos: Gf.Vec3f) -> np.ndarray: +def usd_pos_to_numpy(usd_pos: Gf.Vec3f | None) -> np.ndarray: + """ + Convert USD position to numpy array, handling None values. + + Parameters + ---------- + usd_pos : Gf.Vec3f | None + USD position attribute val...
genesis/utils/usd/usd_utils.py
26
Python
0.286
suggestion
55
44
51
false
[BUG FIX] Fix handling of unspecified spatial inertia properties in USD.
2,401
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
alanray-tech
Review this pull request change. Language: Python File: genesis/utils/usd/usd_utils.py PR Title: [BUG FIX] Fix handling of unspecified spatial inertia properties in USD. BEFORE CODE: if usd_mass <= 0: return None # Check for invalid values (inf or nan) if np.isinf(usd_mass) or np.isnan(usd_mass)...
Do not do this. It hides user-specified invalid values.
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 os from frozendict import frozendict import quadrants as qd import numpy as np import torch import genesis as gs import genesis.utils.geom as gu import genesis.utils.array_class as array_class from genesis.engine.solvers.rigid.abd import func_solve_mass_batch from genesis.utils.misc import qd_to_torch from . ...
Why is this optional? I'm not a fan of this kind of hidden magic flag. Only add them if necessary.
from typing import TYPE_CHECKING import numpy as np import quadrants as qd import torch from frozendict import frozendict import genesis as gs import genesis.utils.array_class as array_class import genesis.utils.geom as gu from genesis.engine.solvers.rigid.abd import func_solve_mass_batch from genesis.utils.misc impo...
@@ -20,6 +23,8 @@ IS_OLD_TORCH = tuple(map(int, torch.__version__.split(".")[:2])) < (2, 8) +GS_SOLVER_DECOMPOSE = os.environ.get("GS_SOLVER_DECOMPOSE", "1") == "1" +
genesis/engine/solvers/rigid/constraint/solver.py
26
Python
0.214
question
98
51
51
false
[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
duburcqa
hughperkins
Review this pull request change. Language: Python File: genesis/engine/solvers/rigid/constraint/solver.py PR Title: [MISC] Decompose solver and use parallel Hessian and Cholesky to significantly speedup contact-rich and dynamic simulations. BEFORE CODE: import os from frozendict import frozendict import quadrants ...
Why is this optional? I'm not a fan of this kind of hidden magic flag. Only add them if necessary.
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=constraint_state, static_rigid_sim_config=static_rigid_sim_config, ) @ti.kernel(fastcache=gs.use_fastcache) def _kernel_update_search_direction( constraint_state: array_class.ConstraintState, rigid_global_info: array_class.RigidGlobalInfo, stati...
Same. Remove this registration function if it can be avoid.
constraint_state=constraint_state, static_rigid_sim_config=static_rigid_sim_config, ) @ti.kernel(fastcache=gs.use_fastcache) def _kernel_update_search_direction( constraint_state: array_class.ConstraintState, rigid_global_info: array_class.RigidGlobalInfo, stati...
@@ -0,0 +1,191 @@ +import quadrants as ti + +import genesis as gs +import genesis.utils.array_class as array_class +from genesis.engine.solvers.rigid.constraint import solver + + +@ti.kernel(fastcache=gs.use_fastcache) +def _kernel_linesearch( + entities_info: array_class.EntitiesInfo, + dofs_state: array_class.D...
genesis/engine/solvers/rigid/constraint/solver_breakdown.py
26
Python
0.286
refactor
59
51
51
false
[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
duburcqa
hughperkins
Review this pull request change. Language: Python File: genesis/engine/solvers/rigid/constraint/solver_breakdown.py PR Title: [MISC] Decompose solver and use parallel Hessian and Cholesky to significantly speedup contact-rich and dynamic simulations. BEFORE CODE: constraint_state=constraint_state, ...
Same. Remove this registration function if it can be avoid.
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.kernel(fastcache=gs.use_fastcache) def _kernel_update_search_direction( constraint_state: array_class.ConstraintState, rigid_global_info: array_class.RigidGlobalInfo, static_rigid_sim_config: ti.template(), ): """Step 6: Check convergence and update search direction""" _B = constraint_state.gr...
Why '_macrokernels' suffix? This function is local to this file, just call it `func_solve_decomposed`.
@ti.kernel(fastcache=gs.use_fastcache) def _kernel_update_search_direction( constraint_state: array_class.ConstraintState, rigid_global_info: array_class.RigidGlobalInfo, static_rigid_sim_config: ti.template(), ): """Step 6: Check convergence and update search direction""" _B = constraint_state.gr...
@@ -0,0 +1,191 @@ +import quadrants as ti + +import genesis as gs +import genesis.utils.array_class as array_class +from genesis.engine.solvers.rigid.constraint import solver + + +@ti.kernel(fastcache=gs.use_fastcache) +def _kernel_linesearch( + entities_info: array_class.EntitiesInfo, + dofs_state: array_class.D...
genesis/engine/solvers/rigid/constraint/solver_breakdown.py
26
Python
0.5
refactor
102
51
51
false
[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
duburcqa
hughperkins
Review this pull request change. Language: Python File: genesis/engine/solvers/rigid/constraint/solver_breakdown.py PR Title: [MISC] Decompose solver and use parallel Hessian and Cholesky to significantly speedup contact-rich and dynamic simulations. BEFORE CODE: @ti.kernel(fastcache=gs.use_fastcache) def _kernel...
Why '_macrokernels' suffix? This function is local to this file, just call it `func_solve_decomposed`.
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=constraint_state, static_rigid_sim_config=static_rigid_sim_config, ) @ti.kernel(fastcache=gs.use_fastcache) def _kernel_update_search_direction( constraint_state: array_class.ConstraintState, rigid_global_info: array_class.RigidGlobalInfo, stati...
Remove print. Using logger at debug level.
constraint_state=constraint_state, static_rigid_sim_config=static_rigid_sim_config, ) @ti.kernel(fastcache=gs.use_fastcache) def _kernel_update_search_direction( constraint_state: array_class.ConstraintState, rigid_global_info: array_class.RigidGlobalInfo, stati...
@@ -0,0 +1,191 @@ +import quadrants as ti + +import genesis as gs +import genesis.utils.array_class as array_class +from genesis.engine.solvers.rigid.constraint import solver + + +@ti.kernel(fastcache=gs.use_fastcache) +def _kernel_linesearch( + entities_info: array_class.EntitiesInfo, + dofs_state: array_class.D...
genesis/engine/solvers/rigid/constraint/solver_breakdown.py
26
Python
0.286
bug
42
51
51
false
[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
duburcqa
hughperkins
Review this pull request change. Language: Python File: genesis/engine/solvers/rigid/constraint/solver_breakdown.py PR Title: [MISC] Decompose solver and use parallel Hessian and Cholesky to significantly speedup contact-rich and dynamic simulations. BEFORE CODE: constraint_state=constraint_state, ...
Remove print. Using logger at debug level.
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_info=entities_info, rigid_global_info=rigid_global_info, constraint_state=constraint_state, static_rigid_sim_config=static_rigid_sim_config, ) func_terminate_or_update_descent_batch( i_b, constraint_state=constraint_state,...
`_monolith` is not clear to me. What are you referring to with this keyword?
static_rigid_sim_config=static_rigid_sim_config, ) func_terminate_or_update_descent_batch( i_b, constraint_state=constraint_state, rigid_global_info=rigid_global_info, static_rigid_sim_config=static_rigid_sim_config, ) @qd.perf_dispa...
@@ -2938,13 +2998,30 @@ def func_solve_iter( ) -@qd.kernel(fastcache=gs.use_fastcache) +@qd.perf_dispatch( + get_geometry_hash=lambda *args, **kwargs: (*args, frozendict(kwargs)), warmup=3, active=3, repeat_after_seconds=1.0 +) def func_solve_body( entities_info: array_class.EntitiesInfo, dof...
genesis/engine/solvers/rigid/constraint/solver.py
26
Python
0.357
question
76
51
51
false
[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
duburcqa
hughperkins
Review this pull request change. Language: Python File: genesis/engine/solvers/rigid/constraint/solver.py PR Title: [MISC] Decompose solver and use parallel Hessian and Cholesky to significantly speedup contact-rich and dynamic simulations. BEFORE CODE: entities_info=entities_info, rigid_glo...
`_monolith` is not clear to me. What are you referring to with this keyword?
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.
Note that, for completeness, Genesis code does handle resetting errno to 0, inside set_qpos, but for simplicity, we make resetting errno explicit in this test. """ import copy import importlib.util import xml.etree.ElementTree as ET from pathlib import Path from typing import TYPE_CHECKING, Callable, cast import num...
Could you remove "GJK is iterative so needs more slack.". I don't think it is true.
Note that, for completeness, Genesis code does handle resetting errno to 0, inside set_qpos, but for simplicity, we make resetting errno explicit in this test. """ import copy import importlib.util import xml.etree.ElementTree as ET from pathlib import Path from typing import TYPE_CHECKING, Callable, cast import num...
@@ -49,6 +49,49 @@ ERRNO_CALLED_GJK = 1 << 16 POS_TOL = 1e-2 # otherwise tests fail +# Tolerances for checking results against hand-computed expected values. +# Analytical solutions should be near-exact; GJK is iterative so needs more slack.
tests/test_rigid_physics_analytical_vs_gjk.py
26
Python
0.286
suggestion
83
51
51
false
[MISC] Add expected values for gjk vs analytical collisions
2,413
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_physics_analytical_vs_gjk.py PR Title: [MISC] Add expected values for gjk vs analytical collisions BEFORE CODE: Note that, for completeness, Genesis code does handle resetting errno to 0, inside set_qpos, but for simplicity, we make resetting...
Could you remove "GJK is iterative so needs more slack.". I don't think it is true.
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 xml.etree.ElementTree as ET from pathlib import Path from typing import TYPE_CHECKING, Callable, cast import numpy as np import pytest import genesis as gs from .utils import assert_allclose if TYPE_CHECKING: from genesis.engine.entities.rigid_entity import RigidGeom ERRNO_CALLED_GJK = 1 << 16 POS_TOL =...
You could use `TOL_SINGLE` for this? It is designed for this. `from .conftest import TOL_SINGLE`
import xml.etree.ElementTree as ET from pathlib import Path from typing import TYPE_CHECKING, Callable, cast import numpy as np import pytest import genesis as gs from .utils import assert_allclose from .conftest import TOL_SINGLE if TYPE_CHECKING: from genesis.engine.entities.rigid_entity import RigidGeom ERR...
@@ -49,6 +49,49 @@ ERRNO_CALLED_GJK = 1 << 16 POS_TOL = 1e-2 # otherwise tests fail +# Tolerances for checking results against hand-computed expected values. +# Analytical solutions should be near-exact; GJK is iterative so needs more slack. +# +# Penetration tolerance: absolute error in metres. +# Normal toleranc...
tests/test_rigid_physics_analytical_vs_gjk.py
26
Python
0.429
suggestion
97
51
51
false
[MISC] Add expected values for gjk vs analytical collisions
2,413
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_physics_analytical_vs_gjk.py PR Title: [MISC] Add expected values for gjk vs analytical collisions BEFORE CODE: import xml.etree.ElementTree as ET from pathlib import Path from typing import TYPE_CHECKING, Callable, cast import numpy as np im...
You could use `TOL_SINGLE` for this? It is designed for this. `from .conftest import TOL_SINGLE`
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.
os.environ["EGL_DEVICE_ID"] = str(_get_egl_index(gpu_index)) except (AttributeError, KeyError): # AttributeError: CUDA is not supported on this machine # KeyError: The selected GPU does not support CUDA pass def pytest_add...
Are you sure it is really necessary to expose this many options? I have the feeling just adding `--profile-num-steps` that would be equal to 0 by default should be good enough?
if has_egl: try: os.environ["EGL_DEVICE_ID"] = str(_get_egl_index(gpu_index)) except (AttributeError, KeyError): # AttributeError: CUDA is not supported on this machine # KeyError: The selected GPU does not support C...
@@ -416,13 +416,68 @@ def pytest_addoption(parser): else SUPPRESS ) parser.addoption("--mem-monitoring-filepath", type=str, help=help_text) + parser.addoption("--profile", action="store_true", default=False, help="Enable PyTorch profiling for benchmarks.") + parser.addoption("--profile-wait", t...
tests/conftest.py
26
Python
0.571
question
177
51
51
false
[MISC] Add torch profile facilities to rigid benchmarks.
2,421
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/conftest.py PR Title: [MISC] Add torch profile facilities to rigid benchmarks. BEFORE CODE: os.environ["EGL_DEVICE_ID"] = str(_get_egl_index(gpu_index)) except (AttributeError, KeyError): # Attribut...
Are you sure it is really necessary to expose this many options? I have the feeling just adding `--profile-num-steps` that would be equal to 0 by default should be good enough?
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.
parser.addoption("--vis", action="store_true", default=False, help="Enable interactive viewer.") parser.addoption("--dev", action="store_true", default=False, help="Enable genesis debug mode.") supported, _reason = is_mem_monitoring_supported() help_text = ( "Run memory monitoring, and store...
Use nullcontext; See `examples/speed_benchmark/timers.py`
parser.addoption("--vis", action="store_true", default=False, help="Enable interactive viewer.") parser.addoption("--dev", action="store_true", default=False, help="Enable genesis debug mode.") supported, _reason = is_mem_monitoring_supported() help_text = ( "Run memory monitoring, and store...
@@ -416,13 +418,25 @@ def pytest_addoption(parser): else SUPPRESS ) parser.addoption("--mem-monitoring-filepath", type=str, help=help_text) + if os.environ.get("GS_PROFILING", "0") == "1": + profiling.parser_add_options(parser) @pytest.fixture(scope="session") def show_viewer(pytestco...
tests/conftest.py
26
Python
0.571
suggestion
57
51
51
false
[MISC] Add torch profile facilities to rigid benchmarks.
2,421
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/conftest.py PR Title: [MISC] Add torch profile facilities to rigid benchmarks. BEFORE CODE: parser.addoption("--vis", action="store_true", default=False, help="Enable interactive viewer.") parser.addoption("--dev", action="store_true", defaul...
Use nullcontext; See `examples/speed_benchmark/timers.py`
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.
wait = pytestconfig.getoption("--profile-wait") warmup = pytestconfig.getoption("--profile-warmup") active = pytestconfig.getoption("--profile-active") repeat = pytestconfig.getoption("--profile-repeat") schedule = torch.profiler.schedule(wait=wait, warmup=warmup, active=active, repeat=repeat) ...
I don't get it. What not just use the context as it is designed to be used instead of calling __enter__ and __exit__ manually?
warmup = pytestconfig.getoption("--profile-warmup") active = pytestconfig.getoption("--profile-active") repeat = pytestconfig.getoption("--profile-repeat") schedule = torch.profiler.schedule(wait=wait, warmup=warmup, active=active, repeat=repeat) activities = [ProfilerActivity.CPU] if torch.cu...
@@ -0,0 +1,71 @@ +import argparse +import pytest + + +def parser_add_options(parser: pytest.Parser) -> None: + parser.addoption( + "--profile-wait", + type=int, + required=True, + help="Number of steps to wait before profiling. Depends on what you want to view, since the profile will like...
tests/profiling.py
26
Python
0.429
question
126
31
27
false
[MISC] Add torch profile facilities to rigid benchmarks.
2,421
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/profiling.py PR Title: [MISC] Add torch profile facilities to rigid benchmarks. BEFORE CODE: wait = pytestconfig.getoption("--profile-wait") warmup = pytestconfig.getoption("--profile-warmup") active = pytestconfig.getoption("--profile-active...
I don't get it. What not just use the context as it is designed to be used instead of calling __enter__ and __exit__ manually?
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 write(self, items): nonlocal stream_writers if self.wandb_run is not None: self.wandb_run.log( { "timestamp": self.wandb_run.config["timestamp"], **items, } ) ...
Why not to yield only 'profiler_step' since the other argument is used? I would recommend doing this and extending the API later if necessary.
def write(self, items): nonlocal stream_writers if self.wandb_run is not None: self.wandb_run.log( { "timestamp": self.wandb_run.config["timestamp"], **items, } ) ...
@@ -313,7 +313,8 @@ def write(self, items): @pytest.fixture -def go2(solver, n_envs, gjk): +def go2(solver, n_envs, gjk, pytorch_profiler): + _, profiler_step = pytorch_profiler
tests/test_rigid_benchmarks.py
26
Python
0.429
question
143
51
51
false
[MISC] Add torch profile facilities to rigid benchmarks.
2,421
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add torch profile facilities to rigid benchmarks. BEFORE CODE: def write(self, items): nonlocal stream_writers if self.wandb_run is not None: self.wandb_run.log( ...
Why not to yield only 'profiler_step' since the other argument is used? I would recommend doing this and extending the API later if necessary.
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.
parser.addoption("--vis", action="store_true", default=False, help="Enable interactive viewer.") parser.addoption("--dev", action="store_true", default=False, help="Enable genesis debug mode.") supported, _reason = is_mem_monitoring_supported() help_text = ( "Run memory monitoring, and store...
Why not to move this fixture in profiling since you already created a dedicated file? It would not work?
parser.addoption("--vis", action="store_true", default=False, help="Enable interactive viewer.") parser.addoption("--dev", action="store_true", default=False, help="Enable genesis debug mode.") supported, _reason = is_mem_monitoring_supported() help_text = ( "Run memory monitoring, and store...
@@ -416,13 +418,25 @@ def pytest_addoption(parser): else SUPPRESS ) parser.addoption("--mem-monitoring-filepath", type=str, help=help_text) + if os.environ.get("GS_PROFILING", "0") == "1": + profiling.parser_add_options(parser) @pytest.fixture(scope="session") def show_viewer(pytestco...
tests/conftest.py
26
Python
0.429
refactor
104
51
51
false
[MISC] Add torch profile facilities to rigid benchmarks.
2,421
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/conftest.py PR Title: [MISC] Add torch profile facilities to rigid benchmarks. BEFORE CODE: parser.addoption("--vis", action="store_true", default=False, help="Enable interactive viewer.") parser.addoption("--dev", action="store_true", defaul...
Why not to move this fixture in profiling since you already created a dedicated file? It would not work?
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 write(self, items): nonlocal stream_writers if self.wandb_run is not None: self.wandb_run.log( { "timestamp": self.wandb_run.config["timestamp"], **items, } ) ...
I hate just renaming variables. Just call your fixture `pytorch_profiler_step`, or `profiler_calling` or something.
def write(self, items): nonlocal stream_writers if self.wandb_run is not None: self.wandb_run.log( { "timestamp": self.wandb_run.config["timestamp"], **items, } ) ...
@@ -313,7 +313,8 @@ def write(self, items): @pytest.fixture -def go2(solver, n_envs, gjk): +def go2(solver, n_envs, gjk, pytorch_profiler): + profiler_step = pytorch_profiler
tests/test_rigid_benchmarks.py
26
Python
0.5
style
115
51
51
false
[MISC] Add torch profile facilities to rigid benchmarks.
2,421
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
hughperkins
Review this pull request change. Language: Python File: tests/test_rigid_benchmarks.py PR Title: [MISC] Add torch profile facilities to rigid benchmarks. BEFORE CODE: def write(self, items): nonlocal stream_writers if self.wandb_run is not None: self.wandb_run.log( ...
I hate just renaming variables. Just call your fixture `pytorch_profiler_step`, or `profiler_calling` or something.
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.
# Pre-compute the entity set for rigid state retrieval self._rigid_retrieve_entity_set = set( self._entities_by_coupling_type["two_way_soft_constraint"] + self._entities_by_coupling_type["ipc_only"] + self._articulation_with_non_fixed_base ) # Pre-al...
Just do ` workspace = os.path.join(tempfile.gettempdir(), f"genesis_ipc_{self.sim.scene.uid.full()}")`
# Pre-compute the entity set for rigid state retrieval self._rigid_retrieve_entity_set = set( self._entities_by_coupling_type["two_way_soft_constraint"] + self._entities_by_coupling_type["ipc_only"] + self._articulation_with_non_fixed_base ) # Pre-all...
@@ -316,7 +313,9 @@ def _init_ipc(self): UIPCTimer.disable_all() # Create workspace directory for IPC output, named after scene UID. - workspace = os.path.join(tempfile.gettempdir(), f"genesis_ipc_{self.sim.scene.uid}") + # The UID contains < and > which are illegal in Windows path...
genesis/engine/couplers/ipc_coupler/coupler.py
26
Python
0.5
suggestion
102
51
51
false
[MISC] Remove partially broken IPC contact proxy option.
2,463
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
Roushelfy
Review this pull request change. Language: Python File: genesis/engine/couplers/ipc_coupler/coupler.py PR Title: [MISC] Remove partially broken IPC contact proxy option. BEFORE CODE: # Pre-compute the entity set for rigid state retrieval self._rigid_retrieve_entity_set = set( self._enti...
Just do ` workspace = os.path.join(tempfile.gettempdir(), f"genesis_ipc_{self.sim.scene.uid.full()}")`
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 genesis as gs gs.init() scene = gs.Scene( show_viewer=True, viewer_options=gs.options.ViewerOptions( res=(1280, 960), camera_pos=(3.5, 0.0, 2.5), camera_lookat=(0.0, 0.0, 0.5), camera_fov=50, ), vis_options=gs.options.VisOptions( rendered_envs_idx=list(ra...
No issues found.
import genesis as gs gs.init() scene = gs.Scene( show_viewer=True, viewer_options=gs.options.ViewerOptions( res=(1280, 960), camera_pos=(3.5, 0.0, 2.5), camera_lookat=(0.0, 0.0, 0.5), camera_fov=50, ), vis_options=gs.options.VisOptions( rendered_envs_idx=list(ra...
@@ -0,0 +1,30 @@ +import genesis as gs + +gs.init() + +scene = gs.Scene( + show_viewer=True, + viewer_options=gs.options.ViewerOptions( + res=(1280, 960), + camera_pos=(3.5, 0.0, 2.5), + camera_lookat=(0.0, 0.0, 0.5), + camera_fov=50, + ), + vis_options=gs.options.VisOptions( + ...
examples/tutorials/selecting_rendered_envs.py
0
Python
1
none
16
31
31
true
[FEATURE] Modify n_rendered_envs to rendered_envs_idx
752
Genesis-Embodied-AI/Genesis
26,702
Python
lupinjia
Review this pull request change. Language: Python File: examples/tutorials/selecting_rendered_envs.py PR Title: [FEATURE] Modify n_rendered_envs to rendered_envs_idx BEFORE CODE: import genesis as gs gs.init() scene = gs.Scene( show_viewer=True, viewer_options=gs.options.ViewerOptions( res=(1280, ...
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_d in range(i_d + 1, self._solver.n_dofs): dot = gs.ti_float(0.0) for k_d in range(i_d): dot = dot + self.nt_H[j_d, k_d, i_b] * self.nt_H[i_d, k_d, i_b] self.nt_H[j_d, i_d, i_b] = (self.nt_H[j_d, i_d, i_b] - dot) * tmp @ti.func ...
No issues found.
for j_d in range(i_d + 1, self._solver.n_dofs): dot = gs.ti_float(0.0) for k_d in range(i_d): dot = dot + self.nt_H[j_d, k_d, i_b] * self.nt_H[i_d, k_d, i_b] self.nt_H[j_d, i_d, i_b] = (self.nt_H[j_d, i_d, i_b] - dot) * tmp @ti.func ...
@@ -191,103 +191,169 @@ def add_collision_constraints(self): self.efc_D[n_con, i_b] = 1 / ti.max(diag, gs.EPS) - @ti.kernel - def add_equality_constraints(self): - ti.loop_config(serialize=self._para_level < gs.PARA_LEVEL.PARTIAL) - for i_b in range(self._B): - fo...
genesis/engine/solvers/rigid/constraint_solver_decomp.py
0
Python
1
none
16
51
51
true
[FEATURE] Add equality joint constraint
919
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 equality joint constraint BEFORE CODE: for j_d in range(i_d + 1, self._solver.n_dofs): dot = gs.ti_float(0.0) for k_d in range(i_d): ...
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.
qpos_start : None | array_like, optional The start state. If None, the current state of the rigid entity will be used. Defaults to None. timeout : float, optional The maximum time (in seconds) allowed for the motion planning algorithm to find a solution. Defaults to 5.0. ...
No issues found.
qpos_start : None | array_like, optional The start state. If None, the current state of the rigid entity will be used. Defaults to None. timeout : float, optional The maximum time (in seconds) allowed for the motion planning algorithm to find a solution. Defaults to 5.0. ...
@@ -363,7 +363,7 @@ def _load_MJCF(self, morph, surface): ) def _load_URDF(self, morph, surface): - l_infos, j_infos = uu.parse_urdf(morph, surface) + l_infos, j_infos, equalities = uu.parse_urdf(morph, surface) for i_l in range(len(l_infos)): l_info = l_inf...
genesis/engine/entities/rigid_entity/rigid_entity.py
0
Python
1
none
16
51
51
true
[FEATURE] Support mimic joint in URDF
928
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: [FEATURE] Support mimic joint in URDF BEFORE CODE: qpos_start : None | array_like, optional The start state. If None, the current state of the rigid entity will be used. Default...
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.
quat = xyzw_to_wxyz(quat) else: gs.raise_exception(f"ndim expected to be 2 or 3, but got {T.ndim=}") return trans, quat else: raise TypeError(f"Input must be a torch.Tensor or np.ndarray. Got: {type(T)}") def trans_R_to_T(trans, R): if isinstance(trans, torch.Te...
No issues found.
quat = xyzw_to_wxyz(quat) else: gs.raise_exception(f"ndim expected to be 2 or 3, but got {T.ndim=}") return trans, quat else: raise TypeError(f"Input must be a torch.Tensor or np.ndarray. Got: {type(T)}") def trans_R_to_T(trans, R): if isinstance(trans, torch.Te...
@@ -21,6 +21,11 @@ def ti_transform_quat_by_quat(v, u): return ti.Vector([w, x, y, z]).normalized() +@ti.func +def ti_quat_mul(u, v): + return ti_transform_quat_by_quat(v, u) + + @ti.func def ti_rotvec_to_quat(rotvec): theta = rotvec.norm() @@ -343,6 +348,18 @@ def get_face_norm(v0, v1, v2): ret...
genesis/utils/geom.py
0
Python
1
none
16
51
51
true
[FEATURE] Add weld constraint
948
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
Review this pull request change. Language: Python File: genesis/utils/geom.py PR Title: [FEATURE] Add weld constraint BEFORE CODE: quat = xyzw_to_wxyz(quat) else: gs.raise_exception(f"ndim expected to be 2 or 3, but got {T.ndim=}") return trans, quat else: raise T...
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 enable self collision within each entity. Defaults to False. enable_adjacent_collision : bool, optional Whether to enable collision between successive parent-child body pairs within each entity. Defaults to False. max_collision_pairs : int, optional Maximum number of collision...
No issues found.
Whether to enable self collision within each entity. Defaults to False. enable_adjacent_collision : bool, optional Whether to enable collision between successive parent-child body pairs within each entity. Defaults to False. max_collision_pairs : int, optional Maximum number of collision...
@@ -176,6 +176,8 @@ class RigidOptions(Options): Velocity threshold for hibernation. Defaults to 1e-3. hibernation_thresh_acc : float, optional Acceleration threshold for hibernation. Defaults to 1e-2. + max_dynamic_constraints : int, optional + Maximum number of dynamic constraints (li...
genesis/options/solvers.py
0
Python
1
none
16
51
51
true
[FEATURE] Add suction cup
961
Genesis-Embodied-AI/Genesis
26,702
Python
YilingQiao
Review this pull request change. Language: Python File: genesis/options/solvers.py PR Title: [FEATURE] Add suction cup BEFORE CODE: Whether to enable self collision within each entity. Defaults to False. enable_adjacent_collision : bool, optional Whether to enable collision between successive pa...
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.
"runner_class_name": "OnPolicyRunner", "num_steps_per_env": 100, "save_interval": 100, "empirical_normalization": None, "seed": 1, } return train_cfg_dict def get_cfgs(): env_cfg = { "num_actions": 4, # termination "termination_if_roll_great...
No issues found.
"runner_class_name": "OnPolicyRunner", "num_steps_per_env": 100, "save_interval": 100, "empirical_normalization": None, "seed": 1, } return train_cfg_dict def get_cfgs(): env_cfg = { "num_actions": 4, # termination "termination_if_roll_great...
@@ -6,13 +6,13 @@ try: try: - if metadata.version("rsl-rl-lib"): + if metadata.version("rsl-rl"): raise ImportError except metadata.PackageNotFoundError: - if metadata.version("rsl-rl") != "1.0.2": + if metadata.version("rsl-rl-lib") != "2.2.4": raise I...
examples/drone/hover_train.py
0
Python
1
none
16
51
51
true
[FEATURE] DroneEnv compatible with rsl-rl-lib==2.2.4
1,036
Genesis-Embodied-AI/Genesis
26,702
Python
KafuuChikai
Review this pull request change. Language: Python File: examples/drone/hover_train.py PR Title: [FEATURE] DroneEnv compatible with rsl-rl-lib==2.2.4 BEFORE CODE: "runner_class_name": "OnPolicyRunner", "num_steps_per_env": 100, "save_interval": 100, "empirical_normalization": None, ...
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.sim.mpm_solver.boundary.lower, self.sim.mpm_solver.boundary.upper, ] ), wireframe=True, color...
No issues found.
[ self.sim.mpm_solver.boundary.lower, self.sim.mpm_solver.boundary.upper, ] ), wireframe=True, color...
@@ -648,6 +648,12 @@ def on_fem(self): triangles_all[fem_entity.s_start : (fem_entity.s_start + fem_entity.n_surfaces)] - fem_entity.v_start ) + + # Select only vertices used in surface triangles, then reindex triangles against th...
genesis/vis/rasterizer_context.py
0
Python
1
none
16
51
51
true
[BUG FIX] Fix vertex index mismatch when adding tetrahedralized FEM entities.
1,086
Genesis-Embodied-AI/Genesis
26,702
Python
kosuke1701
Review this pull request change. Language: Python File: genesis/vis/rasterizer_context.py PR Title: [BUG FIX] Fix vertex index mismatch when adding tetrahedralized FEM entities. BEFORE CODE: [ self.sim.mpm_solver.boundary.lower, ...
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.coacd_options is None: self.coacd_options = CoacdOptions() if isinstance(self.file, str): file = os.path.abspath(self.file) if not os.path.exists(file): file = os.path.join(gs.utils.get_assets_dir(), self.file) if not os.path.exi...
No issues found.
if self.coacd_options is None: self.coacd_options = CoacdOptions() if isinstance(self.file, str): file = os.path.abspath(self.file) if not os.path.exists(file): file = os.path.join(gs.utils.get_assets_dir(), self.file) if not os.path.exi...
@@ -16,6 +16,25 @@ """ +class TetGenMixin(Options): + """ + A mixin to introduce TetGen-related options into morph classes that support tetrahedralization using TetGen. + """ + + # FEM specific + order: int = 1 + + # Volumetric mesh entity + mindihedral: int = 10 + minratio: float = 1.1 + ...
genesis/options/morphs.py
0
Python
1
none
16
51
51
true
[FEATURE][BREAKING] Add maxvolume support for TetGen-based tetrahedralization, unify TetGen config handling, and add tests
1,088
Genesis-Embodied-AI/Genesis
26,702
Python
kosuke1701
Review this pull request change. Language: Python File: genesis/options/morphs.py PR Title: [FEATURE][BREAKING] Add maxvolume support for TetGen-based tetrahedralization, unify TetGen config handling, and add tests BEFORE CODE: if self.coacd_options is None: self.coacd_options = CoacdOptions() ...
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.
morph.scale * joint.limit.lower if joint.limit.lower is not None else -np.inf, morph.scale * joint.limit.upper if joint.limit.upper is not None else np.inf, ] ] ) j_info["dofs_stiffness"] = np.array([0.0]) ...
No issues found.
morph.scale * joint.limit.lower if joint.limit.lower is not None else -np.inf, morph.scale * joint.limit.upper if joint.limit.upper is not None else np.inf, ] ] ) j_info["dofs_stiffness"] = np.array([0.0]) ...
@@ -241,8 +241,8 @@ def parse_urdf(morph, surface): j_info["dofs_limit"] = np.array( [ [ - scale * joint.limit.lower if joint.limit.lower is not None else -np.inf, - scale * joint.limit.upper if joint.limit.upper is not Non...
genesis/utils/urdf.py
0
Python
1
none
16
51
51
true
[BUG FIX] Fix scaling of poly-articulated robots.
1,108
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
Review this pull request change. Language: Python File: genesis/utils/urdf.py PR Title: [BUG FIX] Fix scaling of poly-articulated robots. BEFORE CODE: morph.scale * joint.limit.lower if joint.limit.lower is not None else -np.inf, morph.scale * joint.limit.upper if joi...
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.
init_simulators(gs_sim) # Run the simulation for a few steps for i in range(5000): gs_sim.scene.step() if i > 4900: (gs_robot,) = gs_sim.entities qvel = gs_robot.get_dofs_velocity().cpu() assert_allclose(qvel, 0, atol=0.4) qpos = gs_robot.get_dofs_po...
No issues found.
init_simulators(gs_sim) # Run the simulation for a few steps for i in range(5000): gs_sim.scene.step() if i > 4900: (gs_robot,) = gs_sim.entities qvel = gs_robot.get_dofs_velocity().cpu() assert_allclose(qvel, 0, atol=0.4) qpos = gs_robot.get_dofs_po...
@@ -1005,6 +1005,38 @@ def test_suction_cup(mode, show_viewer): move_cube(use_suction=True, mode=mode, show_viewer=show_viewer) +@pytest.mark.parametrize("backend", [gs.cpu, gs.gpu]) +def test_mass_mat(show_viewer, tol): + # Create and build the scene + scene = gs.Scene( + sim_options=gs.options.S...
tests/test_rigid_physics.py
0
Python
1
none
16
51
51
true
[FEATURE] get mass_mat API
1,132
Genesis-Embodied-AI/Genesis
26,702
Python
Kashu7100
Review this pull request change. Language: Python File: tests/test_rigid_physics.py PR Title: [FEATURE] get mass_mat API BEFORE CODE: init_simulators(gs_sim) # Run the simulation for a few steps for i in range(5000): gs_sim.scene.step() if i > 4900: (gs_robot,) = gs_sim.enti...
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 ---------- force_field : gs.force_fields.ForceField The force field to add to the scene. Returns ------- force_field : gs.force_fields.ForceField The added force field. """ force_field.scene = self self._sim._ad...
No issues found.
Parameters ---------- force_field : gs.force_fields.ForceField The force field to add to the scene. Returns ------- force_field : gs.force_fields.ForceField The added force field. """ force_field.scene = self self._sim._ad...
@@ -2,6 +2,11 @@ import torch import genesis as gs +from genesis.engine.entities.base_entity import Entity +from genesis.engine.force_fields import ForceField +from genesis.engine.materials.base import Material +from genesis.options.morphs import Morph +from genesis.options.surfaces import Surface import genesis.u...
genesis/engine/scene.py
0
Python
1
none
16
51
51
true
[MISC] Add some initial mypy typing
1,144
Genesis-Embodied-AI/Genesis
26,702
Python
hughperkins
Review this pull request change. Language: Python File: genesis/engine/scene.py PR Title: [MISC] Add some initial mypy typing BEFORE CODE: Parameters ---------- force_field : gs.force_fields.ForceField The force field to add to the scene. Returns ------- ...
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.
# Get more time to the robot to reach the last waypoint for i in range(100): scene.step() # reach qpos = franka.inverse_kinematics( link=end_effector, pos=np.array([0.65, 0.0, 0.13]), quat=np.array([0, 1, 0, 0]), ) franka.control_dofs_position(qpos[:-2], motors_...
No issues found.
# Get more time to the robot to reach the last waypoint for i in range(100): scene.step() # reach qpos = franka.inverse_kinematics( link=end_effector, pos=np.array([0.65, 0.0, 0.13]), quat=np.array([0, 1, 0, 0]), ) franka.control_dofs_position(qpos[:-2], motors_...
@@ -804,37 +804,63 @@ def test_pd_control(show_viewer): @pytest.mark.required -def test_set_root_pose(show_viewer, tol): +@pytest.mark.parametrize("relative", [False, True]) +def test_set_root_pose(relative, show_viewer, tol): + ROBOT_POS_ZERO = (0.0, 0.4, 0.1) + ROBOT_EULER_ZERO = (0.0, 0.0, 90.0) + CUBE...
tests/test_rigid_physics.py
0
Python
1
none
16
51
51
true
[BUG FIX] Fix urdf support.
1,235
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] Fix urdf support. BEFORE CODE: # Get more time to the robot to reach the last waypoint for i in range(100): scene.step() # reach qpos = franka.inverse_kinematics( link=end_effect...
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.
# DEBUG # self._unif_map = {} def _add_to_context(self): if self._program_id is not None: raise ValueError("Shader program already in context") shader_ids = [] # Load vert shader shader_ids.append(gl_shader_utils.compileShader(self._load(self.vertex_sha...
No issues found.
# DEBUG # self._unif_map = {} def _add_to_context(self): if self._program_id is not None: raise ValueError("Shader program already in context") shader_ids = [] # Load vert shader shader_ids.append(gl_shader_utils.compileShader(self._load(self.vertex_sha...
@@ -221,14 +221,9 @@ def set_uniform(self, name, value, unsigned=False): func1(loc, 1, GL_TRUE, value) # Call correct uniform function - elif isinstance(value, float): - glUniform1f(loc, value) - elif isinstance(value, int): - if unsigned: - ...
genesis/ext/pyrender/shader_program.py
0
Python
1
none
16
51
51
true
[BUG FIX] Various minor bug fixes.
1,256
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
Review this pull request change. Language: Python File: genesis/ext/pyrender/shader_program.py PR Title: [BUG FIX] Various minor bug fixes. BEFORE CODE: # DEBUG # self._unif_map = {} def _add_to_context(self): if self._program_id is not None: raise ValueError("Shader progra...
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.
) actuator_kp = gu.default_dofs_kp(1)[0] actuator_kv = gu.default_dofs_kv(1)[0] elif gainprm[0] != -biasprm[1]: # Doing our best to approximate the expected behavior: g0 * p_target + b1 * p_mes + b2 * v_mes ...
No issues found.
) actuator_kp = gu.default_dofs_kp(1)[0] actuator_kv = gu.default_dofs_kv(1)[0] elif gainprm[0] != -biasprm[1]: # Doing our best to approximate the expected behavior: g0 * p_target + b1 * p_mes + b2 * v_mes ...
@@ -20,7 +20,10 @@ from .misc import get_assets_dir, redirect_libc_stderr -def build_model(xml, discard_visual, merge_fixed_links=False, links_to_keep=()): +MIN_TIMECONST = np.finfo(np.double).eps + + +def build_model(xml, discard_visual, default_armature=None, merge_fixed_links=False, links_to_keep=()): if i...
genesis/utils/mjcf.py
0
Python
1
none
16
51
51
true
[BUG FIX] More robust MJCF / URDF parsing.
1,262
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
Review this pull request change. Language: Python File: genesis/utils/mjcf.py PR Title: [BUG FIX] More robust MJCF / URDF parsing. BEFORE CODE: ) actuator_kp = gu.default_dofs_kp(1)[0] actuator_kv = gu.default_dofs_kv(1)[0] elif gainprm[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.
i_ga, i_gb, i_b ) if is_col: # 1. Project the contact point on both geometries # 2. Revert the effect of sm...
No issues found.
i_ga, i_gb, i_b ) if is_col: # 1. Project the contact point on both geometries # 2. Revert the effect of sm...
@@ -302,72 +302,6 @@ def _func_is_geom_aabbs_overlap(self, i_ga, i_gb, i_b): or (self._solver.geoms_state[i_ga, i_b].aabb_min >= self._solver.geoms_state[i_gb, i_b].aabb_max).any() ) - @ti.func - def _func_convex_geoms_overlap_ratio(self, i_ga, i_gb, i_b): - # Check if one geom 'i_g...
genesis/engine/solvers/rigid/collider_decomp.py
0
Python
1
none
16
51
51
true
[MISC] Optimise benchmark duration.
1,281
Genesis-Embodied-AI/Genesis
26,702
Python
duburcqa
Review this pull request change. Language: Python File: genesis/engine/solvers/rigid/collider_decomp.py PR Title: [MISC] Optimise benchmark duration. BEFORE CODE: i_ga, i_gb, i_b ) if is_col:...
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.