def __init__(self):
    self.object_locations = rospy.get_param('OBJECT_POSITIONS', [])
    self.num_obstacles = (int(rospy.get_param('NUMBER_OF_OBSTACLES', 0)) if (not self.object_locations) else len(self.object_locations))
    self.min_obstacle_dist = float(rospy.get_param('MIN_DISTANCE_BETWEEN_OBSTACLES', 2.0))
    self.randomize = utils.str2bool(rospy.get_param('RANDOMIZE_OBSTACLE_LOCATIONS', False))
    self.use_bot_car = utils.str2bool(rospy.get_param('IS_OBSTACLE_BOT_CAR', False))
    self.obstacle_names = ['obstacle_{}'.format(i) for i in range(self.num_obstacles)]
    self.obstacle_dimensions = (ObstacleDimensions.BOT_CAR_DIMENSION if self.use_bot_car else ObstacleDimensions.BOX_OBSTACLE_DIMENSION)
    self.track_data = TrackData.get_instance()
    rospy.wait_for_service(SET_MODEL_STATE)
    rospy.wait_for_service(SPAWN_SDF_MODEL)
    rospy.wait_for_service(SPAWN_URDF_MODEL)
    self.set_model_state = ServiceProxyWrapper(SET_MODEL_STATE, SetModelState)
    self.spawn_sdf_model = ServiceProxyWrapper(SPAWN_SDF_MODEL, SpawnModel)
    self.spawn_urdf_model = ServiceProxyWrapper(SPAWN_URDF_MODEL, SpawnModel)
    obstacle_model_folder = ('bot_car' if self.use_bot_car else 'box_obstacle')
    rospack = rospkg.RosPack()
    deepracer_path = rospack.get_path('deepracer_simulation_environment')
    obstacle_sdf_path = os.path.join(deepracer_path, 'models', obstacle_model_folder, 'model.sdf')
    with open(obstacle_sdf_path, 'r') as fp:
        self.obstacle_sdf = fp.read()
    self.obstacle_poses = self._compute_obstacle_poses()
    self._spawn_obstacles()
    self._configure_randomizer()
def __init__(self):
    self.object_locations = rospy.get_param('OBJECT_POSITIONS', [])
    self.num_obstacles = (int(rospy.get_param('NUMBER_OF_OBSTACLES', 0)) if (not self.object_locations) else len(self.object_locations))
    self.min_obstacle_dist = float(rospy.get_param('MIN_DISTANCE_BETWEEN_OBSTACLES', 2.0))
    self.randomize = utils.str2bool(rospy.get_param('RANDOMIZE_OBSTACLE_LOCATIONS', False))
    self.use_bot_car = utils.str2bool(rospy.get_param('IS_OBSTACLE_BOT_CAR', False))
    self.obstacle_names = ['obstacle_{}'.format(i) for i in range(self.num_obstacles)]
    self.obstacle_dimensions = (ObstacleDimensions.BOT_CAR_DIMENSION if self.use_bot_car else ObstacleDimensions.BOX_OBSTACLE_DIMENSION)
    self.track_data = TrackData.get_instance()
    rospy.wait_for_service(SET_MODEL_STATE)
    rospy.wait_for_service(SPAWN_SDF_MODEL)
    rospy.wait_for_service(SPAWN_URDF_MODEL)
    self.set_model_state = ServiceProxyWrapper(SET_MODEL_STATE, SetModelState)
    self.spawn_sdf_model = ServiceProxyWrapper(SPAWN_SDF_MODEL, SpawnModel)
    self.spawn_urdf_model = ServiceProxyWrapper(SPAWN_URDF_MODEL, SpawnModel)
    obstacle_model_folder = ('bot_car' if self.use_bot_car else 'box_obstacle')
    rospack = rospkg.RosPack()
    deepracer_path = rospack.get_path('deepracer_simulation_environment')
    obstacle_sdf_path = os.path.join(deepracer_path, 'models', obstacle_model_folder, 'model.sdf')
    with open(obstacle_sdf_path, 'r') as fp:
        self.obstacle_sdf = fp.read()
    self.obstacle_poses = self._compute_obstacle_poses()
    self._spawn_obstacles()
    self._configure_randomizer()