mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-23 17:56:07 +00:00
adding reset to initial position
This commit is contained in:
@@ -133,8 +133,16 @@ class LegacyStrategyConfig(RolloutStrategyConfig):
|
|||||||
Right arrow — end episode early
|
Right arrow — end episode early
|
||||||
Left arrow — discard current episode and re-record
|
Left arrow — discard current episode and re-record
|
||||||
Escape — stop recording session
|
Escape — stop recording session
|
||||||
|
|
||||||
|
In between episodes:
|
||||||
|
- if there is no teleop leader, the robot is held at its initial joint positions captured at startup.
|
||||||
|
- else, the robot is moved smoothly to the position of the teleop leader.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# This only applies if there are no teleop leaders specified.
|
||||||
|
# When True (default), moves the robot back to the joint positions captured at startup.
|
||||||
|
# Otherwise, leave the robot in its current position.
|
||||||
|
reset_to_initial_position: bool = True
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class LegacyStrategy(RolloutStrategy):
|
|||||||
seconds, recording every frame. A reset phase of ``dataset.reset_time_s``
|
seconds, recording every frame. A reset phase of ``dataset.reset_time_s``
|
||||||
follows every episode (except the last) so the operator can manually
|
follows every episode (except the last) so the operator can manually
|
||||||
reset the environment. During the reset phase, an optional teleoperator
|
reset the environment. During the reset phase, an optional teleoperator
|
||||||
drives the robot; if none is present the robot holds its position.
|
drives the robot; if none is present the robot returns to its initial joint positions captured at startup.
|
||||||
|
|
||||||
The policy state (hidden state, RTC queue, interpolator) is reset at
|
The policy state (hidden state, RTC queue, interpolator) is reset at
|
||||||
the start of each recording episode.
|
the start of each recording episode.
|
||||||
@@ -133,6 +133,11 @@ class LegacyStrategy(RolloutStrategy):
|
|||||||
recorded_episodes < num_episodes - 1 or events["rerecord_episode"]
|
recorded_episodes < num_episodes - 1 or events["rerecord_episode"]
|
||||||
):
|
):
|
||||||
log_say("Reset the environment", play_sounds)
|
log_say("Reset the environment", play_sounds)
|
||||||
|
|
||||||
|
# returns to its initial joint positions captured at startup during the reset phase
|
||||||
|
if not teleop and self.config.reset_to_initial_position:
|
||||||
|
self._return_to_initial_position(hw=ctx.hardware)
|
||||||
|
|
||||||
self._reset_loop(
|
self._reset_loop(
|
||||||
ctx=ctx,
|
ctx=ctx,
|
||||||
robot=robot,
|
robot=robot,
|
||||||
@@ -149,6 +154,11 @@ class LegacyStrategy(RolloutStrategy):
|
|||||||
events["rerecord_episode"] = False
|
events["rerecord_episode"] = False
|
||||||
events["exit_early"] = False
|
events["exit_early"] = False
|
||||||
dataset.clear_episode_buffer()
|
dataset.clear_episode_buffer()
|
||||||
|
|
||||||
|
# returns to its initial joint positions captured at startup
|
||||||
|
if not teleop and self.config.reset_to_initial_position:
|
||||||
|
self._return_to_initial_position(hw=ctx.hardware)
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
dataset.save_episode()
|
dataset.save_episode()
|
||||||
|
|||||||
Reference in New Issue
Block a user