Repository navigation
Conversation
Signed-off-by: Xinjie Yao <xyao@nvidia.com>
[Medium impact] The PR appears safe to merge based on the code reviewed. SummaryAdds a position-based movement metric and makes it the default for pick-and-place evaluations.
No confirmed actionable issues found. Tests were not run. Reviews (1) · Last reviewed commit: "Add object_displaced_rate metric and use..." · Reviewed by Greptile |
|
|
||
|
|
||
| def compute_object_displaced_rate(recorded_metric_data: list[np.ndarray], displacement_threshold_m: float) -> float: | ||
| """Computes the fraction of episodes in which the object ends up displaced from where it started. |
There was a problem hiding this comment.
🟡 "Ends up" vs. "at any step"
This docstring (and the opening line of the PR description) says the object "ends up" displaced. The code counts an episode if any step is past the threshold, so lifting the object and putting it back still counts. The class docstring and the "What changes" bullet agree with the code. None of the new unit tests can tell the two apart: each one also passes with a final-position-only check. Could we fix the wording and add a lift-and-return case to test_rate_is_fraction_of_episodes?
| """Computes the fraction of episodes in which the object ends up displaced from where it started. | |
| """Computes the fraction of episodes in which the object was ever displaced from its first recorded position. |
lifted_and_returned_w = np.zeros((10, 3))
lifted_and_returned_w[3:6, 2] = 0.1
assert compute_object_displaced_rate([lifted_and_returned_w], displacement_threshold_m=0.02) == 1.0| task = PickAndPlaceTask(pick_object, destination, kitchen) | ||
| task.get_metrics() | ||
| # → [SuccessRateMetric(), ObjectPeakSpeedExceededRateMetric(pick_object)] | ||
| # → [SuccessRateMetric(), ObjectDisplacedRateMetric(pick_object)] |
There was a problem hiding this comment.
🔵 Other pages still show the old pick-and-place key
Pick-and-place now reports object_displaced_rate, but these sample outputs from pick-and-place runs still show object_peak_speed_exceeded_rate:
docs/pages/quickstart/running_a_real_policy/openpi.rst(lines 148–163)docs/pages/quickstart/running_a_real_policy/gr00t.rst(lines 146–161)docs/pages/example_workflows/analysis/variations.rst(line 77)docs/pages/example_workflows/newton/deformable_pick_and_place.rst(lines 191, 211)docs/pages/example_workflows/sequential_static_manipulation/step_5_evaluation.rst(_subtask_0, lines 122–268)
The values would change as well as the key, so these probably need fresh output rather than a rename. Also, the worked example just below this line now walks through a metric PickAndPlaceTask no longer uses. Would ObjectDisplacedRateMetric be the better example here?
| def record_post_step(self): | ||
| # Deformables report their mean nodal position, rigid objects their root position. | ||
| t_W = self._env.arena_world.get_position_w(self.object_name) | ||
| assert t_W.shape == (self._env.num_envs, 3) |
There was a problem hiding this comment.
🔵 Duplicate shape check
ArenaWorld.get_position_w already asserts this exact (num_envs, 3) shape (arena_world.py:298), so this line can go.
| assert t_W.shape == (self._env.num_envs, 3) |
| # The same trajectory as velocity (0.01 m/s) stays under the 0.5 m/s speed threshold. | ||
| slow_velocity_w = np.zeros((num_steps, 3)) | ||
| slow_velocity_w[:, 0] = 0.01 | ||
| assert compute_object_peak_speed_exceeded_rate([slow_velocity_w], object_velocity_threshold=0.5) == 0.0 |
There was a problem hiding this comment.
🔵 Peak-speed metric loses its only value check
test_success_rate_metric.py was the only test that checked the value of object_peak_speed_exceeded_rate, and goal-pose, gear-insertion, assembly and place-upright still report it. This assertion only covers the slow case, so a compute_object_peak_speed_exceeded_rate that always returned 0.0 would now pass. Could we add a fast case next to it?
| assert compute_object_peak_speed_exceeded_rate([slow_velocity_w], object_velocity_threshold=0.5) == 0.0 | |
| assert compute_object_peak_speed_exceeded_rate([slow_velocity_w], object_velocity_threshold=0.5) == 0.0 | |
| assert compute_object_peak_speed_exceeded_rate([slow_velocity_w * 100.0], object_velocity_threshold=0.5) == 1.0 |
🤖 Isaac Lab-Arena Review BotSummaryThis PR adds
Findings🟡 Warning: isaaclab_arena/metrics/object_displaced.py:41: The docstring of 🔵 Improvement: docs/pages/concepts/task/concept_metrics_design.rst:22: Five other pages still show
The worked example on this page also walks through a metric that 🔵 Improvement: isaaclab_arena/metrics/object_displaced.py:29: Test Coverage and CI Cost
VerdictMinor fixes needed |
peterd-NV
left a comment
There was a problem hiding this comment.
Looks good to me, I flagged a minor note on correctness that you can make the call on whether or not you want to add.
26b8991
into
xyao/refactor/rename_object_moved_rate
Reopen #1718 to main. --------- Signed-off-by: Xinjie Yao <xyao@nvidia.com>
Add
ObjectDisplacedRateMetric,which counts an episode as displaced if the object ends up more than 2 cm from where it started, and use it inPickAndPlaceTaskinstead of the peak-speed metric.Why this change?
The previous PR renamed the speed metric to
object_peak_speed_exceeded_rate,so its name now says what it measures. This PR adds the measure that pick-and-place needs.What changes?
ObjectDisplacedRateMetric(keyobject_displaced_rate).It records the object's world-frame position each step and counts an episode if the position is ever more thandisplacement_threshold_m(default 0.02 m) from the first recorded position. Deformables use their mean node position.PickAndPlaceTask.get_metrics()returns the new metric in place of the peak-speed one. The other tasks (goal-pose, gear-insertion, assembly, place-upright) keep the peak-speed metric.Breaking change: pick-and-place results now report
object_displaced_rate,notobject_peak_speed_exceeded_rate.Usage example
Before:
After:
A slow carry now counts as displaced.
Validation