boost::shared_ptr<CollisionChecker> CollisionChecker::GetOrCreate(OR::EnvironmentBase& env) {
  UserDataPtr ud = GetUserData(env, "trajopt_cc");
  if (!ud) {
    LOG_INFO("creating bullet collision checker for environment");
     //throw std::runtime_error("not implemented");
    ud =  CreateCollisionChecker(env.shared_from_this());
    SetUserData(env, "trajopt_cc", ud);
  }
  else {
    LOG_DEBUG("already have a collision checker for this environment");
  }
  return boost::dynamic_pointer_cast<CollisionChecker>(ud);
}
  BeliefCollisionCheckerPtr BeliefCollisionChecker::GetOrCreate(OR::EnvironmentBase& env) {
    UserDataPtr ud = GetUserData(env, "trajopt_cc");
    if (!ud) {
      LOG_INFO("creating bullet belief collision checker for environment");
      BeliefCollisionCheckerPtr checker(new BeliefCollisionChecker(env.shared_from_this()));
      ud = checker;
      SetUserData(env, "trajopt_cc", ud);
    }
    else {
      LOG_DEBUG("already have a belief collision checker for this environment");
    }
    return boost::dynamic_pointer_cast<BeliefCollisionChecker>(ud);

  }