16 lines
401 B
Matlab

function [x_new, y_new, theta_new] = moveCar(x, y, theta, dtheta)
%MOVECAR updates car's position based on previous state
% Detailed explanation goes here
global Speed_mag;
global Ts;
% Stear and then calculate the new position
theta_new = theta + dtheta;
x_new = x + Speed_mag * Ts * cos(toRadians("degrees", theta_new));
y_new = y + Speed_mag * Ts * sin(toRadians("degrees", theta_new));
end