Skip to content

Swift crashes before plotting the robot #383

@J2M2

Description

@J2M2

Describe the bug
I am experiencing an issue while trying to display a the robot plot in 3D using the roboticstoolbox library. I am following the code examples mentioned here, but I encounter errors related to file path resolution and file not found when trying to load mesh files (.dae) for visualization.

During the plot generation, I encounter the following error message related to file path resolution and file not found:

Error: Could not load retrieve/[file-path]: fetch for "[http://localhost:52000/retrieve/http://localhost:52000/retrieve/C:/Users/juanm/Dev/Robot/Toolbox/.venv/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link1.dae]" responded with 404: File not found.

I have check manually if the path exist, and I can access to the .dae file. However the complete path (including /localhost:52000/retrieve/... gives me 404)

Version information

Installed using PyPI inside of a Python (3.10.8) .venv:

  • roboticstoolbox-python (1.1.0)
  • swift-sim (1.1.0)

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 roboticstoolbox as rp

panda = rp.models.Panda()
panda.plot(q=panda.qr)
  1. Refresh the page and get an empty 3D view for few seconds and it crashes. The console output gives:
connection handler failed
Traceback (most recent call last):
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\protocol.py", line 959, in transfer_data
    message = await self.read_message()
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\protocol.py", line 1029, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\protocol.py", line 1104, in read_data_frame
    frame = await self.read_frame(max_size)
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\protocol.py", line 1161, in read_frame
    frame = await Frame.read(
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\framing.py", line 95, in read
    mask_bits = await reader(4)
  File "C:\Users\juanm\AppData\Local\Programs\Python\Python310\lib\asyncio\streams.py", line 696, in readexactly
    raise self._exception
  File "C:\Users\juanm\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 301, in _loop_reading
    self._read_fut = self._loop._proactor.recv_into(self._sock, self._data)
  File "C:\Users\juanm\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 477, in recv_into
    ov.WSARecvInto(conn.fileno(), buf, flags)
ConnectionAbortedError: [WinError 10053] Se ha anulado una conexión establecida por el software en su equipo host

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\server.py", line 240, in handler
    await self.ws_handler(self)
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\server.py", line 1186, in _ws_handler
    return await cast(
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\swift\SwiftRoute.py", line 320, in serve
    await self.expect_message(websocket, expected)
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\swift\SwiftRoute.py", line 325, in expect_message
    recieved = await websocket.recv()
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\protocol.py", line 568, in recv
    await self.ensure_open()
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\websockets\legacy\protocol.py", line 935, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: no close frame received or sent
Traceback (most recent call last):
  File "c:\Users\juanm\Dev\Robot\Toolbox\swift_test.py", line 4, in <module>
    panda.plot(q=panda.qr)
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\roboticstoolbox\robot\BaseRobot.py", line 2342, in plot
    env.add(self, readonly=True, **kwargs)
  File "C:\Users\juanm\Dev\Robot\Toolbox\.venv\lib\site-packages\swift\Swift.py", line 405, in add
    while not int(self._send_socket("shape_mounted", [id, len(robob)])):
ValueError: invalid literal for int() with base 10: 'Connected'

Expected behavior
I expected the roboticstoolbox library to automatically handle the loading and visualization of the robot model using the specified URDF file and associated mesh files (STL or Collada format). The tutorial implies that the visualization should work seamlessly.

Screenshots
image

Environment (please complete the following information):

  • Windows 11
  • Python 3.10.8

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