Пример #1
0
    def __init__(self, path_to_world, test_num):
        """
        Constructor to initialize the environment.
        :param path_to_world: The path to the world which should be selected.
        """
        self._env = pysim2d.pysim2d()
        self._fitness_data = FitnessData()
        self._cluster_size = 1
        self._observation_rotation_size = 64
        self._observation_rotation_use = False
        self._test_num = test_num

        self._laser_min_distance = 1
        self._laser_min_distance_angle = 0

        self._laser_max_distance = 0
        self._laser_max_distance_angle = 0

        self._n_step = 0
        self._n_episode = 0

        if not self._fitness_data.init(path_to_world + ".node"):
            print("Error: Load node file! -> " + path_to_world + ".node")
            exit(1)
        if not self._env.init(path_to_world + ".world"):
            print("Error: Load world file -> " + path_to_world + ".world")
            exit(1)
Пример #2
0
    def __init__(self, map_name):
        print("GoSharedStatus------------------------->")

        self.name = None
        self.allow_area_gunplot_cfg_url = None
        self.roads_gunplot_cfg_url = None
        self.staic_map_array = None
        self.agents_dynamic_status = dict(
        )  # 多线程共享字典,保存agent状态,键为id,值为什么??state
        self.agents_con = Condition()
        self.share_to_main = None

        self.actions = GoAgentAction()

        self.env = GoEnvironment(0, self, self.actions, False)

        self.map_pic_str = None

        self.map_width = 910 * 0.05

        self.map_height = 910 * 0.05

        self.map_name = map_name[0:-4]
        self.one_channel_map_pic_str = "custom_map/final3/new_map.png"
        self.allow_area_url = self.map_name + "_tongxing_grid" + ".txt"
        self.road_url = self.map_name + "_road_grid" + ".txt"

        self.emulator = pysim2d.pysim2d()
        #self.emulator.init(self.one_channel_map_pic_str, self.allow_area_url, self.road_url, True, True, False)

        self.emulator.set_parameter(0.2, 0.25, 1.0, 0.2, 0.5, 5, 10)
        self.emulator.set_title(0, 1)
Пример #3
0
    def __init__(self, path_to_world):
        """
        Constructor to initialize the environment.
        :param path_to_world: The path to the world which should be selected.
        """
        self._env = pysim2d.pysim2d()
        self._fitness_data = FitnessData()
        self._cluster_size = 1
        self._observation_rotation_size = 64
        self._observation_rotation_use = False

        if not self._fitness_data.init(path_to_world + ".node"):
            print("Error: Load node file! -> " + path_to_world + ".node")
            exit(1)
        if not self._env.init(path_to_world + ".world"):
            print("Error: Load world file -> " + path_to_world + ".world")
            exit(1)
Пример #4
0
import sys
sys.path.append('../')
from navi.Create_virtual_radar import Virtual_radar
from pysim2d import pysim2d

allow_area_url = "/home/brook/NaviPlanningEmulatorGrid/test/custom_map/11_13/tongxing_grid.txt"

emulator = Virtual_radar()

emulator.init_data(allow_area_url)  # 读取通行域的信息

#print(len(emulator.get_lidar(35,35)))
#print(emulator.get_lidar(105*0.05, 35*0.05))

self_emulator = pysim2d.pysim2d()

self_map_url = "/home/brook/NaviPlanningEmulatorGrid/test/custom_map/11_13/init_gnuplot_map.png"
self_one_channel_map_pic_str = "/home/brook/NaviPlanningEmulatorGrid/test/custom_map/11_13/init_gnuplot_map.png"
self_road_url = "/home/brook/NaviPlanningEmulatorGrid/test/custom_map/11_13/road_grid.txt"
self_allow_area_url = "/home/brook/NaviPlanningEmulatorGrid/test/custom_map/11_13/tongxing_grid.txt"

self_emulator.init(self_one_channel_map_pic_str, self_allow_area_url,
                   self_road_url, False, False, False)
self_emulator.set_parameter(0.5, 0.5, 0.1, 0.5, 1, 20)  # 12/0.05 = 240

self_emulator.set_title(0, 0)
#print(len(self_emulator.get_lidar(35, 35)))
print(self_emulator.get_lidar(105 * 0.05, 35 * 0.05))