Example #1
0
    def plan_act(self, obs):
        nn_obs = self.transform_obs(obs)
        nn_action = self.agent.act(nn_obs)
        steering_angle = self.max_steer * nn_action[0]

        speed = calculate_speed(steering_angle)
        action = np.array([steering_angle, speed])

        return action
Example #2
0
    def plan_act(self, obs):
        scan = obs[7:-1]
        ranges = np.array(scan, dtype=np.float)

        steering_angle = self.process_lidar(ranges)
        steering_angle = steering_angle * np.pi / 180

        # speed = 4
        speed = calculate_speed(steering_angle)

        action = np.array([steering_angle, speed])

        return action
Example #3
0
    def plan_act(self, obs):
        nn_obs = self.transform_obs(obs)
        self.add_memory_entry(obs, nn_obs)

        nn_action = self.agent.act(nn_obs)

        self.state = obs
        self.nn_state = nn_obs
        self.nn_action = nn_action

        steering_angle = self.max_steer * nn_action[0]
        speed = calculate_speed(steering_angle)
        self.action = np.array([steering_angle, speed])

        return self.action
Example #4
0
    def act_pp(self, obs):
        pose_th = obs[2]
        pos = np.array(obs[0:2], dtype=np.float)

        lookahead_point = self._get_current_waypoint(pos)

        self.aim_pts.append(lookahead_point[0:2])

        if lookahead_point is None:
            return [0, 4.0]

        speed, steering_angle = pure_pursuit_utils.get_actuation(
            pose_th, lookahead_point, pos, self.lookahead, self.wheelbase)

        speed = calculate_speed(steering_angle)

        return [steering_angle, speed]
    def plan_act(self, obs):
        pp_action = super().act_pp(obs)
        nn_obs = self.transform_obs(obs, pp_action)
        self.add_memory_entry(obs, nn_obs)

        self.state = obs
        nn_action = self.agent.act(nn_obs)
        self.nn_act = nn_action

        # critic_val = self.agent.get_critic_value(nn_obs, nn_action)
        # self.history.add_step(pp_action[0], nn_action[0]*self.max_steer, critic_val)
        self.nn_state = nn_obs

        steering_angle = self.modify_references(self.nn_act, pp_action[0])
        # speed = 4
        speed = calculate_speed(steering_angle)
        self.action = np.array([steering_angle, speed])

        return self.action
    def plan_act(self, obs):
        pp_action = super().act_pp(obs)
        nn_obs = self.transform_obs(obs, pp_action)

        nn_action = self.agent.act(nn_obs, noise=0)
        # nn_action = [0]
        self.nn_act = nn_action

        critic_val = self.agent.get_critic_value(nn_obs, nn_action)
        self.history.add_step(pp_action[0], nn_action[0]*self.max_steer, critic_val)

        steering_angle = self.modify_references(self.nn_act, pp_action[0])
        # speed = 4
        speed = calculate_speed(steering_angle)
        action = np.array([steering_angle, speed])

        # pp = pp_action[0]/self.max_steer
        # self.vis.add_step(nn_obs[4:], pp, nn_action)

        return action