From: Markus R. <rol...@un...> - 2007-05-01 13:34:36
|
Hi, Markus Rollmann wrote: > Joschka Boedecker wrote: >> * It seems evident that we have to optimize the physics somehow. We >> should at least get to the point where 3 vs. 3 robots can be reliably >> simulated, I think. Without having done any profiling at all, my >> suggestion would be to take a look at possibilities to optimize the >> collision detection in the ODE part. One possibility is to use separate >> collision spaces for each robot. From the ODE Wiki [1]: > [...] [...] > I think there are only very few changes necessary: > > - It is already possible to create the additional 'Space' nodes in the > .rsg files. So putting each robot into it's own collision space would be > a matter of enclosing the current soccerbot.rsg into an additional (node > space ) expression or using an external wrapper .rsg that imports the > soccerbot. > > - The problem is registering the ODE geoms to the proper space. This is > done in the OnLink() method of the collider class. It calls GetSpaceId() > wich in turn calls OdeObject::GetSpace(). Currently the global Space > object below the SceneServer is returned. > > This behavior could be changed to walk the parent chain of the ODEObject > in order to find the closest Space parent. If this fails we revert to > the current behavior and return the default space. Therefore existing > .rsg files will still work as expected. > > - The actual collision logic needs very little change. The wiki entry > [1], that Joschka linked to provides a code snipped that we could nearly > copy 1:1 into our code base. > > I'll try to implement these changes in the simspark CVS. The changes are now part of the simspark CVS trunk. I did test the changes with rsgedit and the jointtest.rsg demo, where I placed each hinge2thing.rsg, sliderthing.rsg and universalthing.rsg in a separate space each- and it worked fine ;) The problem was not in the setup of the different collision spaces but in the deconstruction of them. The problem is that all ODE objects should be deconstructed in the proper order. This means that joints should be removed before the attached bodies are destroyed, and geoms before the spaces they are contained in etc. If they are destroyed in the order in which they are traversed in the scene graph these conditions do not hold, which may lead to ODE segfaults. The problem will occcur whenever an agent disconnects from the server. In this case it's personal ODE sub spaces have to be destroyed and removed from the global space. In the simspark CVS I'm facing this problem when the user reloads the entire scene from rsgedit. For this case I added a virtual DestroyODEObject() dtor to each ODEObject that is called from World nodes OnUnlink() method. I'm not sure if it's necessary to copy this whole machinery to the rcsssrver3d CVS, maybe some special handling for agent disconnect will suffice? regards, Markus |