problem when use B0basedReomoteApi to read the data from simulation

Typically: "How do I... ", "How can I... " questions
Post Reply
jianye
Posts: 45
Joined: 16 Oct 2019, 13:58

problem when use B0basedReomoteApi to read the data from simulation

Post by jianye »

hello,

i am working on Vrep and want to use Python through B0basedRemoteApi.

In the Simulation i have set the two collection an want to read the distance betweem this two collections.

when I write the code in the lua script with no b0basedRemoteApi:

Code: Select all

mensch_handle=sim.getCollectionHandle('BillsCollection#')
robot_handle=sim.getCollectionHandle('UR10Collection#')
res,data=sim.checkDistance(mensch_handle,robot_handle,1000)
print(data)
all things work gut, but when I write the following code in my python script with b0BasedRemoteApi:

Code: Select all

mensch_handle=client.simxGetCollectionHandle('BillsCollection#',client.simxServiceCall())
robot_handle=client.simxGetCollectionHandle('UR10Collection#',client.simxServiceCall())
client.simxSynchronous(True)
client.simxAddStatusbarMessage('Hello world!',client.simxDefaultPublisher())
distdata=client.simxCheckDistance(mensch_handle[1],robot_handle[1],0,client.simxServiceCall())
print(distdata[1])
it didn't work and I got this error:

Code: Select all

b".//lua/b0RemoteApiServer.lua:876: attempt to call local 'f' (a nil value)"
any advice?

thanks in advance

jian

coppelia
Site Admin
Posts: 8101
Joined: 14 Dec 2012, 00:25

Re: problem when use B0basedReomoteApi to read the data from simulation

Post by coppelia »

Hello Jian,

sorry for the late reply. Actually that is a bug. You can fix this by changing line 598 of file lua/b0RemoteApiServer.lua from:

Code: Select all

return sim.getCollectionHandle(objName..'#')
to

Code: Select all

return sim.getCollectionHandle(objName)
Cheers

Post Reply