GithubHelp home page GithubHelp logo

swift's People

Contributors

jhavl avatar kxxt avatar mfkenson avatar petercorke avatar suddrey-qut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

swift's Issues

xy zero plane is opaque when viewed from above

The ground plane is opaque when viewed from above in swift which cuts off the robot if it is below the ground plane (see attached photos). The plane is transparent when viewed from below. It is desirable to have the plane be transparent when viewed from any direction.

image
image

Error in documentation

The import of backends has changed in the last version now has to be:

from roboticstoolbox.backends.swift import Swift
env =  Swift()
env.launch(realtime=True)
env.add(robot)
for i in range(0,10*n):
        robot.q=q_m[i%n,:]
        env.step(Ts)

Large cache accumulation

I am experiencing a large build-up of browser cache after successive runs of the Swift simulator.
After running the example in the readme:

import roboticstoolbox as rp

panda = rp.models.Panda()
panda.plot(q=panda.qr)

I see around 12 MB of cache accumulating each time I run the simulator. I have tested this in Google Chrome and Firefox, and I am seeing the same result.

I am working with a three-robot system in Swift, so I am quickly accumulating a large amount of cache (around 50 MB per run). Is there any way to prevent this?

Thank You

Member Base Unknown

On compiling the SWIFT visualisation example given in https://jhavl.github.io/neo/

I get the error:

Tep.A[:3, 3] = target.base.t
AttributeError: 'Sphere' object has no attribute 'base'

on line 47 with the following warning:

" site-packages\spatialgeometry\Shape.py:63: FutureWarning: base kwarg is deprecated, use pose instead
warn("base kwarg is deprecated, use pose instead", FutureWarning)"

However I cannot seem to find how tro use pose instead?

Any help gratefully received.

Remove object by ID

Hey,
thanks for the nice work. I wanted to remove a mesh that I added, but the functionality to remove by id seems not implemented yet. This is currently a critical point for me. Any plans on implementing that in the near future?
Best

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

Dear community,

I tried to do the base tutorial for showing the Panda robot. But I get a black screen on the browser with the error: "Application error: a client-side exception has occurred (see the browser console for more information)."

On the browser console i get the following errors:

Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link0.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link0.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link1.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link1.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link2.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link2.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link3.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link3.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link4.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link4.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link5.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link5.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link6.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link6.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\link7.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/link7.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\hand.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/hand.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\finger.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/finger.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\finger.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/finger.dae" responded with 404: File not found) NextJS 2 [index-0723cc3b940b78c7.js:194:40195](http://localhost:52000/_next/static/chunks/pages/index-0723cc3b940b78c7.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\finger.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/finger.dae" responded with 404: File not found) NextJS 2 [framework-37f5df078e1d84d6.js:9:69814](http://localhost:52000/_next/static/chunks/framework-37f5df078e1d84d6.js) Error: Could not load retrieve/C:\Users\inse9\AppData\Local\Programs\Python\Python38\Lib\site-packages\rtbdata\xacro\franka_description\meshes\visual\finger.dae: fetch for "http://localhost:52000/retrieve/C:/Users/inse9/AppData/Local/Programs/Python/Python38/Lib/site-packages/rtbdata/xacro/franka_description/meshes/visual/finger.dae" responded with 404: File not found)

I have tried with Python 3.8 and 3.9 and with the browsers: Firefox and Chrome on Windows 11. But same error appears.

How can I solve?

update slider values with an event

Hello all,

adding element to environment does not return id.

is there a possibility to update elements value according to some internal variable or event ?

Reference to nonexistent folder

Hi @jhavl,

just checked out the new changes. Swift won't launch and I discovered a potential bug:

root_dir = Path(sw.__file__).parent / 'out'

Is out supposed to be a new public folder?
Because changing it to the current public by root_dir = Path(sw.__file__).parent / 'public' gives me a 404.

Regards and happy eastern ๐Ÿ˜€

Resolved-Rate Motion Control

Please modify the code for "Resolved-Rate Motion Control" as given below in case you get error related to swift.
Add the following lines and modify the section:

Make and instance of the Swift simulator and open it#######

env = rtb.backends.Swift()
env.launch()
################################################with########
import swift
env = swift.Swift()
env.launch(realtime=True)

file_name argument in Swift.screenshot does nothing.

I cannot name the files output by screenshot method. The example below saves a screenshot as "swift_snap.png".

import swift 
import spatialgeometry as sg

env = swift.Swift()
env.launch()
s = sg.Sphere(radius=0.1,  color=(0.95, 0.5, 0.25, 0))
env.add(s)
env.step()
env.screenshot("my_screenshot")

Swift Environment Elements Do Not Update

Hello,

I have written a small program -by being inspired by one of your examples- with the toolbox using Swift for manual jogging with UR5. The GUI can be seen below;
Screenshot 2022-06-13 091849

Besides the joint angles, I have added more sliders to the program including, X, Y, Z, Roll, Pitch and Yaw. Also these sliders are given below.

2

Each slider works perfectly fine on their own. The problem I am having right now is that, when I make the robot move from the X,Y,Z, Roll, Pitch and Yaw sliders, the joint sliders do not update. I tried using the env.elements.update() function but it does not seem to work. Could you give any advice for this problem? The code I have used is given below,

from unittest import expectedFailure
import swift
import spatialmath as sm
import roboticstoolbox as rtb
import numpy as np
import time

# Launch the simulator Swift
env = swift.Swift()
env.launch()

# Make a ur5 robot and add it to Swift
ur5 = rtb.models.UR5()
ur5.q = ur5.qz
upt=False
env.add(ur5)

# This is our callback funciton from the sliders in Swift which set
# the joint angles of our robot to the value of the sliders
def set_joint(j, value):
    ur5.q[j] = np.deg2rad(float(value))

def set_pos_x(value):   
    p_try=ur5.fkine(ur5.q)
    p_try.t[0]=value
    sol=ur5.ikine_LM(p_try,q0=ur5.q)
    if sol.success: ur5.q=sol.q

def set_pos_y(value):
    p_try=ur5.fkine(ur5.q)
    p_try.t[1]=value
    sol=ur5.ikine_LM(p_try,q0=ur5.q)
    if sol.success: ur5.q=sol.q

def set_pos_z(value):
    p_try=ur5.fkine(ur5.q)
    p_try.t[2]=value
    sol=ur5.ikine_LM(p_try,q0=ur5.q)
    if sol.success: ur5.q=sol.q

def set_rot_r(value):
    p_act=ur5.fkine(ur5.q)
    p_try= sm.SE3(p_act.t[0],p_act.t[1],p_act.t[2]) * sm.SE3.RPY(np.deg2rad(value),p_act.rpy()[1],p_act.rpy()[2])
    sol=ur5.ikine_LM(p_try,q0=ur5.q)
    if sol.success: ur5.q=sol.q

def set_rot_p(value):
    p_act=ur5.fkine(ur5.q)
    p_try= sm.SE3(p_act.t[0],p_act.t[1],p_act.t[2]) * sm.SE3.RPY(p_act.rpy()[0],np.deg2rad(value),p_act.rpy()[2])
    sol=ur5.ikine_LM(p_try,q0=ur5.q)
    if sol.success: ur5.q=sol.q

def set_rot_y(value):
    p_act=ur5.fkine(ur5.q)
    p_try= sm.SE3(p_act.t[0],p_act.t[1],p_act.t[2]) * sm.SE3.RPY(p_act.rpy()[0],p_act.rpy()[1],np.deg2rad(value))
    sol=ur5.ikine_LM(p_try,q0=ur5.q)
    if sol.success: ur5.q=sol.q

def bt(value):
    global upt
    if not upt:
        upt=not upt
    
env.add(swift.Button(bt,desc="toogle control"))

# Loop through each link in the ur5 and if it is a variable joint,
# add a slider to Swift to control it
j = 0
for link in ur5.links:
    if link.isjoint:

        # We use a lambda as the callback function from Swift
        # j=j is used to set the value of j rather than the variable j
        # We use the HTML unicode format for the degree sign in the unit arg
        env.add(
            swift.Slider(
                lambda x, j=j: set_joint(j, x),
                min=np.round(np.rad2deg(link.qlim[0]), 2),
                max=np.round(np.rad2deg(link.qlim[1]), 2),
                step=1,
                value=np.round(np.rad2deg(ur5.q[j]), 2),
                desc="UR5 Joint " + str(j),
                unit="°",
            )
        )

        j += 1

px=env.add(
    swift.Slider(
        set_pos_x,
        min=-2,
        max=2,
        step=0.001,
        value=ur5.fkine(ur5.q).t[0],
        desc="UR5 X",
        unit=" m",
        )
    )        
py=env.add(
    swift.Slider(
        set_pos_y,
        min=-2,
        max=2,
        step=0.001,
        value=ur5.fkine(ur5.q).t[1],
        desc="UR5 Y",
        unit=" m",
        )        
    )
pz=env.add(
    swift.Slider(
        set_pos_z,
        min=-2,
        max=2,
        step=0.001,
        value=ur5.fkine(ur5.q).t[2],
        desc="UR5 Z",
        unit=" m"
        )        
    )

rr=env.add(
    swift.Slider(
        set_rot_r,
        min=-180,
        max=+180,
        step=0.01,
        value=np.round(np.rad2deg(ur5.fkine(ur5.q).rpy()[0]),2),
        desc="UR5 Roll",
        unit="°"
        )        
    )

rp=env.add(
    swift.Slider(
        set_rot_p,
        min=-180,
        max=+180,
        step=0.01,
        value=np.round(np.rad2deg(ur5.fkine(ur5.q).rpy()[1]),2),
        desc="UR5 Pitch",
        unit="°"
        )        
    )

ry=env.add(
    swift.Slider(
        set_rot_y,
        min=-180,
        max=+180,
        step=0.01,
        value=np.round(np.rad2deg(ur5.fkine(ur5.q).rpy()[2]),2),
        desc="UR5 Yaw",
        unit="°"
        )        
    )

while True:
    # Process the event queue from Swift, this invokes the callback functions
    # from the sliders if the slider value was changed
    # env.process_events()

    # Update the environment with the new robot pose
    env.step(0)
    if upt:
        upt=False
        env.elements.update()
    
    time.sleep(0.01)

Thanks in advance.

No tab opens when running on Mac

I have used the framework for visualizing a robot, using the robotics-toolbox-python library from petercorke. The visualization works in Windows, where a tab opens and the robot is visualized properly (see gif and robot_viz.txt (attached as txt instead of py file for git compatibility).
When running with the exact same version (roboticstoolbox-python==0.7.0) on a Mac, no tab opens. The Mac version used to test this was: catalina version 10.15.7

swift_robot

robot_viz.txt

"Could not connect to the Swift simulator" in Colab/Remote Notebook

Even though it looks like the implementation of SwiftRoute is attempting to support Colab, my recent tries to run the example code (the piece for running in jupyter notebook) in a Colab notebook has failed with the error message "Could not connect to the Swift simulator ". The same error is given when run in a remote non-colab notebook served on a personal server (but opened via the remote-ssh plugin of vs code).

The same code runs fine on a local jupyter notebook though. Both RTB and Swift are the latest versions via PIP.

I am sorry that web programming is not my most vital skill, so some initial digging & print statements on my side were not very fruitful. All I was able to identify was that this line timed out in the remote notebook, but returned "Connected" in a local notebook.

Recording with Swift freezes

Hi, I was trying to record swift visualization
these were the general step

`env = swift.Swift()

env.launch()

panda = rtb.models.Panda()

env.add(panda)

env.start_recording( filename , framerate=1/dt , "vis.gif")

for q in trajectories:

panda.q[:n] = q[:n]

env.step(dt)

time.sleep(0.02)

env.stop_recording()
`

I use constant dt in range of 0.01 to 0.07
Issues is simulation doesn't run on web, its just freeze at initial position , without recording option its run fine.
Is there any known issues regarding this , is the general steps are correct ?
using in ubuntu 20.04
Thanks

How to add own mesh object

Hi newbie here, I working with robotic toolbox with swift as backend I wanted to ask few things.
1.Where does the mesh files of objects are defined ? Like for sphere , box .
2. Is it possible to disable collision between two added objects like two spheres , box?
2.Is it possible to add own mesh/URDF objects in robotic toolbox +swift?
Any help is appreciated.
Thank you .

Swift environment doesn't start on Windows 10

Hello everyone.
I've installed the package with pip install roboticstoolbox-python and checked that all the dependencies have indeed been installed. Everything works fine until i try to use the Swift backend; this is what i got with the following bit of code:

import roboticstoolbox as rp

panda = rp.models.Panda()
panda.plot(q=panda.qr)

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59165)
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python36\lib\site-packages\swift\SwiftRoute.py", line 222, in __init__
    *args, directory=str(root_dir), **kwargs
TypeError: __init__() got an unexpected keyword argument 'directory'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59166)
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python36\lib\site-packages\swift\SwiftRoute.py", line 222, in __init__
    *args, directory=str(root_dir), **kwargs
TypeError: __init__() got an unexpected keyword argument 'directory'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59167)
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python36\lib\site-packages\swift\SwiftRoute.py", line 222, in __init__
    *args, directory=str(root_dir), **kwargs
TypeError: __init__() got an unexpected keyword argument 'directory'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59171)
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python36\lib\site-packages\swift\SwiftRoute.py", line 222, in __init__
    *args, directory=str(root_dir), **kwargs
TypeError: __init__() got an unexpected keyword argument 'directory'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59172)
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python36\lib\site-packages\swift\SwiftRoute.py", line 222, in __init__
    *args, directory=str(root_dir), **kwargs
TypeError: __init__() got an unexpected keyword argument 'directory'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59173)
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "C:\Program Files\Python36\lib\socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\Python36\lib\site-packages\swift\SwiftRoute.py", line 222, in __init__
    *args, directory=str(root_dir), **kwargs
TypeError: __init__() got an unexpected keyword argument 'directory'
----------------------------------------

Could not connect to the Swift simulator 

Traceback (most recent call last):
  File "D:\mattia.torta\Downloads\robotics.py", line 4, in <module>
    panda.plot(q=panda.qr)
  File "C:\Program Files\Python36\lib\site-packages\roboticstoolbox\robot\Robot.py", line 1577, in plot
    env.launch(self.name + " Plot", limits=limits, fig=fig)
  File "C:\Program Files\Python36\lib\site-packages\swift\Swift.py", line 159, in launch
    dev=self._dev,
  File "C:\Program Files\Python36\lib\site-packages\swift\SwiftRoute.py", line 86, in start_servers
    inq.get(timeout=10)
queue.Empty

The web page (i've already tried to use different browsers and also clearing the cache) just shows the error ERR_EMPTY_RESPONSE. Does anyone have any idea on how to fix this?

Thank you in advance.
Mattia

Swift elements bug

Hi @jhavl,
I have a simulation running with several buttons, one slider, checkboxes and radio buttons.
When setting the slider, the button element above is clicked.
When setting the radio button, the slider above is reset.
No issues here with the 'old' Swift.

Any ideas on that?

Swift backend sets current working directory to /

Running this simple example

>>> from roboticstoolbox.backends.Swift import Swift
>>> backend = Swift()
>>> backend.launch()  # create graphical world
>>> backend.add(panda) # add robot to the world
>>> panda.q = panda.qr        # update the robot
>>> backend.step()    # display the world

changes the cwd. Not sure which command does this.

A problem if working in ipython and repeatedly using %run to test an example script.

Can't start simulator on Windows.

I am trying to launch the swift simulator with the Panda manipulator.
I have a simple jupyter notebook with the following code (as mentioned in the readme):

import roboticstoolbox as rp

panda = rp.models.Panda()
panda.plot(q=panda.qr)

On execution, a new tab opens up in my browser with a small box on the top right corner displaying the timestamp and FPS and nothing happens after this. On the notebook side I get an excpetion, about 5-10 seconds after executing the cell.
Here is the stacktrace for that:

Could not connect to the Swift simulator 

---------------------------------------------------------------------------
Empty                                     Traceback (most recent call last)
<ipython-input-9-7e648cf58e0e> in <module>
      2 
      3 panda = rp.models.Panda()
----> 4 panda.plot(q=panda.qr)

~\Miniconda3\lib\site-packages\roboticstoolbox\robot\Robot.py in plot(self, q, backend, block, dt, limits, vellipse, fellipse, jointaxes, eeframe, shadow, name, movie)
    795         if backend.lower() == 'swift':  # pragma nocover
    796             if isinstance(self, rtb.ERobot):
--> 797                 env = self._plot_swift(q=q, block=block)
    798             elif isinstance(self, rtb.DHRobot):
    799                 raise NotImplementedError(

~\Miniconda3\lib\site-packages\roboticstoolbox\robot\Robot.py in _plot_swift(self, q, block)
    886 
    887         # Add the self to the figure in readonly mode
--> 888         env.launch()
    889 
    890         env.add(

~\Miniconda3\lib\site-packages\roboticstoolbox\backends\Swift\Swift.py in launch(self, browser)
    103 
    104         if self.display:
--> 105             sw.start_servers(self.outq, self.inq, browser=browser)
    106             self.last_time = time.time()
    107 

~\Miniconda3\lib\site-packages\swift\Swift.py in start_servers(outq, inq, open_tab, browser)
     58 
     59         try:
---> 60             inq.get(timeout=10)
     61         except Empty:
     62             print('\nCould not connect to the Swift simulator \n')

~\Miniconda3\lib\queue.py in get(self, block, timeout)
    176                     remaining = endtime - time()
    177                     if remaining <= 0.0:
--> 178                         raise Empty
    179                     self.not_empty.wait(remaining)
    180             item = self._get()

Empty: 

Browser Window:
image

I'm running this on a conda environment in Windows 10 with python 3.7.7

PS: I tried disabling the firewall but that didn't help either.

Drawing lines/trajectories in Swift

Hi, repeating here an issue that was initially posted in robotics toolbox (petercorke/robotics-toolbox-python#239) here:
Is there support for drawing 3d lines and/or polylines in Swift? This could be useful for drawing trajectories. Currently to do so I'm drawing a series of Axes but that is quite slow on initialization.
Thanks!

Can't load .glb meshes

Hi!

When I try to load a .glb mesh, Swift does actually load it into the browser but then Swift.py gets stuck here

while not int(self._send_socket("shape_mounted", [id, 1])):

How can I fix it?

Can't add Mesh to Swift in v1.1.0

Hello,
today updated Swift to v1.1.0. When trying to add a Mesh(filename=) to my environment, I always get

Failed to load resource: the server responded with a status of 404 (File not found)
index-0723cc3b940b78c7.js:194 Error: Could not load retrieve/base_link.stl: fetch for "http://localhost:52000/retrieve/base_link.stl" responded with 404: File not found)
    at Object.onError (index-0723cc3b940b78c7.js:194:104816)
    at index-0723cc3b940b78c7.js:186:224752
rU @ index-0723cc3b940b78c7.js:194
framework-37f5df078e1d84d6.js:9 Error: Could not load retrieve/base_link.stl: fetch for "http://localhost:52000/retrieve/base_link.stl" responded with 404: File not found)
    at Object.onError (index-0723cc3b940b78c7.js:194:104816)
    at index-0723cc3b940b78c7.js:186:224752
a5 @ framework-37f5df078e1d84d6.js:9
main-b1241a9a70bb7dcd.js:1 Error: Could not load retrieve/base_link.stl: fetch for "http://localhost:52000/retrieve/base_link.stl" responded with 404: File not found)
    at Object.onError (index-0723cc3b940b78c7.js:194:104816)
    at index-0723cc3b940b78c7.js:186:224752
K @ main-b1241a9a70bb7dcd.js:1
main-b1241a9a70bb7dcd.js:1 A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred

I've already tried to set to absolute path, relative path, another mesh type... but always same error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.