Loading URDF Files#

In this simple example, we will load an URDF file of the Mars Rover Perserverance into Vuer.

Vuer supports URDF files with mesh files in the following formats: .dae, .stl, .obj, .ply. For details on the mesh file formats supported, refer to the Typescript source code.

from asyncio import sleep
from vuer import Vuer, VuerSession
from vuer.schemas import Urdf

app = Vuer()


@app.spawn(start=True)
async def main(proxy: VuerSession):
    proxy.upsert @ Urdf(
        src="https://docs.vuer.ai/en/latest/_static/perseverance/rover/m2020.urdf",
        jointValues={},
        rotation=[3.14 / 2, 0, 0],
        position=[0, 0, -1.5],
        key="perseverance",
    )

    proxy.upsert @ Urdf(
        src="https://docs.vuer.ai/en/latest/_static/perseverance/mhs/MHS.urdf",
        jointValues={},
        rotation=[3.14 / 2, 0, 0],
        position=[0, 0.28, 0.5],
        key="mars-helicopter",
    )

    # keep the session alive.
    while True:
        await sleep(10)