self collision and collision with obstacle