Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Delete a rigid object on-the-fly #5

#1

I have updated the ODESimulator class to provide a function to delete rigid objects from the simulation.

void ODESimulator::RemoveObject(ODERigidObject* object)
{
  for ( size_t i=0; i<objects.size(); ++i )
  {
    if ( object == objects[i] )
    {
      objects.erase(objects.begin()+i);
      delete object;
      break;
    }
  }
}

One also has to delete the RigidObject from the RobotWorld object by calling RobotWorld::DeleteRigidObject().

A functional deletion procedure could then look like this:

void disposeRigidObject(ODERigidObject* object)
{
	world_->DeleteRigidObject(object->obj.name);  // RobotWorld* world_
	simulation_->odesim.RemoveObject(object);     // WorldSimulation* simulation_
	simulation_->UpdateModel();
}

I wonder tho if this is safe to do?

  • solved #2
  • replies 2
  • views 4K
  • likes 0
#2

This is fairly safe to do... if you know what you’re doing. The simulation visualization might be messed up, somewhat, and the state saving and logging routines will definitely not work properly. But if you’re just simulating forward this should work just fine.

ipa-rmb-mr accepted post #2 as the answer
#3