-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathfast_slam2.py
More file actions
26 lines (24 loc) · 950 Bytes
/
Copy pathfast_slam2.py
File metadata and controls
26 lines (24 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
This is the main file that starts the simulation.
It contains a "World" object specifying the world settings, and a set of particles.
Every time the robot moves, it generates random observations usded to update the particle sets
to estimate the robot path as well as the landmarks locations.
"""
import sys
import random
import math
from copy import deepcopy
from world import World
from particle2 import Particle2
from fast_slam import FastSlam
class FastSlam2(FastSlam):
"""Inherit from FastSlam"""
def __init__(self, x, y, orien, particle_size = 50):
self.world = World()
self.particles = [Particle2(x, y, random.random()* 2.*math.pi) for i in xrange(particle_size)]
self.robot = Particle2(x, y, orien, is_robot=True)
self.particle_size = particle_size
if __name__=="__main__":
random.seed(5)
simulator = FastSlam2(80, 140, 0, particle_size=200)
simulator.run_simulation()