1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. 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 Now a Download Plan!
  3. 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
  4. 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. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Hexapod Math help

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

  1. CrazyD

    CrazyD New Member

    Joined:
    Sep 16, 2010
    Messages:
    1
    Balance:
    0Coins
    Ratings:
    +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.
    [​IMG]

    I have read both the following posts.

    control-of-6-dof-stewart-platform-t967-10.html
    new-6dof-stewart-platform-for-school-project-t1622-20.html

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

    Code:
    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.

    Code:
    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.

    Code:
    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);
    (-cos(plb)*cos(plg)*sin(pla))-(cos(pla)*sin(plg)),(cos(pla)*cos(plb)*cos(plg))-(sin(pla)*sin(plg)),cos(plg)*sin(plb);
    sin(plg)*sin(plb),-cos(pla)*sin(plb),cos(plb)];
    
    %%and to evaluate it.
    
    MPT1 = (MP1 + T) * R;
    
    %% the result is as follow
    
    PMT1 = [498.1,60.8,3;
    -121.7,988.8,86.9;
    0,0,0] 
    
    %this isn't correct.
    can anybody help me?