Beispiel #1
0
 def upload_step_metrics(self, metrics):
     metrics[StepMetrics.EPISODE.value] = self._number_of_trials_
     self._progress_ = metrics[StepMetrics.PROG.value]
     self._episode_status = metrics[StepMetrics.EPISODE_STATUS.value]
     if self._episode_status in self.reset_count_dict:
         self.reset_count_dict[self._episode_status] += 1
     StepMetrics.validate_dict(metrics)
     sim_trace_log(metrics)
     if self.is_save_simtrace_enabled:
         write_simtrace_to_local_file(self._simtrace_local_path, metrics)
Beispiel #2
0
 def upload_step_metrics(self, metrics):
     self._progress_ = metrics[StepMetrics.PROG.value]
     self._episode_status = metrics[StepMetrics.EPISODE_STATUS.value]
     self._episode_reward_ += metrics[StepMetrics.REWARD.value]
     if not self._is_eval_:
         metrics[StepMetrics.EPISODE.value] = self._episode_
         StepMetrics.validate_dict(metrics)
         sim_trace_log(metrics)
         if self.is_save_simtrace_enabled:
             write_simtrace_to_local_file(self._simtrace_local_path,
                                          metrics)
Beispiel #3
0
 def upload_step_metrics(self, metrics):
     self._progress_ = metrics[StepMetrics.PROG.value]
     self._episode_status = metrics[StepMetrics.EPISODE_STATUS.value]
     # Community fix to have reward for evaluation runs during training
     self._episode_reward_ += metrics[StepMetrics.REWARD.value]
     if not self._is_eval_:
         metrics[StepMetrics.EPISODE.value] = self._episode_
         StepMetrics.validate_dict(metrics)
         sim_trace_log(metrics)
         if self.is_save_simtrace_enabled:
             write_simtrace_to_local_file(self._simtrace_local_path,
                                          metrics)
     self._update_mp4_video_metrics(metrics)
Beispiel #4
0
 def upload_step_metrics(self, metrics):
     metrics[StepMetrics.EPISODE.value] = self._number_of_trials_
     self._progress_ = metrics[StepMetrics.PROG.value]
     self._episode_status = metrics[StepMetrics.EPISODE_STATUS.value]
     if self._episode_status in self.reset_count_dict:
         self.reset_count_dict[self._episode_status] += 1
     StepMetrics.validate_dict(metrics)
     sim_trace_log(metrics)
     if self.is_save_simtrace_enabled:
         write_simtrace_to_local_file(
             os.path.join(os.path.join(ITERATION_DATA_LOCAL_FILE_PATH, self._agent_name_),
                          IterationDataLocalFileNames.SIM_TRACE_EVALUATION_LOCAL_FILE.value),
             metrics)
     self._update_mp4_video_metrics(metrics)
Beispiel #5
0
 def upload_step_metrics(self, metrics):
     self._progress_ = metrics[StepMetrics.PROG.value]
     self._episode_status = metrics[StepMetrics.EPISODE_STATUS.value]
     # Community fix to have reward for evaluation runs during training
     self._episode_reward_ += metrics[StepMetrics.REWARD.value]
     if not self._is_eval_:
         metrics[StepMetrics.EPISODE.value] = self._episode_
         StepMetrics.validate_dict(metrics)
         sim_trace_log(metrics)
         if self.is_save_simtrace_enabled:
             write_simtrace_to_local_file(
                 os.path.join(os.path.join(ITERATION_DATA_LOCAL_FILE_PATH, self._agent_name_),
                              IterationDataLocalFileNames.SIM_TRACE_TRAINING_LOCAL_FILE.value),
                 metrics)
     self._update_mp4_video_metrics(metrics)
Beispiel #6
0
 def upload_step_metrics(self, metrics):
     self._progress_ = metrics[StepMetrics.PROG.value]
     self._episode_status = metrics[StepMetrics.EPISODE_STATUS.value]
     self._episode_reward_ += metrics[StepMetrics.REWARD.value]
     #! TODO have this work with new sim trace class
     if not self._is_eval_:
         metrics[StepMetrics.EPISODE.value] = self._episode_
         self._episode_reward_ += metrics[StepMetrics.REWARD.value]
         StepMetrics.validate_dict(metrics)
         sim_trace_log(metrics)
         if self.is_save_simtrace_enabled:
             write_simtrace_to_local_file(
                 os.path.join(
                     os.path.join(ITERATION_DATA_LOCAL_FILE_PATH,
                                  self._agent_name_),
                     IterationDataLocalFileNames.
                     SIM_TRACE_TRAINING_LOCAL_FILE.value), metrics)
Beispiel #7
0
 def __init__(self, config_dict, run_phase_sink, metrics):
     '''agent_name - String containing the name of the agent
        config_dict - Dictionary containing all the keys in ConfigParams
        run_phase_sink - Sink to recieve notification of a change in run phase
     '''
     # reset rules manager
     self._metrics = metrics
     self._is_continuous = config_dict[const.ConfigParams.IS_CONTINUOUS.value]
     self._is_reset = False
     self._pause_count = 0
     self._reset_rules_manager = construct_reset_rules_manager(config_dict)
     self._ctrl_status = dict()
     self._ctrl_status[AgentCtrlStatus.AGENT_PHASE.value] = AgentPhase.RUN.value
     self._config_dict = config_dict
     self._number_of_resets = config_dict[const.ConfigParams.NUMBER_OF_RESETS.value]
     self._off_track_penalty = config_dict[const.ConfigParams.OFF_TRACK_PENALTY.value]
     self._collision_penalty = config_dict[const.ConfigParams.COLLISION_PENALTY.value]
     self._pause_end_time = 0.0
     self._reset_count = 0
     # simapp_version speed scale
     self._speed_scale_factor_ = get_speed_factor(config_dict[const.ConfigParams.VERSION.value])
     # Store the name of the agent used to set agents position on the track
     self._agent_name_ = config_dict[const.ConfigParams.AGENT_NAME.value]
     # Store the name of the links in the agent, this should be const
     self._agent_link_name_list_ = config_dict[const.ConfigParams.LINK_NAME_LIST.value]
     # Store the reward function
     self._reward_ = config_dict[const.ConfigParams.REWARD.value]
     self._track_data_ = TrackData.get_instance()
     # Create publishers for controlling the car
     self._velocity_pub_dict_ = OrderedDict()
     self._steering_pub_dict_ = OrderedDict()
     for topic in config_dict[const.ConfigParams.VELOCITY_LIST.value]:
         self._velocity_pub_dict_[topic] = rospy.Publisher(topic, Float64, queue_size=1)
     for topic in config_dict[const.ConfigParams.STEERING_LIST.value]:
         self._steering_pub_dict_[topic] = rospy.Publisher(topic, Float64, queue_size=1)
     #Create default reward parameters
     self._reward_params_ = const.RewardParam.make_default_param()
     #Creat the default metrics dictionary
     self._step_metrics_ = StepMetrics.make_default_metric()
     # State variable to track if the car direction has been reversed
     self._reverse_dir_ = False
     # Dictionary of bools indicating starting position behavior
     self._start_pos_behavior_ = \
         {'change_start' : config_dict[const.ConfigParams.CHANGE_START.value],
          'alternate_dir' : config_dict[const.ConfigParams.ALT_DIR.value]}
     # Dictionary to track the previous way points
     self._prev_waypoints_ = {'prev_point' : Point(0, 0), 'prev_point_2' : Point(0, 0)}
     # Dictionary containing some of the data for the agent
     self._data_dict_ = {'max_progress': 0.0,
                         'current_progress': 0.0,
                         'prev_progress': 0.0,
                         'steps': 0.0,
                         'start_ndist': 0.0}
     #Load the action space
     self._action_space_, self._json_actions_ = \
         load_action_space(config_dict[const.ConfigParams.ACTION_SPACE_PATH.value])
     #! TODO evaluate if this is the best way to reset the car
     rospy.wait_for_service(SET_MODEL_STATE)
     rospy.wait_for_service(GET_MODEL_STATE)
     self.set_model_state = ServiceProxyWrapper(SET_MODEL_STATE, SetModelState)
     self.get_model_client = ServiceProxyWrapper(GET_MODEL_STATE, GetModelState)
     # Adding the reward data publisher
     self.reward_data_pub = RewardDataPublisher(self._agent_name_, self._json_actions_)
     # init time
     self.last_time = 0.0
     self.curr_time = 0.0
     # subscriber to time to update camera position
     self.camera_manager = CameraManager.get_instance()
     # True if the agent is in the training phase
     self._is_training_ = False
     rospy.Subscriber('/clock', Clock, self._update_sim_time)
     # Register to the phase sink
     run_phase_sink.register(self)
     # Make sure velicty and angle are set to 0
     send_action(self._velocity_pub_dict_, self._steering_pub_dict_, 0.0, 0.0)
     start_pose = self._track_data_._center_line_.interpolate_pose(self._data_dict_['start_ndist'] * self._track_data_.get_track_length(),
                                                                   reverse_dir=self._reverse_dir_,
                                                                   finite_difference=FiniteDifference.FORWARD_DIFFERENCE)
     self._track_data_.initialize_object(self._agent_name_, start_pose, ObstacleDimensions.BOT_CAR_DIMENSION)
     self.car_model_state = self.get_model_client(self._agent_name_, '')
     self._reset_agent(reset_pos=const.ResetPos.START_POS.value)
    def __init__(self, config_dict, run_phase_sink, metrics):
        '''config_dict (dict): containing all the keys in ConfigParams
           run_phase_sink (RunPhaseSubject): Sink to receive notification of a change in run phase
           metrics (EvalMetrics/TrainingMetrics): Training or evaluation metrics
        '''
        # reset rules manager
        self._metrics = metrics
        self._is_continuous = config_dict[
            const.ConfigParams.IS_CONTINUOUS.value]
        self._reset_rules_manager = construct_reset_rules_manager(config_dict)
        self._ctrl_status = dict()
        self._ctrl_status[
            AgentCtrlStatus.AGENT_PHASE.value] = AgentPhase.RUN.value
        self._config_dict = config_dict
        self._done_condition = config_dict.get(
            const.ConfigParams.DONE_CONDITION.value, any)
        self._number_of_resets = config_dict[
            const.ConfigParams.NUMBER_OF_RESETS.value]
        self._off_track_penalty = config_dict[
            const.ConfigParams.OFF_TRACK_PENALTY.value]
        self._collision_penalty = config_dict[
            const.ConfigParams.COLLISION_PENALTY.value]
        self._pause_duration = 0.0
        self._reset_count = 0
        self._curr_crashed_object_name = ''
        # simapp_version speed scale
        self._speed_scale_factor_ = get_speed_factor(
            config_dict[const.ConfigParams.VERSION.value])
        # Store the name of the agent used to set agents position on the track
        self._agent_name_ = config_dict[const.ConfigParams.AGENT_NAME.value]
        # Set start lane. This only support for two agents H2H race
        self._agent_idx_ = get_racecar_idx(self._agent_name_)
        # Get track data
        self._track_data_ = TrackData.get_instance()
        if self._agent_idx_ is not None:
            self._start_lane_ = self._track_data_.inner_lane \
                if self._agent_idx_ % 2 else self._track_data_.outer_lane
        else:
            self._start_lane_ = self._track_data_.center_line
        # Store the name of the links in the agent, this should be const
        self._agent_link_name_list_ = config_dict[
            const.ConfigParams.LINK_NAME_LIST.value]
        # Store the reward function
        self._reward_ = config_dict[const.ConfigParams.REWARD.value]
        # Create publishers for controlling the car
        self._velocity_pub_dict_ = OrderedDict()
        self._steering_pub_dict_ = OrderedDict()
        for topic in config_dict[const.ConfigParams.VELOCITY_LIST.value]:
            self._velocity_pub_dict_[topic] = rospy.Publisher(topic,
                                                              Float64,
                                                              queue_size=1)
        for topic in config_dict[const.ConfigParams.STEERING_LIST.value]:
            self._steering_pub_dict_[topic] = rospy.Publisher(topic,
                                                              Float64,
                                                              queue_size=1)
        #Create default reward parameters
        self._reward_params_ = const.RewardParam.make_default_param()
        #Create the default metrics dictionary
        self._step_metrics_ = StepMetrics.make_default_metric()
        # Dictionary of bools indicating starting position behavior
        self._start_pos_behavior_ = \
            {'change_start' : config_dict[const.ConfigParams.CHANGE_START.value],
             'alternate_dir' : config_dict[const.ConfigParams.ALT_DIR.value]}
        # Dictionary to track the previous way points
        self._prev_waypoints_ = {
            'prev_point': Point(0, 0),
            'prev_point_2': Point(0, 0)
        }

        # Normalized distance of new start line from the original start line of the track.
        start_ndist = 0.0

        # Normalized start position offset w.r.t to start_ndist, which is the start line of the track.
        start_pos_offset = config_dict.get(
            const.ConfigParams.START_POSITION.value, 0.0)
        self._start_line_ndist_offset = start_pos_offset / self._track_data_.get_track_length(
        )

        # Dictionary containing some of the data for the agent
        # - During the reset call, every value except start_ndist will get wiped out by self._clear_data
        #   (reset happens prior to every episodes begin)
        # - If self._start_line_ndist_offset is not 0 (usually some minus value),
        #   then initial current_progress suppose to be non-zero (usually some minus value) as progress
        #   suppose to be based on start_ndist.
        # - This will be correctly calculated by first call of utils.compute_current_prog function.
        #   As prev_progress will be initially 0.0 and physical position is not at start_ndist,
        #   utils.compute_current_prog will return negative progress if self._start_line_ndist_offset is negative value
        #   (meaning behind start line) and will return positive progress if self._start_line_ndist_offset is
        #   positive value (meaning ahead of start line).
        self._data_dict_ = {
            'max_progress': 0.0,
            'current_progress': 0.0,
            'prev_progress': 0.0,
            'steps': 0.0,
            'start_ndist': start_ndist,
            'prev_car_pose': 0.0
        }

        #Load the action space
        self._action_space_, self._json_actions_ = \
            load_action_space(config_dict[const.ConfigParams.ACTION_SPACE_PATH.value])
        #! TODO evaluate if this is the best way to reset the car
        # Adding the reward data publisher
        self.reward_data_pub = RewardDataPublisher(self._agent_name_,
                                                   self._json_actions_)
        # subscriber to time to update camera position
        self.camera_manager = CameraManager.get_instance()
        # True if the agent is in the training phase
        self._is_training_ = False
        # Register to the phase sink
        run_phase_sink.register(self)
        # Make sure velocity and angle are set to 0
        send_action(self._velocity_pub_dict_, self._steering_pub_dict_, 0.0,
                    0.0)

        # start_dist should be hypothetical start line (start_ndist) plus
        # start position offset (start_line_ndist_offset).
        start_pose = self._start_lane_.interpolate_pose(
            (self._data_dict_['start_ndist'] + self._start_line_ndist_offset) *
            self._track_data_.get_track_length(),
            finite_difference=FiniteDifference.FORWARD_DIFFERENCE)
        self._track_data_.initialize_object(self._agent_name_, start_pose, \
                                            ObstacleDimensions.BOT_CAR_DIMENSION)

        self.make_link_points = lambda link_state: Point(
            link_state.pose.position.x, link_state.pose.position.y)
        self.reference_frames = ['' for _ in self._agent_link_name_list_]

        self._pause_car_model_pose = None
        self._park_position = DEFAULT_PARK_POSITION
        AbstractTracker.__init__(self, TrackerPriority.HIGH)
Beispiel #9
0
def set_reward_and_metrics(reward_params, step_metrics, pos_dict, track_data,
                           next_index, prev_index, action, json_actions):
    '''Populates the reward_params and step_metrics dictionaries with the common
       metrics and parameters.
       reward_params - Dictionary containing the input parameters to the reward function
       step_metrics - Dictionary containing the metrics that are sent to s3
       pos_dict - Dictionary containing the agent position data, keys defined in AgentPos
       track_data - Object containing all the track information and geometry
       next_index - The index of the next way point
       prev_index - The index of the previous way point
       action - Integer containing the action to take
       json_actions - Dictionary that maps action into steering and angle
    '''
    try:
        # Check that the required keys are present in the dicts that are being
        # passed in, these methods will throw an exception if a key is missing
        RewardParam.validate_dict(reward_params)
        StepMetrics.validate_dict(step_metrics)

        model_point = pos_dict[AgentPos.POINT.value]
        # Geat the nearest points
        nearest_pnts_dict = track_data.get_nearest_points(model_point)
        # Compute distance from center and road width
        nearest_dist_dict = track_data.get_nearest_dist(
            nearest_pnts_dict, model_point)
        # Compute the distance from the previous and next points
        distance_from_prev, distance_from_next = \
            track_data.get_distance_from_next_and_prev(model_point, prev_index,
                                                       next_index)
        # Compute which points are on the track
        wheel_on_track = track_data.points_on_track(
            pos_dict[AgentPos.LINK_POINTS.value])
        # Get the model orientation
        model_orientation = pos_dict[AgentPos.ORIENTATION.value]
        # Set the reward and metric parameters
        reward_params[RewardParam.CENTER_DIST.value[0]] = \
            nearest_dist_dict[TrackNearDist.NEAR_DIST_CENT.value]
        reward_params[RewardParam.CLS_WAYPNY.value[0]] = [
            prev_index, next_index
        ]
        reward_params[RewardParam.LEFT_CENT.value[0]] = \
            nearest_dist_dict[TrackNearDist.NEAR_DIST_IN.value] < \
            nearest_dist_dict[TrackNearDist.NEAR_DIST_OUT.value]
        reward_params[RewardParam.WAYPNTS.value[0]] = track_data.get_way_pnts()
        reward_params[RewardParam.TRACK_WIDTH.value[0]] = \
            nearest_pnts_dict[TrackNearPnts.NEAR_PNT_IN.value] \
            .distance(nearest_pnts_dict[TrackNearPnts.NEAR_PNT_OUT.value])
        reward_params[
            RewardParam.TRACK_LEN.value[0]] = track_data.get_track_length()
        step_metrics[StepMetrics.X.value] = \
        reward_params[RewardParam.X.value[0]] = model_point.x
        step_metrics[StepMetrics.Y.value] = \
        reward_params[RewardParam.Y.value[0]] = model_point.y
        step_metrics[StepMetrics.YAW.value] = \
        reward_params[RewardParam.HEADING.value[0]] = \
            Rotation.from_quat(model_orientation).as_euler('zyx')[0] * 180.0 / math.pi
        step_metrics[StepMetrics.CLS_WAYPNT.value] = \
            next_index if distance_from_next < distance_from_prev else prev_index
        step_metrics[
            StepMetrics.TRACK_LEN.value] = track_data.get_track_length()
        step_metrics[StepMetrics.STEER.value] = \
        reward_params[RewardParam.STEER.value[0]] = \
            float(json_actions[action]['steering_angle'])
        step_metrics[StepMetrics.THROTTLE.value] = \
        reward_params[RewardParam.SPEED.value[0]] = \
            float(json_actions[action]['speed'])
        step_metrics[StepMetrics.WHEELS_TRACK.value] = \
        reward_params[RewardParam.WHEELS_ON_TRACK.value[0]] = all(wheel_on_track)
        step_metrics[StepMetrics.ACTION.value] = action
    except KeyError as ex:
        raise GenericRolloutException("Key {}, not found".format(ex))
    except Exception as ex:
        raise GenericRolloutException(
            'Cannot compute reward and metrics: {}'.format(ex))
Beispiel #10
0
    def __init__(self, config_dict, run_phase_sink, metrics):
        '''agent_name - String containing the name of the agent
           config_dict - Dictionary containing all the keys in ConfigParams
           run_phase_sink - Sink to recieve notification of a change in run phase
        '''
        # reset rules manager
        self._metrics = metrics
        self._is_continuous = config_dict[
            const.ConfigParams.IS_CONTINUOUS.value]
        self._is_reset = False
        self._reset_rules_manager = construct_reset_rules_manager(config_dict)
        self._ctrl_status = dict()
        self._ctrl_status[
            AgentCtrlStatus.AGENT_PHASE.value] = AgentPhase.RUN.value
        self._config_dict = config_dict
        self._done_condition = config_dict.get(
            const.ConfigParams.DONE_CONDITION.value, any)
        self._number_of_resets = config_dict[
            const.ConfigParams.NUMBER_OF_RESETS.value]
        self._off_track_penalty = config_dict[
            const.ConfigParams.OFF_TRACK_PENALTY.value]
        self._collision_penalty = config_dict[
            const.ConfigParams.COLLISION_PENALTY.value]
        self._pause_duration = 0.0
        self._reset_count = 0
        self._curr_crashed_object_name = None
        self._last_crashed_object_name = None
        # simapp_version speed scale
        self._speed_scale_factor_ = get_speed_factor(
            config_dict[const.ConfigParams.VERSION.value])
        # Store the name of the agent used to set agents position on the track
        self._agent_name_ = config_dict[const.ConfigParams.AGENT_NAME.value]
        # Set start lane. This only support for two agents H2H race
        self._agent_idx_ = get_racecar_idx(self._agent_name_)
        # Get track data
        self._track_data_ = TrackData.get_instance()
        if self._agent_idx_ is not None:
            self._start_lane_ = self._track_data_.inner_lane \
                if self._agent_idx_ % 2 else self._track_data_.outer_lane
        else:
            self._start_lane_ = self._track_data_.center_line
        # Store the name of the links in the agent, this should be const
        self._agent_link_name_list_ = config_dict[
            const.ConfigParams.LINK_NAME_LIST.value]
        # Store the reward function
        self._reward_ = config_dict[const.ConfigParams.REWARD.value]
        # Create publishers for controlling the car
        self._velocity_pub_dict_ = OrderedDict()
        self._steering_pub_dict_ = OrderedDict()
        for topic in config_dict[const.ConfigParams.VELOCITY_LIST.value]:
            self._velocity_pub_dict_[topic] = rospy.Publisher(topic,
                                                              Float64,
                                                              queue_size=1)
        for topic in config_dict[const.ConfigParams.STEERING_LIST.value]:
            self._steering_pub_dict_[topic] = rospy.Publisher(topic,
                                                              Float64,
                                                              queue_size=1)
        #Create default reward parameters
        self._reward_params_ = const.RewardParam.make_default_param()
        #Creat the default metrics dictionary
        self._step_metrics_ = StepMetrics.make_default_metric()
        # Dictionary of bools indicating starting position behavior
        self._start_pos_behavior_ = \
            {'change_start' : config_dict[const.ConfigParams.CHANGE_START.value],
             'alternate_dir' : config_dict[const.ConfigParams.ALT_DIR.value]}
        # Dictionary to track the previous way points
        self._prev_waypoints_ = {
            'prev_point': Point(0, 0),
            'prev_point_2': Point(0, 0)
        }
        # Normalize start position in meter to normalized start_ndist in percentage
        start_ndist = config_dict.get(const.ConfigParams.START_POSITION.value, 0.0) / \
            self._track_data_.get_track_length()
        # Dictionary containing some of the data for the agent
        self._data_dict_ = {
            'max_progress': 0.0,
            'current_progress': 0.0,
            'prev_progress': 0.0,
            'steps': 0.0,
            'start_ndist': start_ndist
        }
        #Load the action space
        self._action_space_, self._json_actions_ = \
            load_action_space(config_dict[const.ConfigParams.ACTION_SPACE_PATH.value])
        #! TODO evaluate if this is the best way to reset the car
        # Adding the reward data publisher
        self.reward_data_pub = RewardDataPublisher(self._agent_name_,
                                                   self._json_actions_)
        # subscriber to time to update camera position
        self.camera_manager = CameraManager.get_instance()
        # True if the agent is in the training phase
        self._is_training_ = False
        # Register to the phase sink
        run_phase_sink.register(self)
        # Make sure velicty and angle are set to 0
        send_action(self._velocity_pub_dict_, self._steering_pub_dict_, 0.0,
                    0.0)
        start_pose = self._track_data_.center_line.interpolate_pose(
            self._data_dict_['start_ndist'] *
            self._track_data_.get_track_length(),
            finite_difference=FiniteDifference.FORWARD_DIFFERENCE)
        self._track_data_.initialize_object(self._agent_name_, start_pose, \
                                            ObstacleDimensions.BOT_CAR_DIMENSION)

        self.make_link_points = lambda link_state: Point(
            link_state.pose.position.x, link_state.pose.position.y)
        self.reference_frames = ['' for _ in self._agent_link_name_list_]

        self._pause_car_model_pose = None
        self._park_position = DEFAULT_PARK_POSITION
        AbstractTracker.__init__(self, TrackerPriority.HIGH)
 def __init__(self, config_dict):
     '''agent_name - String containing the name of the agent
        config_dict - Dictionary containing all the keys in ConfigParams
     '''
     # simapp_version speed scale
     self._speed_scale_factor_ = get_speed_factor(
         config_dict[const.ConfigParams.VERSION.value])
     # Store the name of the agent used to set agents position on the track
     self._agent_name_ = config_dict[const.ConfigParams.AGENT_NAME.value]
     # Store the name of the links in the agent, this should be const
     self._agent_link_name_list_ = config_dict[
         const.ConfigParams.LINK_NAME_LIST.value]
     # Store the reward function
     self._reward_ = config_dict[const.ConfigParams.REWARD.value]
     self._track_data_ = TrackData.get_instance()
     # Create publishers for controlling the car
     self._velocity_pub_dict_ = OrderedDict()
     self._steering_pub_dict_ = OrderedDict()
     for topic in config_dict[const.ConfigParams.VELOCITY_LIST.value]:
         self._velocity_pub_dict_[topic] = rospy.Publisher(topic,
                                                           Float64,
                                                           queue_size=1)
     for topic in config_dict[const.ConfigParams.STEERING_LIST.value]:
         self._steering_pub_dict_[topic] = rospy.Publisher(topic,
                                                           Float64,
                                                           queue_size=1)
     #Create default reward parameters
     self._reward_params_ = const.RewardParam.make_default_param()
     #Creat the default metrics dictionary
     self._step_metrics_ = StepMetrics.make_default_metric()
     # State variable to track if the car direction has been reversed
     self._reverse_dir_ = False
     # Dictionary of bools indicating starting position behavior
     self._start_pos_behavior_ = \
         {'change_start' : config_dict[const.ConfigParams.CHANGE_START.value],
          'alternate_dir' : config_dict[const.ConfigParams.ALT_DIR.value]}
     # Dictionary to track the previous way points
     self._prev_waypoints_ = {
         'prev_point': Point(0, 0),
         'prev_point_2': Point(0, 0)
     }
     # Dictionary containing some of the data for the agent
     self._data_dict_ = {
         'prev_progress': 0.0,
         'steps': 0.0,
         'start_ndist': 0.0
     }
     #Load the action space
     self._action_space_, self._json_actions_ = \
         load_action_space(config_dict[const.ConfigParams.ACTION_SPACE_PATH.value])
     #! TODO evaluate if this is the best way to reset the car
     rospy.wait_for_service(SET_MODEL_STATE)
     rospy.wait_for_service(GET_MODEL_STATE)
     self.set_model_state = ServiceProxyWrapper(SET_MODEL_STATE,
                                                SetModelState)
     self.get_model_client = ServiceProxyWrapper(GET_MODEL_STATE,
                                                 GetModelState)
     # Adding the reward data publisher
     self.reward_data_pub = RewardDataPublisher(self._agent_name_,
                                                self._json_actions_)
     # init time
     self.last_time = 0.0
     self.curr_time = 0.0
     # subscriber to time to update camera position
     camera_types = [camera for camera in CameraType]
     self.camera_manager = CameraManager(camera_types=camera_types)
     rospy.Subscriber('/clock', Clock, self.update_camera)
     # Make sure velicty and angle are set to 0
     send_action(self._velocity_pub_dict_, self._steering_pub_dict_, 0.0,
                 0.0)