Python b0 API - ValueError: NULL pointer access
Posted: 25 Apr 2020, 13:43
Hello,
I'm trying to use CoppeliaSim as an environment for my reinforcement learning problem. I've made the scene in CoppeliaSim and I'm connecting to it from python using b0 API. I've made a binding from OpenAI gym to CoppeliaSim and I'm using the gym in stable_baselines. Randomly, I encounter following error:
etc. every 10 seconds. The program is terminated, but the python interpret doesn't exit.
Related code segment in b0.py
The middle of the stacktrace differs sometimes, but the exception always origins from (I think the line nr. remains the same, but I'm not 110% sure about that)
and happens during
My environment is:
Client initialization (I increased the timeout per advice in https://forum.coppeliarobotics.com/viewtopic.php?t=7858):
My questions are:
I'm trying to use CoppeliaSim as an environment for my reinforcement learning problem. I've made the scene in CoppeliaSim and I'm connecting to it from python using b0 API. I've made a binding from OpenAI gym to CoppeliaSim and I'm using the gym in stable_baselines. Randomly, I encounter following error:
Code: Select all
Traceback (most recent call last):
File "runner.py", line 159, in <module>
main(rest_of_args)
File "runner.py", line 74, in main
tb_log_name=arguments.name,
File "/home/me/.virtualenvs/vrep/lib/python3.6/site-packages/stable_baselines-2.10.0-py3.6.egg/stable_baselines/a2c/a2c.py", line 261, in learn
File "/home/me/.virtualenvs/vrep/lib/python3.6/site-packages/stable_baselines-2.10.0-py3.6.egg/stable_baselines/common/runners.py", line 48, in run
File "/home/me/.virtualenvs/vrep/lib/python3.6/site-packages/stable_baselines-2.10.0-py3.6.egg/stable_baselines/a2c/a2c.py", line 360, in _run
File "/home/me/.virtualenvs/vrep/lib/python3.6/site-packages/stable_baselines-2.10.0-py3.6.egg/stable_baselines/common/vec_env/base_vec_env.py", line 150, in step
File "/home/me/.virtualenvs/vrep/lib/python3.6/site-packages/stable_baselines-2.10.0-py3.6.egg/stable_baselines/common/vec_env/dummy_vec_env.py", line 46, in step_wait
File "/home/me/git/diplomka-src/coppelia_gym/gym_snake/envs/gym_generic.py", line 96, in reset
self._start_simulation()
File "/home/me/git/diplomka-src/coppelia_gym/gym_snake/envs/gym_generic.py", line 274, in _start_simulation
"sim.boolparam_threaded_rendering_enabled", True, self.servicecall
File "/home/me/git/diplomka-src/coppeliasim_api/b0RemoteApi.py", line 392, in simxSetBoolParameter
return self._handleFunction('SetBoolParameter',reqArgs,topic)
File "/home/me/git/diplomka-src/coppeliasim_api/b0RemoteApi.py", line 73, in _handleFunction
rep = msgpack.unpackb(self._serviceClient.call(packedData))
File "/home/me/git/diplomka-src/coppeliasim_api/b0.py", line 234, in call
rep_bytes = bytearray(outarr.contents)
ValueError: NULL pointer access
2020-04-25 14:07:31 [`g���] error: HB: Context was terminated
2020-04-25 14:07:41 [`g���] error: HB: Context was terminated
2020-04-25 14:07:51 [`g���] error: HB: Context was terminated
Related code segment in b0.py
Code: Select all
class ServiceClient:
def call(self, data):
buf = ct.c_char_p(data)
sz = len(data)
outsz = ct.c_size_t()
outbuf = b0_service_client_call(self._cli, buf, sz, ct.byref(outsz))
outarr = ct.cast(outbuf, ct.POINTER(ct.c_ubyte * outsz.value))
rep_bytes = bytearray(outarr.contents)
b0_buffer_delete(outbuf) # new on 16.01.2020
return rep_bytes
Code: Select all
File "/home/me/git/diplomka-src/coppeliasim_api/b0.py"
ValueError: NULL pointer access
Code: Select all
File "/home/me/git/diplomka-src/coppelia_gym/gym_snake/envs/gym_generic.py", line 96, in reset
self._start_simulation()
- CoppeliaSim Edu V4.0.0. (rev. 4)
- $ python --version
Python 3.6.9 - $ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
Client initialization (I increased the timeout per advice in https://forum.coppeliarobotics.com/viewtopic.php?t=7858):
Code: Select all
self._client = Api(
nodeName="b0RemoteApi_pythonClient",
channelName="b0RemoteApiAddOn",
inactivityToleranceInSec=60,
timeout=300,
)
- What is the error caused by?
- What should I do to avoid it?