Dissecting someone elses Matlab code

5 次查看(过去 30 天)
Aaron
Aaron 2012-5-12
Recently I've tried to dissect this code http://benjamin-goldberg.com/Robot_Arm_Inverse_Kinematics.m
But to no avail, however, I will tell you what I know and what I want to know:
a. This code attempts to have the end of the 'arm' reach (0,0) b. The angles between each link is limited, hence why when Theta# is changed, it will sometimes not reach (0,0) (I think?) c. Arm lengths are changed in lines 11 and 13, Axis located at 42 d. He's working in radians e. Lines 14 - 16 allows the free motion of the links of the arms
That's pretty much all I know so far, things I would like to know are:
Pretty much what is happening in that For-Loop.
These are some things I want to do to the code after I've understood it:
Change the angle limitations
Lose the arm trail (But display the 'hand' trail)
Put this in a GUI so that it will follow my mouse constantly until I click it. It'll be impossible for it to reach some places (it'll only reach a distance of 3 units from the centre, hence a circle), so instead, it'll keep following it the best it can whilst fully intact.
All help very much appreciated, thanks!

回答(1 个)

per isakson
per isakson 2012-5-13
Are you posing this question to experts of robot arm kinematics? Do you have a problem using the tools of Matlab?
Did you ask Goldberg? He writes: "If you have any questions, please don’t hesitate to email me at ***."
Edit [13 May 2012, 11:32 BST - OK] Erased email.
--- Continue ---
There are a few videos on youtube, which address debugging in Matlab. (There should be demos/videos, which focus on debugging, on The Mathworks website, but I fail to find one now.) See e.g. Matlab Debugger tutorial, Part A. and MATLAB Tutorial: Debugger to walk through code. The latter is presented by Doug Hull of The Mathworks. He has a blog with hundreds of videos on The Mathworks website. If you are not comfortable with the debugging tools you might want to watch a couple of videos.
What I would have done
  1. make sure the Command Window and the Editor are docked in the Desktop, i.e. visible simultaneously.
  2. turn the code into a function, i.e add the line "function a_good_name()" at the top of the code and "end" at the end. Save the function.
  3. start explore the code
  2 个评论
Aaron
Aaron 2012-5-13
Erm, I guess. I'm just not 100% familiar with Matlab yet, but this is a start to my attempts to one of my Uni assignments.
Aaron
Aaron 2012-5-13
I've just emailed him, however, he did submit his code almost 2 years ago. Hope he responds.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Robotics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by