使用 swift-sim 进行机器人模拟的客户端应用程序错误

问题描述 投票:0回答:1
import roboticstoolbox as rtb
import spatialmath as sm
import numpy as np
from swift import Swift


# Make and instance of the Swift simulator and open it
env = Swift()
env.launch(realtime=True)

# Make a panda model and set its joint angles to the ready joint configuration
panda = rtb.models.Panda()
panda.q = panda.qr

# Set a desired and effector pose an an offset from the current end-effector pose
Tep = panda.fkine(panda.q) * sm.SE3.Tx(0.2) * sm.SE3.Ty(0.2) * sm.SE3.Tz(0.45)

# Add the robot to the simulator
env.add(panda)

# Simulate the robot while it has not arrived at the goal
arrived = False
while not arrived:

    # Work out the required end-effector velocity to go towards the goal
    v, arrived = rtb.p_servo(panda.fkine(panda.q), Tep, 1)
    
    # Set the Panda's joint velocities
    panda.qd = np.linalg.pinv(panda.jacobe(panda.q)) @ v
    
    # Step the simulator by 50 milliseconds
    env.step(0.05)

尝试使用 swift sim 库进行机器人模拟的介绍性代码,当我运行此代码时,我的默认浏览器(chrome)会弹出,然后出现错误:

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

我检查了浏览器日志,收到了很多加载源失败的警告,其中很多是这样的:

index-0723cc3b940b78c7.js:194 Error: Could not load retrieve/C:\Users\user_name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\rtbdata\xacro\franka_description\meshes\visual\link0.dae: fetch for "http://localhost:52000/retrieve/C:/Users/user_name/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0/LocalCache/local-packages/Python311/site-packages/rtbdata/xacro/franka_description/meshes/visual/link0.dae" responded with 404: File not found)
at Object.onError (index-0723cc3b940b78c7.js:194:104816)
at index-0723cc3b940b78c7.js:186:224752

我已经检查过,所请求的文件位于提供的目录中。我尝试再次下载该库,但没有帮助。

我尝试包含 env.hold,但它仍然产生相同的错误。

python simulation robotics
1个回答
0
投票

经过更多的工作和研究,我得出了结论。显然,问题不在于用户,而在于库,因为它错误地格式化了 Windows 文件路径。您只需要使用此链接手动实现此分叉:拉取请求的链接

© www.soinside.com 2019 - 2024. All rights reserved.