Пример #1
0
# --- Set frame
world.frame = np.array(
    [[-pi, -pi],
     [-pi, pi],
     [pi, pi],
     [pi, -pi],
     [-pi, -pi]])

# --- Set start/goal point
world.start = np.array([-pi / 2, -pi / 2]) * 1.9
world.goal = np.array([pi / 2, pi / 2]) * 1.9

# --- Generate objects
og = ObjectGenerator(world)
world.objects = og.example()
# og.generate(10, 5)
# og.locate([2.0, 3.0])
# world.objects = og.world.objects

# --- Generte Collision Checker
cc = CollisionChecker(world, 0.1)

'''
Functions
'''


class Individual(np.ndarray):
    """Container of a individual."""
    fitness = None
Пример #2
0
NGEN = 100  # The number of generation loop.
fitness_thresh = 0.1
verbose = True
# random.seed(64)
'''
World setting
'''

# --- world class
world = World()
world.generate_frame([-pi, pi], [-pi, pi])
world.type = 'cartesian'

# Objects in the cartesian space
og = ObjectGenerator(world)
world.objects = og.generate_object_sample1()

# --- Set start/goal point
world.start = np.array([-pi / 2, -pi / 2]) * 1.9
world.goal = np.array([pi / 2, pi / 2]) * 1.9

# --- Generte Collision Checker
cc = CollisionChecker(world)
'''
Functions
'''


class Individual(np.ndarray):
    """Container of a individual."""
    fitness = None