%% Plot Path of Unicycle Kinematic Robot
%
%% Create a Robot
% Define a robot and set the initial starting position and orientation.

kinematicModel = unicycleKinematics;
initialState = [0 0 0];

%
%% Simulate Robot Motion
% Set the timespan of the simulation to 1 s with 0.05 s timesteps and the input commands to 10 m/s and left turn. Simulate the motion of the robot by using the ode45 solver on the derivative function.

tspan = 0:0.05:1;
inputs = [10 1]; %Constant speed and turning left
[t,y] = ode45(@(t,y)derivative(kinematicModel,y,inputs),tspan,initialState);

%
%% Plot path

figure
plot(y(:,1),y(:,2))

% Copyright 2019 The MathWorks, Inc.