Error inserting model from file using b0 Python API

Report crashes, strange behaviour, or apparent bugs
Post Reply
pbustos
Posts: 4
Joined: 22 Dec 2019, 14:56

Error inserting model from file using b0 Python API

Post by pbustos »

Hello,

I am trying to insert a model from the Python b0 API:

#!/usr/bin/env python3
import b0RemoteApi
client = b0RemoteApi.RemoteApiClient('b0RemoteApi_pythonClient','b0RemoteApiAddOn')
r1 = client.simxLoadModelFromFile('cup.ttm', client.simxServiceCall())

while(True):
pass

And get the following error in the simulator:

Simulation started.
Lua runtime error: ...Sim_Edu_V4_0_0_Ubuntu18_04/lua/b0RemoteApiServer.lua:987: bad argument #2 to 'format' (string expected, got nil)
stack traceback:
: in function 'format'
...Sim_Edu_V4_0_0_Ubuntu18_04/lua/b0RemoteApiServer.lua:987: in function 'PCALL'
...Sim_Edu_V4_0_0_Ubuntu18_04/lua/b0RemoteApiServer.lua:1298: in function
[C]: in function 'nodeSpinOnce'
...Sim_Edu_V4_0_0_Ubuntu18_04/lua/b0RemoteApiServer.lua:1106: in function 'sendAndSpin'
...Sim_Edu_V4_0_0_Ubuntu18_04/lua/b0RemoteApiServer.lua:1638: in function
Lua runtime error: [string -unknown location]:?: simCallScriptFunctionEx: error (simB0.nodeSpinOnce @ 'BlueZero' plugin)
stack traceback:
[C]: in function 'nodeSpinOnce'
...Sim_Edu_V4_0_0_Ubuntu18_04/lua/b0RemoteApiServer.lua:1106: in function 'sendAndSpin'
...Sim_Edu_V4_0_0_Ubuntu18_04/lua/b0RemoteApiServer.lua:1638: in function

The model is an empty new one.

Thanks

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

Re: Error inserting model from file using b0 Python API

Post by coppelia »

Hello,

not sure when and why that was modified, but that is a bug. Thanks for mentioning it.
You can fix it by replacing LoadModel by LoadModelFromFile in file lua/b0RemoteApiServer.lua, around line 865 and 866.

Cheers

pbustos
Posts: 4
Joined: 22 Dec 2019, 14:56

Re: Error inserting model from file using b0 Python API

Post by pbustos »

Thanks for the quick answer

Post Reply