function trace = WP_sim(T_r,Sigma,T_c,del_t,max_t)
%

clear WP_bot
clear WP_plan_find_floor

[world,dimens] = WP_init_world;
T_actual = T_r;
t = 0;
step = 1;
trace(step).T_actual = T_actual;
action = [0,0,0];
while t<max_t
    t = t + del_t;
    step = step + 1;
    if action(1)==1
        [rgbd,rgb_im,map] = WP_rgbd(T_r,T_c,world);
    else
        rgbd = [];
        map = [];
        rgb_im = [];
    end
    percept.rgbd = rgbd;
    percept.rgb_im = rgb_im;
    percept.map = map;
    action = WP_bot(percept);
    if WP_beliefs(1,7,'info',0)==1
        t = max_t + 1;
    end
    if action(2)~=0|action(3)~=0
        T_actual = WP_move(T_actual,action(2:3),del_t);
        T_actual(1,4) = T_actual(1,4) + sqrt(Sigma(1,1))*randn;
        T_actual(2,4) = T_actual(2,4) + sqrt(Sigma(2,2))*randn;
        T_actual = WP_enforce_dimens(T_actual,dimens);
        theta = atan2(T_actual(2,1),T_actual(1,1));
        theta = theta + sqrt(Sigma(3,3))*randn;
        T_actual(1:3,1:3) = ...
            [cos(theta),-sin(theta),0;sin(theta),cos(theta),0; 0 0 1];
    end
    trace(step).T_actual = T_actual;
end

