Commit bd64177c authored by Mayank Mittal's avatar Mayank Mittal

Fixes buffer call for raycast sensor

parent 7a76da7f
...@@ -194,9 +194,9 @@ class RayCaster(SensorBase): ...@@ -194,9 +194,9 @@ class RayCaster(SensorBase):
"""Fills the buffers of the sensor data.""" """Fills the buffers of the sensor data."""
# default to all sensors # default to all sensors
if env_ids is None: if env_ids is None:
env_ids = ... env_ids = self._ALL_INDICES
# obtain the poses of the sensors # obtain the poses of the sensors
pos_w, quat_w = self._view.get_world_poses(clone=False) pos_w, quat_w = self._view.get_world_poses(env_ids, clone=False)
self._data.pos_w[env_ids] = pos_w self._data.pos_w[env_ids] = pos_w
self._data.quat_w[env_ids] = quat_w self._data.quat_w[env_ids] = quat_w
......
...@@ -39,6 +39,7 @@ simulation_app = SimulationApp(config) ...@@ -39,6 +39,7 @@ simulation_app = SimulationApp(config)
import numpy as np import numpy as np
import torch
import omni.isaac.core.utils.prims as prim_utils import omni.isaac.core.utils.prims as prim_utils
from omni.isaac.cloner import GridCloner from omni.isaac.cloner import GridCloner
...@@ -145,7 +146,7 @@ def main(): ...@@ -145,7 +146,7 @@ def main():
print(ray_caster) print(ray_caster)
# Get the initial positions of the balls # Get the initial positions of the balls
ball_initial_poses = ball_view.get_world_poses() ball_initial_positions, ball_initial_orientations = ball_view.get_world_poses()
ball_initial_velocities = ball_view.get_velocities() ball_initial_velocities = ball_view.get_velocities()
# Create a counter for resetting the scene # Create a counter for resetting the scene
...@@ -161,11 +162,15 @@ def main(): ...@@ -161,11 +162,15 @@ def main():
continue continue
# Reset the scene # Reset the scene
if step_count % 500 == 0: if step_count % 500 == 0:
# sample random indices to reset
reset_indices = torch.randint(0, num_envs, (num_envs // 2,))
# reset the balls # reset the balls
ball_view.set_world_poses(*ball_initial_poses) ball_view.set_world_poses(
ball_view.set_velocities(ball_initial_velocities) ball_initial_positions[reset_indices], ball_initial_orientations[reset_indices], indices=reset_indices
)
ball_view.set_velocities(ball_initial_velocities[reset_indices], indices=reset_indices)
# reset the sensor # reset the sensor
ray_caster.reset_buffers() ray_caster.reset_buffers(reset_indices)
# reset the counter # reset the counter
step_count = 0 step_count = 0
# Step simulation # Step simulation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment