I am running couple of headless instances of the CoppeliaSim environment in parallel and I have created a wrapper around the python code that you have provided.
Code: Select all
class EnvWrapper:
def __init__(self, port: int)
self.client = RemoteAPIClient(port)
self.sim = client.getobject('sim')
self.sensor1Handle = sim.getObject('/VisionSensor')
self.sensor2Handle = sim.getObject('/PassiveVisionSensor')
I would like to run the algorithm for example 300 times at each iteration, to learn features and exploit the environments. For this purpose I have the following:
- 8 available processes
- 5 available CoppeliaSim environments (for example ) running in parallel
For the purpose I have made an environment pool so a process can use an environment and when it is done to return it so other process can use it later on. The problem is the following: There is no way to serialize the wrapper class so I can pass it to a shared memory and share it among the processes. I know that this class is a complex data type and it is not an easy task and it holds a state information, but still. my question is, is there a way to make this happen and pass the instance and state of the RemoteAPIClient so I wont be needed to create an instance every time and to reduce the amount of time to initialize those variables every time, and if it is not possible, is it safe to make a new instance every time ?
Thanks in advance!