Skip to content

Swift crashes when trying to start a recording #501

@jmkaz16

Description

@jmkaz16

Describe the bug
When running swift_recording.py or readme.py from the examples folder, Swift crashes with the error:

## Application error: a client-side exception has occurred (see the browser console for more information).

The browser console shows multiple errors, including:

Error: Incorrect or missing format: Valid formats are gif, webm, ffmpegserver, png, jpg, webm-mediarecorder
Uncaught TypeError: Cannot read properties of null (reading 'children')

The crash occurs specifically when calling env.start_recording(). I tried with a simpler example and the same issue happens.

Version information
Installed from PyPI inside of a Python .venv:

  • roboticstoolbox-python: 1.1.1
  • swift-sim: 1.1.0
  • Python: 3.11.9 (also tested on 3.9.5, same result)
  • OS: Windows 11

To Reproduce
Steps to reproduce the behavior:

  1. Use a local Python environment and install roboticstoolbox-python (in Windows)
  2. Run the following script:
import swift
import roboticstoolbox as rtb
import spatialmath as sm
import numpy as np

env = swift.Swift()
env.launch()

panda = rtb.models.Panda()
panda.q = panda.qr

Tep = panda.fkine(panda.q) * sm.SE3.Trans(0.2, 0.2, 0.45)

arrived = False
env.add(panda)

dt = 0.05

env.start_recording("panda_swift_recording", 1 / dt)
while not arrived:

    v, arrived = rtb.p_servo(panda.fkine(panda.q), Tep, 1)
    panda.qd = np.linalg.pinv(panda.jacobe(panda.q)) @ v
    env.step(dt)

env.stop_recording()
  1. The model loads and starts to move, but then the environment crashes.

Expected behavior
Recording should start without crashing Swift.

Screenshots

Image

Additional context
I am running Swift in Chrome. Had a crash issue when loading the model, but was fixed following #383.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions