function [sensor_output, meta] = create_sim(pads, ctr_x, ctr_y, res, radius, sensor_radius, showpads)
% one unit in x is the width of a bit
theta = linspace(0,2*pi, res+1)';
theta = theta(1:end-1);
sensor_odo = theta;
sensor_pos = [ctr_x+radius*cos(theta), ctr_y+radius*sin(theta)];

% make the convolve function
convolve_size = 13;
%sensor_radius = 0.25;
[x,y] = meshgrid(linspace(-1,1,convolve_size), ...
				 linspace(-1,1,convolve_size));
convolve = exp(-(x.^2 + y.^2)*4);
convolve_weight = sum(sum(convolve));

meta = [sensor_odo, sensor_pos];

imshift = (sensor_radius*2)/convolve_size/2;

if (showpads),
	figure(1);
	clf;
	image([1.5,size(pads,1)+0.5],[1.5,size(pads,2)+0.5],pads*24);
	axis xy;
end

sensor_output = [];
for sample=1:res,
	% if the center of the convolve matrix were over sensor_pos(sample,:),
	% where would each of its pixels be?
	x = sensor_pos(sample,1);
	y = sensor_pos(sample,2);
	xaddr = floor(linspace(x-sensor_radius,x+sensor_radius,convolve_size));
	yaddr = floor(linspace(y-sensor_radius,y+sensor_radius,convolve_size));
	padval = pads(yaddr,xaddr);
	output = (padval.*convolve);
	value = sum(sum(output))/convolve_weight;
	sensor_output = [sensor_output; value];

	if (showpads),
		% draw the images so that they're blacked out where pads = 0, and
		% start at 24 (pads =1) where pads=1.
		plottable_output = output*40+24;
		foo = pads(yaddr,xaddr);
		fooi = find(~foo);
		plottable_output(fooi) = 0;
		hold on;
		image([x-sensor_radius,x+sensor_radius], ...
				[y-sensor_radius,y+sensor_radius], plottable_output);
	end
end
