Skip to content

sim2bot.Robot.base_velocity

Preview API

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

base_velocity(vx: float = 0.0, vy: float = 0.0, vz: float = 0.0, omega: float = 0.0, robot: int = 0) -> None

Command a supported mobile or aerial base velocity.

Parameters:

  • vx (float, default: 0.0 ) –

    Forward robot-frame linear velocity in metres per second.

  • vy (float, default: 0.0 ) –

    Leftward robot-frame linear velocity in metres per second.

  • vz (float, default: 0.0 ) –

    Vertical velocity in metres per second for aerial bases.

  • omega (float, default: 0.0 ) –

    Yaw rate in radians per second.

  • robot (int, default: 0 ) –

    Intended robot index.

Returns:

  • None

    The latest velocity command replaces the previous one.

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

Multi-base addressing is not complete. The current browser runtime drives the scene's primary base even when another robot index is supplied. Treat this API as preview for multi-robot scenes.

Source code in sim2bot/client.py
def base_velocity(
    self, vx: float = 0.0, vy: float = 0.0, vz: float = 0.0, omega: float = 0.0,
    robot: int = 0,
) -> None:
    """Command a supported mobile or aerial base velocity.

    Args:
        vx: Forward robot-frame linear velocity in metres per second.
        vy: Leftward robot-frame linear velocity in metres per second.
        vz: Vertical velocity in metres per second for aerial bases.
        omega: Yaw rate in radians per second.
        robot: Intended robot index.

    Returns:
        The latest velocity command replaces the previous one.

    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:
        Multi-base addressing is not complete. The current browser runtime
        drives the scene's primary base even when another ``robot`` index is
        supplied. Treat this API as preview for multi-robot scenes.
    """
    self._send(
        {
            "type": "base_velocity",
            "vx": vx, "vy": vy, "vz": vz, "omega": omega,
            "robot": robot,
        }
    )

Practical examples

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

Drive forward while turning

sim.base_velocity(vx=0.25, omega=0.4)

Stop a mobile base

sim.base_velocity(vx=0.0, vy=0.0, vz=0.0, omega=0.0)

Guidance

Important behavior

Multi-base addressing is unfinished. The current runtime drives the primary base even when another robot index is supplied.

Common error

vz is meaningful for supported aerial bases; it does not lift a normal mobile manipulator.


See also