Skip to content
This repository has been archived by the owner on Jan 10, 2018. It is now read-only.

Commit

Permalink
more photos
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Hampl committed Nov 25, 2010
1 parent aa77d2b commit c065019
Show file tree
Hide file tree
Showing 19 changed files with 126 additions and 22 deletions.
Binary file added images/experiments/PID/p=0.4i=0.1d=0.25/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=0.4i=0.1d=0.25/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=0.4i=0.1d=0.25/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=1i=0.01d=0.25/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=1i=0.01d=0.25/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=1i=0.01d=0.25/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=1i=0d=0/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=1i=0d=0/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=1i=0d=0/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=2i-0.03d=1.6/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=2i-0.03d=1.6/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/PID/p=2i-0.03d=1.6/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/experiments/untitled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 15 additions & 16 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,32 @@
while scanline(I2, freespace, 10)
freespace = freespace + dir;
end
%freespace = freespace - dir;
drivebot(1);
freespace = freespace + dir*robot_size*2;
drivebot(2);
dest = [robot(1), freespace]

figure(2)
[h w] = size(I2);
h/2
target(1)
shift = sign(h/2 - target(1)) * robot_size * 1.5;

% everybody likes pictures, right?
f = figure(2);
imshow(I2)
drawnow
hold on;
plot(dest(2), dest(1), 'ro');
plot(freespace, target(1) + shift, 'ro');
plot(target(2), target(1), 'ro');

drivetopoint


% drive vertical till opening
dest = [target(1) freespace]
plot(dest(2), dest(1), 'ro');
drivetopoint


% ready...set...go!
drivetopoint
dest = [target(1) + shift freespace]
drivetopoint
dest = target'

plot(target(2), target(1), 'ro');

% drive horizontal till close enough to target point

drivetopoint


% we're done.
stopbot;
2 changes: 0 additions & 2 deletions movement/drivebot.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ function drivebot(lspeed, varargin)
%end
lspeed = round(lspeed);
rspeed = round(rspeed);
lspeed
rspeed
send_command(strcat('D,', num2str(lspeed), ',', num2str(rspeed)));
read_command;
pause(pausetime);
Expand Down
7 changes: 4 additions & 3 deletions movement/pid.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ function pid(old, new, destination, dt)

% setup constants based on environment
if strcmp(environment, 'webots')
Kp = 1.0; Ki = 0.05; Kd = 0.1;
%Kp = 1.0; Ki = 0.04; Kd = 0.1;
Kp = 2; Ki = 0.03; Kd = 1.6;
V = 20;
else
%Kp = 1; Ki = 0.01; Kd = 0.25;
Kp = 1; Ki = 0.01; Kd = 0.20;
Kp = 2; Ki = 0.03; Kd = 1.6;
%Kp = 1.6; Ki = 0.01; Kd = 0.25;
V = 2;
end

Expand Down
53 changes: 53 additions & 0 deletions rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
function rc()


global environment;
global previous_error;
global l_integral;
global r_integral;
robot = [0 0];
previous_error = 0;
l_integral = 0;
r_integral = 0;

% Stop the robot if it's running
stopbot;

% Prepare vars depending on environment
if strcmp(environment, 'real world')
[robot_size, transformdims, corners, I0, I2, I3] = realworld();
else
[robot_size, transformdims, corners, I0, I2] = webots();
I3 = [];
end

updaterobot;
% Get the maze to navigate in


old_robot = robot;
old_robot(1) = old_robot(1) - 10;

% find the target point
target = getendpoints(I1);


f = figure(2);
imshow(I2)
drawnow
hold on;
plot(dest(2), dest(1), 'ro');
plot(freespace, target(1) + shift, 'ro');
plot(target(2), target(1), 'ro');

set(f, 'ButtonDownFcn', @click);
function click(varargin)
pt = get(f, 'CurrentPoint');
drivetopoint
stopbot
end




end
53 changes: 53 additions & 0 deletions rc.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
function rc()


global environment;
global previous_error;
global l_integral;
global r_integral;
robot = [0 0];
previous_error = 0;
l_integral = 0;
r_integral = 0;

% Stop the robot if it's running
stopbot;
environment
% Prepare vars depending on environment
if strcmp(environment, 'real world')
[robot_size, transformdims, corners, I0, I2, I3] = realworld();
else
[robot_size, transformdims, corners, I0, I2] = webots();
I3 = [];
end

updaterobot;
% Get the maze to navigate in


old_robot = robot;
old_robot(1) = old_robot(1) - 10;

% find the target point
target = getendpoints(I1);


f = figure(2);
imshow(I2)
drawnow
hold on;
plot(dest(2), dest(1), 'ro');
plot(freespace, target(1) + shift, 'ro');
plot(target(2), target(1), 'ro');

set(f, 'ButtonDownFcn', @click);
function click(varargin)
pt = get(f, 'CurrentPoint')
drivetopoint
stopbot
end




end
2 changes: 1 addition & 1 deletion setups/realworld.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function [robot_size, transformdims, corners, I0, I2, I3] = realworld()

robot_size = 20;
robot_size = 10;
I0 = take_pic();
transformdims = [260, 400];
% use the ptransform transform
Expand Down

0 comments on commit c065019

Please sign in to comment.