如何使用vrep-api-python将场景加载到V-REP中?

时间:2017-09-09 13:08:30

标签: python

vrep-api-python使用V-REP robot simulator Python包装器,我正在尝试 - 但是失败 - 使用带有服务器端文件的包装simxLoadScene()函数在模拟器中加载场景:

from pyrep import VRep
from pyrep.vrep.vrep import simxLoadScene
from pyrep.vrep import vrep as v
from pyrep.common import ReturnCommandError

class sceneloader:

    def __init__(self, api: VRep):
        self._api = api
        self._def_op_mode = v.simx_opmode_oneshot_wait
        self.id = api._id

    def loadScene(self,path):
        clientID=self.id
        res = simxLoadScene(clientID, path, 0xFF, self._def_op_mode)
        print(res)

        if res != v.simx_return_ok:
            raise ReturnCommandError(res)

scene='/vagrant/scenes/Pioneer.ttt'
with VRep.connect("127.0.0.1", 19997) as api:
    r=sceneloader(api)
    r.loadScene(scene)

但它只会引发服务器错误?

0 个答案:

没有答案