Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
michel-aractingi committed Nov 19, 2024
1 parent 2c8ce9d commit f71be08
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lerobot/scripts/control_sim_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def teleoperate(env, robot: Robot, process_action_fn, teleop_time_s=None):
def record(
env,
robot: Robot,
process_action_fn=None,
process_action_from_leader=None,
fps: int | None = None,
root="data",
repo_id="lerobot/debug",
Expand All @@ -313,12 +313,8 @@ def record(
if fps is None:
fps = policy_fps
logging.warning(f"No fps provided, so using the fps from policy config ({policy_fps}).")
elif fps != policy_fps:
logging.warning(
f"There is a mismatch between the provided fps ({fps}) and the one from policy config ({policy_fps})."
)

if policy is None and process_action_fn is None:
if policy is None and process_action_from_leader is None:
raise ValueError("Either policy or process_action_fn has to be set to enable control in sim.")

# initialize listener before sim env
Expand Down Expand Up @@ -372,7 +368,7 @@ def record(
action = predict_action(observation, policy, device, use_amp)
else:
leader_pos = robot.leader_arms.main.read("Present_Position")
action = process_action_fn(leader_pos)
action = process_action_from_leader(leader_pos)

observation, reward, terminated, _, info = env.step(action)

Expand Down

0 comments on commit f71be08

Please sign in to comment.