1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Download Package Now!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant here. Do not following these rules will lead to permanent exclusion from this website: Read the forum rules.

Hexapod Math help

Discussion in 'New users start here - FAQ' started by CrazyD, Sep 16, 2010.

  1. CrazyD

    CrazyD New Member

    Sep 16, 2010
    +0 / 0 / -0
    I'm trying to evaluate a Hexapod using Matlab, but its been a few years since I did matrix maths or Matlab so I'm a bit stuck.

    I have built a rough and ready 3D module and im trying to build a Matlab program to the same parameters.

    I have read both the following posts.


    Im am OK with calculating the leg lengths form know base and platform points

    PF1 = [210,0,0;0,-200,0;0,0,-350] ;% position matrix for Fixed point Leg 1
    PM1 = [80,0,0;0,-300,0;0,0,-50]; % Position matrix for moving point Leg 1
    % calculating leg length 1%
    L1CALC = (PM1-PF1)^2;
    L1SQU = L1CALC(1,1)+L1CALC(2,2)+L1CALC(3,3);
    L1 = sqrt(L1SQU); %ans = 341.9064

    although its not neat and i could reduce the number of calculations steps it works ok.

    so onto my problem.

    when the platform moves the PM(i) points will move in relation to the datum of the platform. with a simple X,Y,Z move it would be a simple translation.

    T=[50,0,0;0,200,0;0,0,-300]; % example translation of datum
    PMT1 = PM1+T;
    but what happens if I have to rotate, Pitch, Roll, Yaw. I have the use Euler angles to calculate the resultant position in space.
    say for example i have a point x=500 y=1000 z=0 from the movable platform datum and I want to Pitch,roll and yaw by 3,4,5 degree respectfully.

    I'm struggling with applying the maths.

    the suggestion is as follows, and although I can evaluate this i do not get the correct result.

    PMT= (PF + T) * [R]

    so lets give it a go, but with no translation.

    PM1=[500,0,0;0,1000,0;0,0,0]; %defines the initial PM1 position in relation to platform datum
    T = [0,0,0;0,0,0;0,0,0]; % at this point there is no translation
    pla = 3 * pi / 180; % alpha angle
    plb = 4 * pi / 180; % Beta angle
    plg = 5 * pi / 180; % gamma angle 
    %now to construct the Euler Matrix
    R = 
    [cos(pla)*cos(plg), (cos(plg)*sin(pla))+(cos(pla)*cos(plb)*sin(plg)), sin(plb)*sin(plg);
    %%and to evaluate it.
    MPT1 = (MP1 + T) * R;
    %% the result is as follow
    PMT1 = [498.1,60.8,3;
    %this isn't correct.
    can anybody help me?