Unverified Commit dc2281a7 authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Makes sure program exits when exception is raised (#289)

# Description

Earlier the application was continuing to play when an exception was
raised. This is because we had a "while" loop in the simulation stop
callback. This MR makes sure that the while-loop is only called when it
is truly needed. Otherwise, the program should exit.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent c3c7f6bd
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.10.1" version = "0.10.2"
# Description # Description
title = "ORBIT framework for Robot Learning" title = "ORBIT framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.10.2 (2023-12-12)
~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Added a check in the simulation stop callback in the :class:`omni.isaac.orbit.sim.SimulationContext` class
to not render when an exception is raised. The while loop in the callback was preventing the application
from closing when an exception was raised.
0.10.1 (2023-12-06) 0.10.1 (2023-12-06)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -8,6 +8,7 @@ from __future__ import annotations ...@@ -8,6 +8,7 @@ from __future__ import annotations
import builtins import builtins
import enum import enum
import numpy as np import numpy as np
import sys
import weakref import weakref
from typing import Any from typing import Any
...@@ -559,7 +560,7 @@ class SimulationContext(_SimulationContext): ...@@ -559,7 +560,7 @@ class SimulationContext(_SimulationContext):
# check if the simulation is stopped # check if the simulation is stopped
if event.type == int(omni.timeline.TimelineEventType.STOP): if event.type == int(omni.timeline.TimelineEventType.STOP):
# keep running the simulator when configured to not shutdown the app # keep running the simulator when configured to not shutdown the app
if self._has_gui: if self._has_gui and sys.exc_info()[0] is None:
self.app.print_and_log( self.app.print_and_log(
"Simulation is stopped. The app will keep running with physics disabled." "Simulation is stopped. The app will keep running with physics disabled."
" Press Ctrl+C or close the window to exit the app." " Press Ctrl+C or close the window to exit the app."
......
...@@ -102,9 +102,11 @@ def main(): ...@@ -102,9 +102,11 @@ def main():
# -- Robot # -- Robot
# resolve asset # resolve asset
if args_cli.asset == "orbit": if args_cli.asset == "orbit":
usd_path = f"{ISAAC_ORBIT_NUCLEUS_DIR}/Robots/ANYbotics/ANYmalC/anymal_c_minimal_instanceable.usd" usd_path = f"{ISAAC_ORBIT_NUCLEUS_DIR}/Robots/ANYbotics/ANYmal-C/anymal_c.usd"
root_prim_path = "/World/envs/env_.*/Robot/base"
elif args_cli.asset == "oige": elif args_cli.asset == "oige":
usd_path = f"{ISAAC_NUCLEUS_DIR}/Robots/ANYbotics/anymal_instanceable.usd" usd_path = f"{ISAAC_NUCLEUS_DIR}/Robots/ANYbotics/anymal_instanceable.usd"
root_prim_path = "/World/envs/env_.*/Robot"
elif os.path.exists(args_cli.asset): elif os.path.exists(args_cli.asset):
usd_path = args_cli.asset usd_path = args_cli.asset
else: else:
...@@ -132,8 +134,18 @@ def main(): ...@@ -132,8 +134,18 @@ def main():
physics_scene_path, "/World/collisions", envs_prim_paths, global_paths=["/World/defaultGroundPlane"] physics_scene_path, "/World/collisions", envs_prim_paths, global_paths=["/World/defaultGroundPlane"]
) )
# Resolve robot prim paths
if args_cli.asset == "orbit":
root_prim_path = "/World/envs/env_.*/Robot/base"
elif args_cli.asset == "oige":
root_prim_path = "/World/envs/env_.*/Robot"
elif os.path.exists(args_cli.asset):
usd_path = args_cli.asset
root_prim_path = "/World/envs/env_.*/Robot"
else:
raise ValueError(f"Invalid asset: {args_cli.asset}. Must be one of: orbit, oige.")
# Setup robot # Setup robot
robot_view = ArticulationView("/World/envs/env_.*/Robot", name="ANYMAL") robot_view = ArticulationView(root_prim_path, name="ANYMAL")
world.scene.add(robot_view) world.scene.add(robot_view)
# Play the simulator # Play the simulator
world.reset() world.reset()
......
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