Question: Write a matlab program as per the following format, that accepts a time history of wheel encoder values for the two rear wheels of a

Write a matlab program as per the following format, that accepts a time history of wheel encoder values for the two rear wheels of a car and estimates the chassis configuration as a function of time using odometry. Prove that it yields correct results for a chassis motion that involves rotations and translations.

Here q = (phi; x; y; theta), where (x; y) is the contact point, phi is the heading direction,and theta is the rolling angle of the wheel. Similarly qdot =(phi/delta t; x/delta t; y/delta t; theta/delta t)

Write the code stricty using the following format: % Generate a q and qdot system tspan = 0:pi/1000:4*pi; numq = length(tspan); qdot = zeros(1,3); model = differentialDriveKinematics("VehicleInputs","VehicleSpeedHeadingRate"); inputs = @(t)[2 + randi(2) pi/3*((t>pi/4)-(t>7*pi/4)-(t>9*pi/4)+(t>15*pi/4))]; [t,q] = ode45(@(t,q)derivative(model,q,inputs(t)),tspan,q0); q = [q(:,3) q(:,1) q(:,2)]; qdot = [gradient(q(:,1),t) gradient(q(:,2),t) gradient(q(:,3),t)]; figure(); plot(q(:,2),q(:,3)); title("Vehicle Path"); axis equal;

% Wheel encoder values for car-like robot d = rand() + 1; r = rand() + .5; ucar = zeros(numq, 2); for i = 1:numq phi = q(i,1); ucar(i,:) = pinv([[-1 1]/d; [1 1]*cos(phi); [1 1]*sin(phi)]*r/2)*qdot(i,:)'; end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!