Revision 1709
fixed typos with matlab code
branches/16299_s10/matlab/motionModel.m | ||
---|---|---|
1 |
function [x', y', theta', phi'] = motionModel(motorL, motorR,x,y,theta,phi,dt)
|
|
1 |
function [x, y, theta, phi, state] = motionModel(motorL, motorR,xold,yold,thetaold,phiold,dt, state)
|
|
2 | 2 |
|
3 | 3 |
disp "Function Unimplemented!" |
4 | 4 |
|
branches/16299_s10/matlab/evolveRobots.m | ||
---|---|---|
15 | 15 |
Thetas = zeros(n,1); |
16 | 16 |
Phis = zeros(n,1); |
17 | 17 |
|
18 |
% These state variables allow the models to maintain some state across calls |
|
19 |
motorState = []; |
|
20 |
sensorState = []; |
|
21 |
|
|
18 | 22 |
% Run through each timestep |
19 | 23 |
for t = 0:dt:tf |
20 | 24 |
% update the true positions using the motor model |
21 |
[X, Y, Theta, Phi] = motionModel(MotorL, MotorR, X, Y, Theta, Phi, dt);
|
|
25 |
[X, Y, Theta, Phi, motorState] = motionModel(MotorL, MotorR, X, Y, Theta, Phi, dt, motorState);
|
|
22 | 26 |
|
23 | 27 |
% Update the sensor values using the sensor model |
24 |
[Xs, Ys, Thetas, Phis] = sensorModel(X, Y, Theta, Phi);
|
|
28 |
[Xs, Ys, Thetas, Phis, sensorState] = sensorModel(X, Y, Theta, Phi, sensorState);
|
|
25 | 29 |
|
26 | 30 |
%TODO: at some point, out controller will go here |
27 | 31 |
end |
branches/16299_s10/matlab/sensorModel.m | ||
---|---|---|
1 |
function [x', y', theta', phi'] = sensorModel(x,y,theta,phi)
|
|
1 |
function [x, y, theta, phi, state] = sensorModel(xold,yold,thetaold,phiold,state)
|
|
2 | 2 |
|
3 | 3 |
disp "Function Unimplemented!" |
4 | 4 |
|
Also available in: Unified diff