function invKin2(H,posX,posY,posZ,select)

globalVar;

param1 = select;
sendServo(H,INV_KIN_2,param1,0,0,0,0,0);
% [command,return1,return2,return3] = readServo(H);
% if(~(command == INV_KIN_2 && return1 == 1))
%     disp('OPERATION FAILED: Selecting Inverse Kinetic Type');
% end

posX = posX+400;
param1 = bitand(posX,MASK_HIGH) / 256;
param2 = bitand(posX,MASK_LOW);
posY = posY+400;
param3 = bitand(posY,MASK_HIGH) / 256;
param4 = bitand(posY,MASK_LOW);
posZ = 331-posZ;
param5 = bitand(posZ,MASK_HIGH) / 256;
param6 = bitand(posZ,MASK_LOW);

sendServo(H,INV_KIN_2,param1,param2,param3,param4,param5,param6);            

[command,return1,return2,return3] = readServo(H);

if(~(command == INV_KIN_2 && ~return1 && ~return2 && ~return3))
    disp('OPERATION FAILED: Testing Inverse Kinetic');
end

end