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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started