Four link, planar robot arm using meshgrid/ndgrid in matlab
4 次查看(过去 30 天)
显示 更早的评论
Hello Community,
I am new in this forum, so i hope i didn't make a mess of my first question.
I want to plot the reachable area of a planar, four link mechanism. It is exactly like the linkage in the following link, only with four links instead of only two.
In that case the code is set with meshgrid and the plotted solution in the picture (red dots for the reachable area) in the link is a elegant and quick solution. As i searched the community i found another matlab function ndgrid for multidimensional tasks. Calculating my ndgrid i got a solution with four dimensional matrices as expected. How can I plot this in an x-y-plot? The examples in the community are only two link planar systems most times.
I know usually there should be only one question for every topic, but i have a few general questions for you.
I am working on a project at my university at robotics. I wanted to write a little program in Matlab but i am somehow stuck with that task. It is really a lot of stuff to consider at the beginning.
Since I want to add some additional functions in my prorgram, i. e. force calculations or optimization of some kind...
Would you recommend to use the multibody or robotics system tool boxes to avoid too much coding? I have programed a few things in matlab already, but I am not a very experienced coder.
Is it easy to send variables/code between matlab and simulink/simscape?
Help is much appreciated.
Thank you,
Best regards,
Jan
0 个评论
采纳的回答
Wooshik Kim
2018-7-5
编辑:Wooshik Kim
2018-7-5
aren't you able to do the same thing with meshgrid and plot?
I believe plot function takes each of the values of X and Y and combines them together to draw a 2D plot. So it doesn't matter if the grid is four dimension, as long as the two match.
theta1 = 0:0.1:pi/2; % all possible theta1 values
theta2 = 0:0.1:pi; % all possible theta2 values
theta3 = 0:0.1:pi; % all possible theta3 values
theta4 = 0:0.1:pi; % all possible theta4 values
% generate a grid of theta1 and theta2,3,4 values
[THETA1,THETA2,THETA3,THETA4] = meshgrid(theta1,theta2,theta3,theta4);
X = fcn(THETA1,THETA2,THETA3,THETA4); % compute x coordinates
Y = fcn2(THETA1,THETA2,THETA3,THETA4); % compute y coordinates
plot(X(:),Y(:),'r.');
Simulink has pretty good tools regarding robot simulation. Take a look at Simscape Multibody, contact modelling, and so on...
Here are some places you can start learning from
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simscape Multibody 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!