Skip to content

sim2bot.Robot.reset

Preview API

This surface is available for evaluation but still has documented limitations.

reset(robot: int = 0) -> None

Reset simulation state and release an addressed external command.

Parameters:

  • robot (int, default: 0 ) –

    Robot whose external command ownership should be released.

Returns:

  • None

    Reset is requested asynchronously.

Raises:

  • RuntimeError

    If the client is not connected.

  • ConnectionClosed

    If the WebSocket closes while sending the command.

  • OSError

    If the selected transport cannot send the command.

Warning

The current MuJoCo reset is scene-wide, so other robots and dynamic objects are also reset even though command release is addressed.

Source code in sim2bot/client.py
def reset(self, robot: int = 0) -> None:
    """Reset simulation state and release an addressed external command.

    Args:
        robot: Robot whose external command ownership should be released.

    Returns:
        Reset is requested asynchronously.

    Raises:
        RuntimeError: If the client is not connected.
        ConnectionClosed: If the WebSocket closes while sending the command.
        OSError: If the selected transport cannot send the command.

    Warning:
        The current MuJoCo reset is scene-wide, so other robots and dynamic
        objects are also reset even though command release is addressed.
    """
    self._send({"type": "reset", "robot": robot})

Practical examples

Examples use objects discovered from the current scene rather than hard-coded robot metadata.

Reset after an experiment

sim.reset(robot=arm.index)

Rediscover after structural scene changes

sim.reset()
robots = sim.describe()
print([robot.name for robot in robots])

Guidance

Important behavior

The current physics reset is scene-wide. Other robots and dynamic objects reset too.


See also