Go to the documentation of this file.00001
00002 import pfilter as pf
00003 import robot_motion as rm
00004 import object_motion as om
00005 import detection_appearance as da
00006
00007
00008 import nodes as nd
00009 import transforms2d as t2d
00010 import numpy as np
00011 import math as mt
00012 import opencv.cv as cv
00013 import types
00014 import functools as ft
00015
00016 velocity = np.matrix([1.0, 0.0]).T
00017 pose = t2d.Pose2D(2.0, 0.0, 0.0)
00018
00019
00020 mvar = rm.motion_var()
00021 def to_pos(p):
00022 return p.pos
00023 particles = map(to_pos, rm.make_set(mvar, pose, 100))
00024
00025
00026 robot_motion = rm.RobotMotion(mvar)
00027 motion_model = om.ObjectMotion(robot_motion)
00028 app_model = da.DetectionAppearance(cov=np.matrix([[(.03*.03), 0], [0, (.03*.03)]]))
00029
00030 filter = pf.PFilter(motion_model, app_model)
00031 display = nd.RobotDisp("particle filter", size = 2, draw_center=True, meters_radius=10)
00032
00033 max_weight = app_model.weight(np.matrix([1.0, 0.0]).T, np.matrix([1.0, 0.0]).T)
00034 draw_func = ft.partial(da.draw_weighted_2D, display, max_weight)
00035 cur_pos = pose.pos.copy()
00036 cur_set = particles
00037
00038 while True:
00039 display.clear()
00040 filter.step(t2d.Pose2D(velocity[0,0], velocity[1,0], 0),
00041 np.matrix([1.0, 0.0]).T, cur_set, draw_func)
00042 display.draw(wait=10)
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
pfilter
Author(s): Travis Deyle, Hai Nguyen, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:42:09