Filter löschen
Filter löschen

Simulation of continuum robot in 2D

15 Ansichten (letzte 30 Tage)
Yen Tien Yap
Yen Tien Yap am 16 Jul. 2022
Beantwortet: Ninad am 14 Sep. 2023
% actuator space
delta_l_2 = 1; % change in length of tendon 1 and tendon 2 (assume to be the same)
length_1_range = 10:-delta_l_2:5;
length_2_range = 20:delta_l_2:25;
[~,n] = size(length_1_range);
length_1 = zeros(n,100)';
length_2 = zeros(n,100)';
for i = 1:n
length_1(:,i) = linspace(0,length_1_range(i),100); % length of tendon 1
for j = 1:n
length_2(:,j) = linspace(0,length_2_range(j),100); % length of tendon 2
end
end
% Configuration space
d=2; % radius of the continuum robot
length = (length_2 + length_1)/2;
theta = (length_2 - length_1)./(2*d); % rad
r = (2.*length_1.*d)./(length_2-length_1);
% Task space
o1_x = r-r.*cos(theta);
o1_y = r.*sin(theta);
% o1 = [o1_x,o1_y];
figure(1)
plot(o1_x(2:100,:),o1_y(2:100,:),LineWidth=4,LineStyle="-")
legend('length 1 = 10, length 2 = 20','length 1 = 9, length 2 = 21',...
'length 1 = 8, length 2 = 22','length 1 = 7, length 2 = 23',...
'length 1 = 6, length 2 = 24','length 1 = 5, length 2 = 25')
Hi there, I have coded up for the trajectory of the continuum robot when lengths of the tendon change. However, I wanted to change this code into a live simulation but I don't know how to do it. Can anyone help me with that? THANK YOU!!

Antworten (1)

Ninad
Ninad am 14 Sep. 2023
Hi Yen,
As per my understanding, you wish to visualize the plot that you have created above.
You may plot the graph inside a `for` loop, one value at a time. `pause` function can be used to delay the frames, so the visualization looks like an animation. `cla` command can also be used inside the loop to clear the current axes.
I have made some modifications to your code, to serve your purpose and saved it in a file named `continuumRobotSimulation.m` and attached it with this post.
Please review the code and see if it solves your problem.
References:

Kategorien

Mehr zu Robotics finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by