def _configure(self, client_id, remotes):
     address = '127.0.0.1'
     port = 9900 + client_id
     engine = UnrealCVWrapper(
         address=address,
         port=port,
         max_depth_viewing_angle=math_utils.degrees_to_radians(70.))
     self._environment._engine = engine
Example #2
0
    def __init__(self,
                 world_bounding_box,
                 random_reset=True,
                 radius=7.0,
                 height=3.0,
                 yaw_amount=math_utils.degrees_to_radians(180. / 6.),
                 **kwargs):
        """Initialize environment.

        Args:
            world_bounding_box (BoundingBox): Overall bounding box of the world to restrict motion.
            engine (BaseEngine): Simulation engine (i.e. Unreal Engine wrapper).
            mapper: Occupancy mapper (i.e. OctomapExt interface).
            clear_size (float): Size of bounding box to clear in the occupancy map on reset.
            random_reset (bool): Use random pose when resetting.
            radius (float): Radius of orbit.
            height (float): Height of orbit.
            yaw_amount (float): Scale of yaw rotations.
            use_ros (bool): Whether to use ROS and publish on some topics.
            ros_pose_topic (str): If ROS is used publish agent poses on this topic.
            ros_world_frame (str): If ROS is used this is the id of the world frame.
        """

        self._random_reset = random_reset
        self._radius = radius
        self._height = height
        self._yaw_amount = yaw_amount
        action_list = [
            self.yaw_clockwise,
            self.yaw_counter_clockwise,
        ]
        update_map_flags = [
            True,
            True
        ]
        action_rewards = [
            -50.,
            -50.,
        ]
        self._obs_level = 3
        self._obs_size_x = 8
        self._obs_size_y = self._obs_size_x
        self._obs_size_z = self._obs_size_x
        super(YawOnlyEnvironmentV1, self).__init__(
            world_bounding_box,
            action_list,
            update_map_flags=update_map_flags,
            action_rewards=action_rewards,
            terminal_score_threshold=0.6,
            **kwargs)
Example #3
0
    def __init__(self,
                 world_bounding_box,
                 random_reset=True,
                 radius=7.0,
                 height=3.0,
                 angle_amount=math_utils.degrees_to_radians(180. / 8.),
                 yaw_amount=math_utils.degrees_to_radians(180. / 8.),
                 **kwargs):
        """Initialize environment.

        Args:
            world_bounding_box (BoundingBox): Overall bounding box of the world to restrict motion.
            engine (BaseEngine): Simulation engine (i.e. Unreal Engine wrapper).
            mapper: Occupancy mapper (i.e. OctomapExt interface).
            clear_size (float): Size of bounding box to clear in the occupancy map on reset.
            random_reset (bool): Use random pose when resetting.
            radius (float): Radius of orbit.
            height (float): Height of orbit.
            yaw_amount (float): Scale of yaw rotations.
            angle_amount (float): Scale of orbital motion.
            use_ros (bool): Whether to use ROS and publish on some topics.
            ros_pose_topic (str): If ROS is used publish agent poses on this topic.
            ros_world_frame (str): If ROS is used this is the id of the world frame.
        """

        self._random_reset = random_reset
        self._radius = radius
        self._height = height
        self._angle_amount = angle_amount
        self._yaw_amount = yaw_amount
        index1_range = 6
        index2_range = 1
        def _action_function(index1, index2, pose):
            new_theta = 2 * np.pi * index1 / float(index1_range)
            new_location = self._get_orbit_location(new_theta)
            new_yaw = new_theta + np.pi
            new_yaw += (index2 - index2_range / 2) * np.pi / 2.
            new_orientation_rpy = np.array([0, 0, new_yaw])
            # print("new_theta:", new_theta)
            # print("new_yaw:", new_yaw)
            new_pose = self.Pose(new_location, new_orientation_rpy)
            valid = True
            return valid, new_pose
        action_list = []
        update_map_flags = []
        action_rewards = []
        for index1 in xrange(index1_range):
            for index2 in xrange(index2_range):
                # Need to create a new scope here to capture index1, index2 by value
                def create_lambda(idx1, idx2):
                    def lambda_fn(pose):
                        return _action_function(idx1, idx2, pose)
                    return lambda_fn
                action_list.append(create_lambda(index1, index2))
                update_map_flags.append(True)
                action_rewards.append(-100.0)
        self._obs_level = 2
        self._obs_size_x = 8
        self._obs_size_y = self._obs_size_x
        self._obs_size_z = self._obs_size_x
        super(FixedEnvironmentV0, self).__init__(
            world_bounding_box,
            action_list,
            update_map_flags=update_map_flags,
            action_rewards=action_rewards,
            terminal_score_threshold=0.6,
            **kwargs)