You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: computeqLiftoffFinalJoint.m
    path of file: ./repos/vitruvio/scripts/joint space operations/qAFE heuristics
    
    the code of the file until where you have to start completion: function qLiftoff = computeqLiftoffFinalJoint(Leg, heuristic, linkCount, meanCyclicMotionHipEE, robotProperties, EEselection, configSelection, hipParalleltoBody)
 % Using inverse kinematics, solve the angle of all joints for the first timestep such that the angle between the final link and the ground at liftoff is as desired. 
 %% Setup
  tol = 0.0001;
  it = 0;

    
function qLiftoff = computeqLiftoffFinalJoint(Leg, heuristic, linkCount, meanCyclicMotionHipEE, robotProperties, EEselection, configSelection, hipParalleltoBody)
 % Using inverse kinematics, solve the angle of all joints for the first timestep such that the angle between the final link and the ground at liftoff is as desired. 
 %% Setup
  tol = 0.0001;
  it = 0;
  r_H_0EE_des = meanCyclicMotionHipEE.(EEselection).position(1,:); % desired EE position
  thetaLiftoff_des = heuristic.torqueAngle.thetaLiftoff_des;
  % get length of the final link, either foot or phalanges.
  if linkCount == 3
      if strcmp(EEselection,'LF') || strcmp(EEselection, 'RF')
        finalLinkLength = robotProperties.foot(1).length;
      else
        finalLinkLength = robotProperties.foot(2).length; 
      end