vikashplus / robohive

A unified framework for robot learning
https://sites.google.com/view/robohive
Apache License 2.0
489 stars 82 forks source link

Resetting robot during env setup #131

Closed andrearosasco closed 6 months ago

andrearosasco commented 6 months ago

I found this line in env_base.MujocoEnv._setup

observation, _reward, done, _info = self.step(np.zeros(self.sim.model.nu))
# Question: Should we replace above with following? Its specially helpful for hardware as it forces a env reset before continuing, without which the hardware will make a big jump from its position to the position asked by step.
# observation = self.reset()

Since on the real robot the requested position causes an overcurrent, I commented the line and de-commented observation = self.reset()

I wonder, since it wasn't de-commented already, can it cause any issue?

vikashplus commented 6 months ago

When working with hardware, for safety observation = self.reset()should be called before calling any step function. Your intuition here is correct and I don't envision any issues.

andrearosasco commented 6 months ago

Thanks for the answer! I have a follow up question: if there are no issues, why isn't observation, _reward, done, _info = self.step(np.zeros(self.sim.model.nu)) removed in favor of observation = self.reset()?

vikashplus commented 6 months ago

In our usecase (with hardware)