stanfordnmbl / osim-rl

Reinforcement learning environments with musculoskeletal models
http://osim-rl.stanford.edu/
MIT License
882 stars 249 forks source link

Ctrl+C doesn't work as expected #153

Closed AdamStelmaszczyk closed 6 years ago

AdamStelmaszczyk commented 6 years ago

Run the simplest:

from osim.env import ProstheticsEnv

env = ProstheticsEnv(visualize=False)
observation = env.reset()
for i in range(200):
    observation, reward, done, info = env.step(env.action_space.sample())

and try to stop it with Ctrl+C. Instead of stopping it will only print:

^C<built-in function Manager_integrate> returned a result with an error set

kidzik commented 6 years ago

It seems it's a fairly general error related to error handling in python3 (and an exception thrown in OpenSim integrator) https://github.com/zulip/zulip/issues/6153 It's beyond the scope of this repo but relevant, I'll try to see if there are some workarounds.

AdamStelmaszczyk commented 6 years ago

It seems it's a fairly general error related to error handling in python3

The issue is not about a general error returned a result with an error set. It could be anything, let's say it's some RuntimeError, doesn't matter.

The issue is about handling this exception inside osim.py.

It's beyond the scope of this repo but relevant

It's within the scope of this repo. In this repo there is a Python code that calls C++. And this Python code is not handling exceptions coming from C++ well.

kidzik commented 6 years ago

Good call, exceptions from the integrator were not passed.

AdamStelmaszczyk commented 6 years ago

Oh, nice, thank you Łukasz :)