Answer To: 1. Given a 6-DOF robot, one of the joint is commanded to move from an initial angle of25oto an...
Kshitij answered on Nov 21 2021
Urgent2robotic/Code_1.m
%% Problem no 1
clc
clear all
% blend time tb
tb=linspace(0,5,50);
% angular position
theta = linspace(25,115,50);
x= cosd(theta);y= sind(theta);
% velocity component
vx = gradient(x)./gradient(tb);
vy = gradient(y)./gradient(tb);
% acceleration component
ax = gradient(vx)./gradient(tb);
ay = gradient(vy)./gradient(tb);
% plot the position, velocity and acceleration
figure;
% position
subplot(3,1,1)
plot(tb,x,'-b',tb,y,'-r')
xlabel('t')
ylabel('Position')
legend('X','Y')
grid on
% velocity
subplot(3,1,2)
plot(tb,vx,'-b',tb,vy,'-r')
xlabel('t')
ylabel('Velocity')
legend('X','Y')
grid on
% acceleration
subplot(3,1,3)
plot(tb,ax,'-b',tb,ay,'-r')
xlabel('t')
ylabel('Acceleration')
legend('X','Y')
grid on
% plot trajectory
figure;
plot(x,y,'-r')
xlabel('X')
ylabel('Y')
title('Trajectory')
grid on
Urgent2robotic/Code_2.m
%% problem No. 2
% clear all
clc
clear all
% blend time tb
tb=linspace(0,1,50);
% angular position
theta = linspace(-10,20,50);
% position of the robotic arm
x= cosd(theta);
y= sind(theta);
% Compute the cubic trajectory space trajectory planning
% way points
wpts = [x;y];
% time points
tpts = linspace(0,1,50);
% time vector sampling
tvec = linspace(0,1,50);
% Compute the cubic trajectory
[q, qd, qdd, pp] = cubicpolytraj(wpts, tpts, tvec);
% plot data
figure;
% plot position
subplot(3,1,1)
plot(tvec, q)
xlabel('t')
ylabel('Position')
legend('X','Y')
grid on
% plot velocity
subplot(3,1,2)
plot(tvec, qd)
xlabel('t')
ylabel('Velocity')
legend('X','Y')
grid on
% plot acceleration
subplot(3,1,3)
plot(tvec, qdd)
xlabel('t')
ylabel('Acceleration')
legend('X','Y')
grid on
% plot trajectory
figure;
plot(x,y,'-r')
xlabel('X')
ylabel('Y')
title('Trajectory')
grid on
Urgent2robotic/Report (AutoRecovered).docx
Q1
Problem no 1
clc
clear all
% blend time tb
tb=linspace(0,5,50);
% angular position
theta = linspace(25,115,50);
x= cosd(theta);y= sind(theta);
% velocity component
vx = gradient(x)./gradient(tb);
vy = gradient(y)./gradient(tb);
% acceleration component
ax = gradient(vx)./gradient(tb);
ay = gradient(vy)./gradient(tb);
% plot the position, velocity and acceleration
figure;
% position
subplot(3,1,1)
plot(tb,x,'-b',tb,y,'-r')
xlabel('t')
ylabel('Position')
legend('X','Y')
grid on
% velocity
subplot(3,1,2)
plot(tb,vx,'-b',tb,vy,'-r')
xlabel('t')
ylabel('Velocity')
legend('X','Y')
grid on
% acceleration
subplot(3,1,3)
plot(tb,ax,'-b',tb,ay,'-r')
xlabel('t')
ylabel('Acceleration')
legend('X','Y')
grid on
% plot trajectory
figure;
plot(x,y,'-r')
xlabel('X')
ylabel('Y')
title('Trajectory')
grid on
Q2.
Problem No. 2
% clear all
clc
clear all
% blend time tb
tb=linspace(0,1,50);
% angular position
theta = linspace(-10,20,50);
% position of the robotic arm
x= cosd(theta);
y= sind(theta);
% Compute the cubic trajectory space trajectory planning
% way points
wpts = [x;y];
% time points
tpts = linspace(0,1,50);
% time vector sampling
tvec = linspace(0,1,50);
% Compute the cubic trajectory
[q, qd, qdd, pp] = cubicpolytraj(wpts, tpts, tvec);
% plot data
figure;
% plot position
subplot(3,1,1)
plot(tvec, q)
xlabel('t')
ylabel('Position')
legend('X','Y')
grid on
% plot velocity
subplot(3,1,2)
plot(tvec, qd)
xlabel('t')
ylabel('Velocity')
legend('X','Y')
grid on
% plot acceleration
subplot(3,1,3)
plot(tvec, qdd)
xlabel('t')
ylabel('Acceleration')
legend('X','Y')
grid...