You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a simulation with two parts. One is the actual graphical pybullet simulation, and another is an intensive/slow math computation. I want to use multiprocessing to split it into two separate processes. I have created a SimGame object that I want to be shared across processes, and am using multiprocessing BaseManager for that. The SimGame object takes a pybullet client as an argument (ie. SimGame(p, ..) where self.bullet_client = p). The function for my process looks like this:
def main_game(SimGame):
proceed = 1
while proceed:
SimGame.step()
p.stepSimulation()
time.sleep(time_step)
However, since you cannot pickle modules in multiprocessing, I am a little confused about how to use PyBullet to instantiate the SimGame object.
I think the approach would be to use p.connect(GUI_Server) in the main file, and then have p.connect(SHARED_MEMORY) under SimGame. Something like this
from sim_game import SimGame
def main():
p.connect(p.GUI_SERVER)
p.setAdditionalSearchPath(pd.getDataPath())
class simManager(BaseManager):
pass
simManager.register("simulator_game", SimGame)
manager = simManager()
manager.start()
sim = manager.simulator_game("circle")
When I do this, the GUI, but is just stuck and I get a spinning mouse cursor. I'd appreciate any clarification about the right way to do this.
TL;DR: Is it possible to connect to p.GUI_SERVER from one file, and then connect to the same server using p.SHARED_MEMORY from another? I tried to do this, but my simulation freezes. See above for details.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I am trying to create a simulation with two parts. One is the actual graphical pybullet simulation, and another is an intensive/slow math computation. I want to use multiprocessing to split it into two separate processes. I have created a SimGame object that I want to be shared across processes, and am using multiprocessing BaseManager for that. The SimGame object takes a pybullet client as an argument (ie. SimGame(p, ..) where self.bullet_client = p). The function for my process looks like this:
However, since you cannot pickle modules in multiprocessing, I am a little confused about how to use PyBullet to instantiate the SimGame object.
I think the approach would be to use p.connect(GUI_Server) in the main file, and then have p.connect(SHARED_MEMORY) under SimGame. Something like this
that would then be called from another file
When I do this, the GUI, but is just stuck and I get a spinning mouse cursor. I'd appreciate any clarification about the right way to do this.
TL;DR: Is it possible to connect to p.GUI_SERVER from one file, and then connect to the same server using p.SHARED_MEMORY from another? I tried to do this, but my simulation freezes. See above for details.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions