vrep-api-python icon indicating copy to clipboard operation
vrep-api-python copied to clipboard

Loading scenes

Open psychemedia opened this issue 6 years ago • 0 comments

Trying to load scenes via the API, I keep getting errors, irrespective of whether I try to use relative or absolute paths on client or server side, from either server or client side depending on setting. The scene files are at the paths specified!

Code I'm using:

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_blocking #v.simx_opmode_oneshot_wait
        self.id = api._id

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

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

scene="/Applications/V-REP_PRO_EDU_V3_4_0_Mac/scenes/khepera3.ttt"
#scene='./Pioneer.ttt'
with VRep.connect("127.0.0.1", 19997) as api:
    r=sceneloader(api)
    r.loadScene(scene)
```

psychemedia avatar Sep 25 '17 12:09 psychemedia