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([0.01, 0.0]).T
00017 pose = t2d.Pose2D(0.0, 0.0, 0.0)
00018
00019
00020 mvar = rm.motion_var()
00021 particles = rm.make_set(mvar, pose, 100)
00022
00023
00024 motion_model = rm.RobotMotion(mvar)
00025 app_model = da.DetectionAppearance(cov=np.matrix([[(.03*.03), 0], [0, (.03*.03)]]))
00026 filter = pf.PFilter(motion_model, app_model)
00027 display = nd.RobotDisp("particle filter", size = 2, draw_center=True, meters_radius=10)
00028
00029 max_weight = app_model.weight(np.matrix([1.0, 0.0]).T, t2d.Pose2D(1.0, 0.0, 0.0))
00030 draw_func = ft.partial(rm.draw_weighted_Pose2D, display, max_weight)
00031 cur_pos = pose.pos.copy()
00032 cur_set = particles
00033
00034 for i in xrange(100):
00035 display.clear()
00036 cur_set = filter.step(t2d.Pose2D(velocity[0,0], velocity[1,0], 0),
00037 cur_pos, cur_set, draw_func)
00038 scur_pos = display.to_screen(cur_pos)
00039 display.draw(wait=10)
00040
00041 cur_pos = cur_pos + velocity
00042
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
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
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